Author Topic: USB problems on Atmel ATSAM3X8EA (maybe board layout issues?)  (Read 4960 times)

0 Members and 1 Guest are viewing this topic.

Offline mribbleTopic starter

  • Regular Contributor
  • *
  • Posts: 202
I'm building a project using the atsam3x8ea.  This is the same micro used in the Arduino Due.  I didn't include the ftdi chip that can be used for programming the due and instead planned to just use the native usb for programming.  I got the board back and I couldn't program it.  I tried the jtag and I can program it that way.

At this point I'm pretty sure my schematic for usb is correct and that it matches the data sheet recommendations and the Arduino due.  The error I get on the PC trying to connect is an error 0, which seems to mean nothing is working.  There is enough signal that the PC thinks something is connected, but it has no usb communications working so it doesn't know what (not 100% sure about this though).  This does require either erasing the flash memory or setting the boot fuse to use the ROM so that's not my problem.

I have looked over the web for fuses that might need to be set on the sam3x to make usb work, but it seems like it should work by default.

The only idea I have left is that my pcb layout is too noisy.  When doing the initial layout I didn't worry much about these traces.  Since then I've read it's important to keep the differential pair in usb about the same length.  By random luck I'm pretty good there.  I also read you don't want to have many traces crossing this differential pair on the pcb.  I do have a number of these.  My traces are about 1.6 inches long on the pcb.  Does anyone know how sensitive the usb on the sam3x is to this?

I've looked at the data sheet for the sam3x and I'm not understanding how you control if it uses full speed (12Mbps) or high speed (480Mbps)?  I'm fine with it just using the full speed and it seems that would be a lot less sensitive to bad board design issues.  I have them both connected with the 39R going to the full speed pins as recommended in the datasheet.  If the high speed is used by default can I cut the traces for the high speed and it will use full speed?

If anyone has tips on how these sorts of problems can be debugged and fixed let me know.  I'm not used to this analog differential pair stuff.  My strength is definitely on the coding side of things...
 

Offline Kremmen

  • Super Contributor
  • ***
  • Posts: 1289
  • Country: fi
Re: USB problems on Atmel ATSAM3X8EA (maybe board layout issues?)
« Reply #1 on: July 19, 2014, 07:54:33 pm »
There are far too many possibilities to guess what may be wrong. Just for starters - have you initialized all the necessary peripheral clocks and plls? Have you configured the GPIO pins for USB? Interrupts set properly? How about APB and dual RAM setups?
My suggestion would be to just create one of the ASF example projects in Studio 6.2 / ASF 3.18 and study how it is done there. USB setup is decidedly non-trivial so my money is on the suspicion that a necessary initialization step remains undone. Also the data sheet is certainly your friend.

Nothing sings like a kilovolt.
Dr W. Bishop
 

Offline mribbleTopic starter

  • Regular Contributor
  • *
  • Posts: 202
Re: USB problems on Atmel ATSAM3X8EA (maybe board layout issues?)
« Reply #2 on: July 19, 2014, 09:17:33 pm »
I would think it should be greatly simplified by the facts:
1) I can load a program and it runs with jtag
2) The built in bootloader is supposed to handle all the setup neccissary for programming via usb

So from your starter list I think #1 handles periferal clocks.  #2 handles plls, gpio for usb, interupts, apb, and ram bank setup.

Maybe I wasn't clear, but I'm not trying to do some general usb programming (yet).  I'm trying to have the usb port detected when using the internal ROM bootloader on this chip and then program via that port.
 

Offline Kremmen

  • Super Contributor
  • ***
  • Posts: 1289
  • Country: fi
Re: USB problems on Atmel ATSAM3X8EA (maybe board layout issues?)
« Reply #3 on: July 20, 2014, 06:22:31 am »
OK i quickly peeked the datasheet and looks like you are right. The bootloader is built-in and it supports USB by default, as it should of course. The next thing that comes to mind is that according to the sheet, the USB clock generation is somewhat strict as usual. Have you been able to verify that the clocks are generated properly because if not, the USB system refuses to activate.
Nothing sings like a kilovolt.
Dr W. Bishop
 

Offline mribbleTopic starter

  • Regular Contributor
  • *
  • Posts: 202
Re: USB problems on Atmel ATSAM3X8EA (maybe board layout issues?)
« Reply #4 on: July 20, 2014, 10:39:48 am »
The USB clock generation for usb is: " 12.000 MHz quartz or 12.000 MHz external clock on XIN. 12 MHz must be ±500 ppm and 1.8V Square Wave Signal."

I'm using this 12 MHz crystal which has 50 ppm (much better than required): http://www.mouser.com/ProductDetail/Fox/FOXSDLF-120-20/?qs=%2fha2pyFaduiVckxK0QC4C4xnzk7rn1cICPPBk8A3v3iIcHuZvV62ag%3d%3d

I don't quite know what the 1.8V square wave part means there.  I think that just means the device's core voltage is 1.8V, which I have verified.  I also looked at t 12MHz clock on my board vs a Due and they look similar.

I only have a 50 MHz scope so I can't look at high speed usb signals with it, but I think I could look at full speed usb if I knew what to look for.  The problem is I don't know enough about usb.  The bootloader description in the the SAM3x datasheet doesn't say how it determines if full or high speed usb is used.  I'm still wondering if I can just cut some traces on the high speed usb to force it to use full speed, and if high speed is used by default.

I'm worried about the board layout and would like to test the slower full speed modes if practical, but haven't found a place that describes an easy way to do this in hardware.  After more reading I found if you have a USB 1.1 hub it should force devices to the slower USB if they follow protocols (which I would expect Atmel to do).  I've ordered one of those usb 1.1 hubs and will see if that fixes it.  If it does I'll be convinced it's a signal integrity issue with my board and try to improve that with the next board version.

Until that hub arrives I'm happy to try other things so if you have ideas let me know.
 

Offline mribbleTopic starter

  • Regular Contributor
  • *
  • Posts: 202
Re: USB problems on Atmel ATSAM3X8EA (maybe board layout issues?)
« Reply #5 on: July 23, 2014, 12:35:46 am »
Just wanted to give an update.  I tried using a USB 1.1 hub and that fixed my problem.  That points at layout issues so when I do v2 of the board I'll be more careful.  Thanks for the help!
 

Offline idpromnut

  • Supporter
  • ****
  • Posts: 613
  • Country: ca
Re: USB problems on Atmel ATSAM3X8EA (maybe board layout issues?)
« Reply #6 on: July 23, 2014, 04:30:11 pm »
I was recently chastised by our resident EE here at work about my hobby board USB layout :)  A couple of things that I was told:

  • The D+ / D- lines are a an controlled impedance differential pair, so treat it as such! (i.e. route the pair so the lengths of the traces are approx. equal)
  • The USB data lines need to be 100Ohm controlled impedance traces (my redesigned traces were ~ 110Ohm)
  • This apparently won't make a huge difference at USB 1.0/1.1 speeds, but will for sure affect USB 2.0 performance
  • Have a solid ground plane under your data line traces
  • Ensure that you leave a gap between your data traces and the nearest non-USB data trace as 2.5x the spacing between your two USB data traces. E.g., if you have 10mils between your D+ / D- traces, you should leave about 25mils between the outside of these two traces and all other nearest pads/traces.

Note that this applies to USB data trace runs that are reasonably long; a 1 inch long D+ / D- trace will probably work regardless (apparently).
« Last Edit: July 24, 2014, 02:33:30 pm by idpromnut »
 

Offline Laertes

  • Regular Contributor
  • *
  • Posts: 58
  • Country: de
Re: USB problems on Atmel ATSAM3X8EA (maybe board layout issues?)
« Reply #7 on: July 23, 2014, 08:45:38 pm »
If your USB data lines are 1.6in long on the board and you did not take measures to ensure controlled impedance(thus probably violating the 100 ohms rule) then that's most likely the issue. Full speed with its reasonably low frequencies might still work well but the operating frequency of Hi-speed is around 50 times higher than full speed, and impedance does matter a lot at these speeds. The fact that the connection works with full speed seems to support that theory.
Maybe you could estimate your trace impedance with something like that: http://www.eeweb.com/toolbox/microstrip-impedance and tell us your results.
Also, it's probably a good idea to try and minimize the trace length of the USB signal...

You might find USB routing guides helpful, like this one here: www.ti.com/lit/an/spraar7a/spraar7a.pdf

It's in the guide and has been stated here, but I still want to stress this again: Never run any signals directly under a USB line. If you only have two layers, put solid ground there and that's it, if you have more layers, put a solid ground plane between your high-speed line and anything else(apart from the paired high-speed line, of course).
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf