ATSAM3X USB Issue Help

Discussion around product based on ARM Cortex M3 core.

Moderators: nferre, ncollot

Posts: 2
Joined: Thu Nov 20, 2014 3:30 am

ATSAM3X USB Issue Help

Thu Nov 20, 2014 4:53 am

Hello all.  Hoping that some of the more experienced here can enlighten me.  I'm new to ARM, but have been working with AVR chips for quite some time (pre-Arduino) coded with CVAVR (great software!).  I decided I would try to slowly foray into the ARM world to support some of my more demanding projects.  

I'm starting with making a sort of smaller DUE clone that I want to start to program with the Arduino IDE, and slowly transition to Atmel Studio at a later date.  I've managed to protoboard essentially a DUE version of the ATSAM3X4C from the Arduino schematics.  See picture:


Using just the built in ROM SAM-BA, I can use a real DUE to communicate with it, get the version, read and write to memory, and even send a file using the Xmodem protocol over the PA8 and PA9 serial port.  This tells me that the majority of the chip is working correctly.  I'm working to get a RS-232 to TTL board to program the chip directly with the SAM-BA utility over serial, but that's one step removed from my goal.

The problem arises, as with most other newbies in the forum, when I connect the USB connection to my PC.  In my case, the PC (Windows 7) recognizes the device, but malfunctions (code 43).  I cannot load any drivers, and the hardware ID shows as USB\UNKNOWN which tells me the PC saw the connection but never communicated.  I am new to USB as well, but I've been looking at the traces.  Below are two pictures.  The first a long time scale of the traces as recorded (0.02 second increments).  The second is a higher samplerate overlaid trace of the first.  My current DIY scope (DPScope) does not let me do much else in terms of data recording, but I believe it gets the point across. 



From the data above, it seems that the positive connection pings for data, while the negative seems to not work as intended (from the little I've read I believe that it should be a differential signal where positive/negative flip to transmit data, but I could be wrong).  I am using 39 ohm resistors on the D+- lines as described in the datasheet and on the Arduino schematic.

Things I know are working right from reading the datasheet or debuging:
  • The XTAL crystal is recognized properly. Removing it or changing the capacitor values makes it so the USB never enables, as described in the datasheet.
  • All the voltage inputs are at the correct values.  I've correctly installed all decoupling capacitors and EMI filter equivalents.
  • The processor is not fried or misconfigured as evidenced by the ability to communicate with the boot loader over serial.
The only deviation from the Arduino Schematic I have is that I have currently left XTAL32 disconnected since it seems only the RTC needs it, and I don't have it as I ordered the wrong part for it (32 MHz instead of 32kHz, doh).

I'm out of ideas on what else to try, so I'm hoping someone might provide some positive direction.

Thanks in advance.
Posts: 6
Joined: Wed Sep 24, 2014 11:23 am

Re: ATSAM3X USB Issue Help

Thu Nov 20, 2014 8:45 pm

My current DIY scope (DPScope) does not let me do much else in terms of data recording, but I believe it gets the point across.
You can’t get 12MHz bus signaling correctly drawn by 100kHz sampling scope.
You should not rely on your scope monitoring at all.

On your picture, a crystal can is seen far left end.
Is it the 12MHz crystal for the main OSC?
It’s too far from the SAM3 chip.
This layout causes unstable crystal oscillation, which hits USB communication.
This problem often occurs in the MCU setup using breadboard.

You have two options,
A) Mount the crystal (and capacitors) on your MCU board, near to the SAM3 chip
You may mount a SMD crystal / capacitors on a daughter board, so that the daughter board connects to the SAM3 chip on the MCU board.

B) Replace the crystal with an external oscillator (3V3, 12MHz), which provides clock to OSC XIN (36pin)
In this case, you have to modify the startup code, so that the main OSC works in bypass mode.

Replace CKGR_MOR_MOSCXTEN with CKGR_MOR_MOSCXTBY in two lines of SystemInit()

Code: Select all

void SystemInit(void)
	/* Set FWS according to SYS_BOARD_MCKR configuration */

	/* Initialize main oscillator */
			                     CKGR_MOR_MOSCRCEN | CKGR_MOR_MOSCXTEN;   // <---
		while (!(PMC->PMC_SR & PMC_SR_MOSCXTS)) {

	/* Switch to 3-20MHz Xtal oscillator */
	                           CKGR_MOR_MOSCRCEN | CKGR_MOR_MOSCXTEN | CKGR_MOR_MOSCSEL; // <---
Posts: 2
Joined: Thu Nov 20, 2014 3:30 am

Re: ATSAM3X USB Issue Help

Wed Feb 04, 2015 4:15 am

Just thought I would report back, in case any others were suffering from similar issues.  

It was indeed the location of the crystal.  I have since built the custom PCB on which the USB works like a champ.  

Tsuneo, thanks for the help!

-Panama Joe

Return to “SAM3 Cortex-M3 MCU”

Who is online

Users browsing this forum: No registered users and 11 guests