Xmega USB stack example working?

1,005 views
Skip to first unread message

Erik Walthinsen

unread,
Sep 5, 2012, 1:18:43 PM9/5/12
to nonoli...@googlegroups.com
I'm trying to get the USB stack up and running on my Xmega here, but it doesn't want to work.  Right now I'm running on an x192a3u, though I have an x32a4u to mount and try if I need to.  When I plug in USB I get:

Sep  5 10:14:44 omicron kernel: [432729.527184] usb 6-2.4: new full speed USB device using uhci_hcd and address 75
Sep  5 10:14:44 omicron kernel: [432729.617150] usb 6-2.4: device descriptor read/64, error -71
Sep  5 10:14:44 omicron kernel: [432729.817118] usb 6-2.4: device descriptor read/64, error -71
Sep  5 10:14:44 omicron kernel: [432730.007096] usb 6-2.4: new full speed USB device using uhci_hcd and address 76
Sep  5 10:14:44 omicron kernel: [432730.097084] usb 6-2.4: device descriptor read/64, error -71
Sep  5 10:14:44 omicron kernel: [432730.297058] usb 6-2.4: device descriptor read/64, error -71
Sep  5 10:14:45 omicron kernel: [432730.487036] usb 6-2.4: new full speed USB device using uhci_hcd and address 77
Sep  5 10:14:45 omicron kernel: [432730.905808] usb 6-2.4: device not accepting address 77, error -71
Sep  5 10:14:45 omicron kernel: [432730.986967] usb 6-2.4: new full speed USB device using uhci_hcd and address 78
Sep  5 10:14:46 omicron kernel: [432731.405774] usb 6-2.4: device not accepting address 78, error -71
Sep  5 10:14:46 omicron kernel: [432731.406918] hub 6-2:1.0: unable to enumerate USB device on port 4

USB goes to a full-speed hub here, if I hook it to a high-speed hub the error code is -32.  If I tweak the example settings for low-speed, I get pretty much the same thing.

Except for modifications to make it build on the x192a3u (with header file pulled from AVR Studio and installed with avr-libc 1.8.0), the code is unmodified.  Is it *supposed* to work out of box from current git?  Or does the fact that I have about 1" jumper wires on the breadboard in the USB path a problem?  I have a *real* board with a straight shot (albeit to a USB isolator, but the FT232RQ is working) that I can try with some modifications, if I have to.


I really need to get USB working on this project because the FT232 is limited to 3Mbps and I need 4+....  Any help would be appreciated ;-)

Kevin Mehall

unread,
Sep 6, 2012, 12:59:42 PM9/6/12
to nonoli...@googlegroups.com, om...@omegacs.net
I haven't tested it on anything other than the x32a4u and the x256a3bu, but as far as I know, the USB hardware is identical on all xmega-U parts. Make sure the clock speed setup (USB_ConfigureClock) is correct for your xmega part.

Which application code are you trying to use? The project in the example/ directory? I just checked the example in both the master branch and v2 branch on github, and both work on my 32a4u board. I'm compiling with the Atmel binary toolchain from http://www.atmel.com/tools/atmelavrtoolchainforlinux.aspx.

The v2 branch has optimizations and an improved API. We're using it in the new CEE firmware 1.2. Since it's stable, I will be merging it to master shortly, so try that branch and see if it works better.

The build system is a bit of a hack (especially in the old branch) as it tries to support older compilers that don't have native support for the USB-enabled parts (it compiles as 32a4 but provides its own 32a4u header). In the old master branch there was another mention of the part name in the USB-XMEGA/makefile that shouldn't have been there. The v2 branch supports changing the part name more easily, and comes with headers for all USB-enabled parts.

I've used jumper wires with low speed USB before. Full speed would probably be fine too, but I don't know. 

Hope that helps, and thanks for reminding me to get more documentation up so you and others can use the USB stack more easily.

--
Kevin Mehall
Nonolith Labs

Erik Walthinsen

unread,
Sep 6, 2012, 1:13:15 PM9/6/12
to nonoli...@googlegroups.com, om...@omegacs.net
V2 is *much *better* ;-)  I had to drop the current consumption in the descriptor because of the hub it's connected to, but it came up right away.  Wonder what the key difference was?  May need to try to figure out so I don't screw something up....

Thanks!!!

Erik Walthinsen

unread,
Sep 6, 2012, 1:15:20 PM9/6/12
to nonoli...@googlegroups.com, om...@omegacs.net
Oh, and this saves me getting my head dragged through the meatgrinder that is AVR Studio 6 and the ASF....  Got a stock example from there working, but can't even get a serial debug (to trace the layers of ASF) set up because I can't convince it to run the MCU off the crystal, and it's over 5% off clock, which makes RS-232 reeeeeally unhappy.
Reply all
Reply to author
Forward
0 new messages