USB TX problems on ATMEGA32U4

1 post / 0 new
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am trying to reply to a SETUP / get device descriptor packet (80 06 00 01 00 00 40 00).  I've gone over the datasheet several times and looked over other code, but can't figure out what I'm doing wrong.


The hardware is an Olimex board with an ATMEGA32U4 clocked at 16 Mhz.


Software setup is AVR Studio 4 using an Olimex AVRISP adapter.


I'm sending debug data through the UART to putty so I can see the registers.


I'm using USBLyzer to view the USB output on the PC.  I expected the 18-byte device descriptor I'm sending from the AVR to show up in the analyzer, but no packets appear.  I am operating the USB interface in high speed mode, so the 18-byte TX should not be an issue.


Fuses are E=0xCB H=0xD9 L=0xDF.


Simulating the code doesn't reveal anything unusual.


If I don't clear TXINI after loading the 18-byte packet, UEBCLX is 18, as expected.  When I do clear TXINI, UEBCLX goes to zero, also as expected. 


Looking at the scope, if I send the packet, the PC gives up after 1.5s, where if I don't send it, there's about 4 seconds of traffic so it looks like something is being sent.


Edit:  I put a scope on the board and it turns out the code works just fine.  USBLyzer only shows traffic from devices that enumerate without errors.  It would be useful for snooping on fully functional devices, but for building one, a good hardware analyzer is probably the right tool for the job.


Last Edited: Sat. Dec 12, 2015 - 06:31 AM