Author Topic: UC3-A3 High speed USB data transfer  (Read 5079 times)

0 Members and 1 Guest are viewing this topic.

Offline StephenBTopic starter

  • Newbie
  • Posts: 5
UC3-A3 High speed USB data transfer
« on: June 13, 2014, 08:59:14 pm »
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.aspx
This 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.html
I'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 questions :P

If anyone has some experience with this and could get me started, I would greatly appreciate it. I'm still moving from 8-bit microcontrollers ;)

Thanks in advance!
 

Offline jeremy

  • Super Contributor
  • ***
  • Posts: 1079
  • Country: au
Re: UC3-A3 High speed USB data transfer
« Reply #1 on: June 13, 2014, 09:40:50 pm »
Yes, virtual com port will be too slow for your purposes. You probably want bulk transfers, padded to 64 bytes (see here). 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.
 

Offline theatrus

  • Frequent Contributor
  • **
  • Posts: 352
  • Country: us
Re: UC3-A3 High speed USB data transfer
« Reply #2 on: June 13, 2014, 09:54:00 pm »
Yes, virtual com port will be too slow for your purposes. You probably want bulk transfers, padded to 64 bytes (see here). 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.

High 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)
Software by day, hardware by night; blueAcro.com
 

Offline StephenBTopic starter

  • Newbie
  • Posts: 5
Re: UC3-A3 High speed USB data transfer
« Reply #3 on: June 13, 2014, 10:00:26 pm »
Thanks both,
My application is not meant to be redistributed, only for personal use. Do I really need to license drivers then?
 

Offline theatrus

  • Frequent Contributor
  • **
  • Posts: 352
  • Country: us
Re: UC3-A3 High speed USB data transfer
« Reply #4 on: June 13, 2014, 10:34:19 pm »
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.
Software by day, hardware by night; blueAcro.com
 

Offline jeremy

  • Super Contributor
  • ***
  • Posts: 1079
  • Country: au
Re: UC3-A3 High speed USB data transfer
« Reply #5 on: June 14, 2014, 12:41:34 am »
You can boot into a safe mode that allows you to install unsigned certificates, so yes that is possible.
 

Offline StephenBTopic starter

  • Newbie
  • Posts: 5
Re: UC3-A3 High speed USB data transfer
« Reply #6 on: June 14, 2014, 08:46:41 am »
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.php
I 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!
 

Offline theatrus

  • Frequent Contributor
  • **
  • Posts: 352
  • Country: us
Re: UC3-A3 High speed USB data transfer
« Reply #7 on: June 15, 2014, 02:10:13 am »
I would use the Atmel Software Framework USB stack on the AVR32. This comes with AVR Studio, and has example applications for USB.
Software by day, hardware by night; blueAcro.com
 

Offline StephenBTopic starter

  • Newbie
  • Posts: 5
Re: UC3-A3 High speed USB data transfer
« Reply #8 on: June 16, 2014, 08:29:05 pm »
I would use the Atmel Software Framework USB stack on the AVR32. This comes with AVR Studio, and has example applications for USB.
I 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.pdf

The 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!
 

Offline StephenBTopic starter

  • Newbie
  • Posts: 5
Re: UC3-A3 High speed USB data transfer
« Reply #9 on: June 17, 2014, 08:27:23 am »
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 it :) A 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
 

Offline motocoder

  • Supporter
  • ****
  • Posts: 769
  • Country: us
  • Electrical Engineer
Re: UC3-A3 High speed USB data transfer
« Reply #10 on: June 18, 2014, 09:33:44 am »
Yes, virtual com port will be too slow for your purposes. You probably want bulk transfers, padded to 64 bytes (see here). 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.

Look 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).aspx

The 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.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf