1
\$\begingroup\$

I have an issue with ATmega16U2 which includes hardware USB support. As the datasheet describes:

The 8bits mega AVR with USB interface devices are factory configured with a USB bootloader located in the on-chip flash boot section of the controller.

So I have created a printed circuit board with ATmega16U2 and plugged it into my PC. To start it into bootloader mode I have shorted RESET and HWB to ground, then released RESET and HWB after that (both pins are pulled up). Unfortunately, my PC is unable to communicate with plugged device, leaving following error:

enter image description here

To make sure that it's not hardware problem (bad circuit: coupling, long paths, high impedance, shorts etc) i connected to it with an ISP programmer. I was able to read chip signature, fuse/lock bits. I wiped whole chip and flashed it with Arduino software (first easy-to-find hex file on the Internet that came into my mind). It does work - recognized as serial communication device, which received it's COM enumeration. Then I have soldered another ATmega16U2 chip onboard and connected it again, but still I cannot communicate with factory chip bootloader. Only thing that changed is the chip: from flashed stock chip to pure stock.

Here is my circuit schematics. I'm using 16 MHz crystal right now, I have teste 8 MHz crystal too:

enter image description here

Thank you for reading and please share your experience if you have worked with those microcontrollers.

\$\endgroup\$
  • \$\begingroup\$ Have you made sure the crystal frequency matches what the bootloader expects, and that you have correctly set the fuses to use the crystal? \$\endgroup\$ – Tom Carpenter Jan 20 '17 at 13:19
  • \$\begingroup\$ Take look in this datasheet note, it says that 8 or 16 MHz crystals are fine: atmel.com/Images/doc7618.pdf \$\endgroup\$ – Adrian Adamczyk Jan 20 '17 at 13:22
  • \$\begingroup\$ I tried both 8/16 MHz crystals. Also, the chip comes with factory programmed lock bits which blocks from changing fuse bits. Only after full chip erase I am able to change fuse/lock bits, but whole program in flash (bootloader) is gone. \$\endgroup\$ – Adrian Adamczyk Jan 20 '17 at 13:24
  • \$\begingroup\$ Interesting.... \$\endgroup\$ – Tom Carpenter Jan 20 '17 at 13:25
  • 1
    \$\begingroup\$ are those really 1M resistors inline with the USB port signals? If so they should bee 22R-ish \$\endgroup\$ – Tom Carpenter Jan 20 '17 at 15:04
1
\$\begingroup\$

After some time working on another project, I decided to remake my PCB. I did some changes, shorten the traces, moved THT components on the other layer etc.

And it worked. My uC is recognized and enumerated as "ATmega16U2". This makes me feel confused, because my first PCB seemed to be good enough.

Thank you for responses. Now it's time to implement functionality, I'm going to use LUFA to make COM communication.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.