Updating Firmware on Atmega 16u2

Go To Last Post
9 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Having some problems updating the firmware on an Atmega 16u2.

The chip is on a custom built Arduino derivative prototype. ISP 6 pin header connected to a AVRISP mkII.

Using winavr, I am entering:
avrdude.exe -c avrispmkII -p at90usb162 -F -U flash:w:path\to\file.hex

But I get the following error:
avrdude.exe: stk500_2_ReceiveMessage(): timeout

If I look in Device Manager on Windows 7, I can see:

    AVRISP mkII under LibUSB-Win32 Devices

    ATmega16u2 DFU under Other Devices with a yellow exclamation point telling me the driver is not installed

Any ideas?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you are using Windows why not try AS4 or AS5 (now AS6!)?

The alternative is to use Flip to contact the DFU that is in the 16U2 and forget the AVRISPmkII all together.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks Clawson.

Unfortunately, my computer doesn't detect the board when connected by USB, so I can't communicate to it using FLIP.

I came to the (perhaps false) conclusion that the chip didn't have the USB bootloader installed, so using WinAVR and the combined DFU and usbserial hex file available here, I burned them to the board.
https://github.com/arduino/Ardui...

Unfortunately, now the ATmeaga16u2 has disappeared altogether from the Device Manager.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

Unfortunately, my computer doesn't detect the board when connected by USB, so I can't communicate to it using FLIP.

Yes it does. You said:
Quote:
ATmega16u2 DFU under Other Devices with a yellow exclamation point telling me the driver is not installed

So the USB enumeration has got as far as knowing it is a 16U2 with DFU. The yellow asterisk is simply saying it could not find a .inf file to tell it what driver matches the VID/PID. I don't know a lot about Flip but I assume it comes with a .inf and .sys file that should add this support?
Quote:

Unfortunately, now the ATmeaga16u2 has disappeared altogether from the Device Manager.

Ah then that's a shame but if you simply unplug/plug it maybe it will return? At the AVR end you may have to do something with the HWB pin to trigger this. Of course if you have been in contact with the chip using ISP then it could be that DFU has now been erased from it? (bootloaders are safest when ISP is avoided)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It was only ever detected when connected to the AVRISP mkII, not when it was connected via USB.

Unplugging it and plugging it back in doesn't do anything to aid in its detection. Tried with USB and with the AVRISP mkII.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

It was only ever detected when connected to the AVRISP mkII, not when it was connected via USB.

Ah ha! Then that sounds like it could have been some kind of grounding issue or even that the mkII was back-powering it.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You got it. I forgot to connect a solder jumper pulling one of the USB pins to ground.

Thanks! Never would have thought to look.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Zombie thread resurrection.  Can anyone be more specific on the fix that happened here?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sure. He's connecting the 16u2 cpu to usb, but sometimes one or both of the usb signal lines (D+ and D-) have to be tied to ground for the signal to be properly recieved. Aparently he's using a circuit board that has a pair of solder jumpers for that purpose and he had to tie them low them to make it work.