UC3-A3 High speed USB data transfer - Page 1
Forum section: electronics / general

author: StephenB
author_rank: Newbie
timestamp: June 13, 2014, 08:59:14 pm
content: Hello all,For my application, I want to send a stream of data to a microcontroller via USB once in a while and then let the µC do something with that data later. The requirement was that the µC should be able to store a reasonable amount of data at once in its SRAM, and I wanted fast data transfer speed: high speed USB (480 Mbit/s). I compared a lot of options, and because I don't have enough experience to do everything from scratch I bought the AVR UC3A3-Xplained dev board:http://www.atmel.com/tools/uc3-a3xplained.aspxThis board contains a 32-bit AT32UC3A3256 with a high-speed USB interface and lots of SRAM. I use AtmelStudio and I've written some basic programs to blink leds and those work, so I can successfully program the board.Now, I have spent a few hours/days trying to get some USB communication working, using this:http://asf.atmel.com/docs/3.9.1/uc3a3_a4/html/udi_cdc_quickstart.htmlI've imported this with the ASF Wizard but when I plug it in, the board appears to be doing something for 10 seconds until Windows tells me the device is unrecognized.Even if I get it working, I seem to understand the code will provide me with a virtual COM port. Isn't there a better alternative that also verifies all my data is transferred correctly? Also I don't have a clue how to enable high speed USB later. Many questionsIf anyone has some experience with this and could get me started, I would greatly appreciate it. I'm still moving from 8-bit microcontrollersThanks in advance!

author: jeremy
author_rank: Super Contributor
timestamp: June 13, 2014, 09:40:50 pm
content: Yes, virtual com port will be too slow for your purposes. You probably want bulk transfers, padded to 64 bytes (seehere). Sorry, I am not familiar with the UC3 chips so my help stops here!You will probably have to write your own drivers for this, which means you will need to pay for a signing certificate from microsoft if you wish to distribute it to be used with windows.

author: theatrus
author_rank: Frequent Contributor
timestamp: June 13, 2014, 09:54:00 pm
content: Quote from: jeremy on June 13, 2014, 09:40:50 pmHigh Speed USB actually uses 512 byte blocks.In short, you're not going to get much success with the USBSER.sys based COM driver. You'll need to use bulk mode transfers, in high speed mode, of 512 bytes. On Windows, this means using WinUSB. On Linux or OS X, you might as well use libusb, and there is libusb-for-windows-WinUSB which does work well. You'll need to sign the .inf file assembly (even if you didn't write the kernel driver) in order to install it on Windows Vista and above - signing certs are about $95/year for this (http://codesigning.ksoftware.net/is the cheapest I ever found)

author: StephenB
author_rank: Newbie
timestamp: June 13, 2014, 10:00:26 pm
content: Thanks both,My application is not meant to be redistributed, only for personal use. Do I really need to license drivers then?

author: theatrus
author_rank: Frequent Contributor
timestamp: June 13, 2014, 10:34:19 pm
content: You can look into installing a local certificate root and 'self'-signing. I believe this is still possible as the USB driver isn't needed to boot Windows.

author: jeremy
author_rank: Super Contributor
timestamp: June 14, 2014, 12:41:34 am
content: You can boot into a safe mode that allows you to install unsigned certificates, so yes that is possible.

author: StephenB
author_rank: Newbie
timestamp: June 14, 2014, 08:46:41 am
content: So I found this option for the PC side, which doesn't look that hard:http://delog.wordpress.com/2012/03/23/custom-usb-driver-and-app-using-winusb-and-c/For the firmware, I found LUFA:http://www.fourwalledcubicle.com/LUFA.phpI see there is partial UC3 support. Inside the download, I found "Demos\Device\LowLevel\BulkVendor". I guess that's what I need? I don't even know if LUFA is really required, I found it by searching a bit more. No idea if this will even work on my µC without editing many device-specific things.Thanks in advance for any help!

author: theatrus
author_rank: Frequent Contributor
timestamp: June 15, 2014, 02:10:13 am
content: I would use the Atmel Software Framework USB stack on the AVR32. This comes with AVR Studio, and has example applications for USB.

author: StephenB
author_rank: Newbie
timestamp: June 16, 2014, 08:29:05 pm
content: Quote from: theatrus on June 15, 2014, 02:10:13 amI have now come across the USB Device Vendor Class Examples from the ASF, but in the past the name didn't really attract my attention, but now I'm pretty sure that's what I need:http://www.atmel.com/Images/doc8481.pdfThe problem is, my board is not among the list of boards supported by that example, but luckily the EVK1104 is, which uses the same µC. But I just can't seem to find how to switch the board in Atmel Studio. Can anyone help me with that?Thanks in advance!

author: StephenB
author_rank: Newbie
timestamp: June 17, 2014, 08:27:23 am
content: Update: I created a new blank project for my board, imported the required ASF libs and then copied the code. Finally I was able to compile itA led turns on and Windows asks me for a driver, and there's one included by Atmel. So I can now get started figuring out how the code works :p

author: motocoder
author_rank: Unknown
timestamp: June 18, 2014, 09:33:44 am
content: Quote from: jeremy on June 13, 2014, 09:40:50 pmLook into WinUSB. It is a generic USB driver that Microsoft created so that in many cases developers would not need to create a custom USB driver.http://msdn.microsoft.com/en-us/library/windows/hardware/ff540196(v=vs.85).aspxThe open source libusb project uses WinUSB as the back-end driver on Windows now.If you're not committed to a USB interface in a micro, another option is to use an FT232H chip from FTDI, and their D2XX driver. This comes with a DLL that allows you to interface with the chip w/o having to write a custom driver.Note that even though you avoid having to write a device driver this way, you may still need to get a code signing certificate in order to package everything up such that the OS recognizes the vendor and device ID for your hardware and installs the appropriate generic driver.