Page 1 of 1

USB CDC freeze on SAM3X4C

Posted: Wed Jan 14, 2015 7:27 pm
by ResDev
Hi all, I have a strange issue using ASF CDC example of Atmel Studio on a custom a board equipped with a SAM3X4C microcontroller.
I modified the CDC example making the board led flashing each 500 milliseconds and removing the sleep manager in this way: 

Code: Select all

int main(void)
{
	irq_initialize_vectors();
	cpu_irq_enable();

	// Initialize the sleep manager
	sleepmgr_init();

#if !SAMD21 && !SAMR21
	sysclk_init();
	board_init();
#else
	system_init();
#endif
	ui_init();
	ui_powerdown();

	 // Configure the on-board led
	gpio_configure_pin(PIO_PB7_IDX, LED0_FLAGS);

	// Start USB stack to authorize VBus monitoring
	udc_start();

	// The main loop manages only the power mode
	// because the USB management is done by interrupt
	while (true)
	{
		// Toggle on-board led and wait 500ms
		ioport_toggle_pin_level(LED0_GPIO); 
		delay_ms(500);	
		
		// sleep manager not needed for this test
		//sleepmgr_enter_sleep();			
	}
	return 0;
}
We did not modify any other part of the example code. More than 50 boards were assembled, all works fine but 5. Only on this 5 boards, we encounter the problem described below.

The on-board led stops flashing when the USB cable is not plugged. If the USB cable is connected before turning on the board, all works fine and the USB is properly recognized by the PC as an USB CDC device. 
Moreover, if the cable is removed, the board continues to properly run for some minutes and then freezes again. The freeze happens early if we short on purpose the USB 5V pin with the USB ground using a resistor. 
Let me remark that the board works fine if VBUS is high, even if it is simply connected to a 5V power supply.

We made these two tests:
1. Removing the udc_start() call, the board does not freeze anymore.
2. We run some tests using a debugger. Using the defective boards, it seems that ISR ISR(UDD_USB_INT_FUN) of uotghs_device.c file is called even when the cable is unplugged. On the contrary, using a working board, this ISR is called only when 5V are readed by VUSB monitoring pin; the ISR is not called anymore when the cable is unplugged. In fact, there is a different behaviour between the two boards. I this this could be important to understand the problem.
Indeed, it seems that in the defective board some USB interrupts are continuously invoked when USB cable is unplugged at all. 

We also double-checked the SAM3X EK schematic and the checklist to develop our board. This is the USB section of the boards: https://dl.dropboxusercontent.com/u/297 ... ematic.jpg
Our board is self-powered and cannot be used as OTG, so it doesn't need SP2525-2 component, as reported in SAM3X EK schematic.

Did you ever encountered a similar issue? Is there a specific component in our schematic that could cause this problem, if wrong or not accurate? 
Moreover, how could the freeze issue be related to the 5V input of USB connector? 

Thanks to all,
ResDev

Re: USB CDC freeze on SAM3X4C

Posted: Thu Jan 15, 2015 5:01 pm
by Tsuneo
The ESD protection diodes, IC1: PRTR5V0U2X, isn’t a good part for self-powered USB device.
Passing through the high-side diode in this chip, D+ pull-up voltage appears at VBUS line, while the USB connector is unplugged. This voltage disturbs detection of unplug at VBUS line.

Using the defective boards, measure the voltage of VBUS line, while the device is unplugged. You’ll see intermediate voltage near the threshold.
Solder off IC1 from the board. And then, the problem wouldn’t occur any more.

PRTR5V0U2X is good for USB host ports, but it doesn’t fit to device port.
For device port, diode array with just low-side diodes should be applied.

For example,

ST ESDAULC6-3BP6
http://www.st.com/st-web-ui/static/acti ... 165276.pdf

ON Semi NUP4060AXV6 (for full-/low-speed)
http://www.onsemi.com/pub_link/Collater ... AXV6-D.PDF

TI TPD4S012
http://www.ti.com/lit/ds/symlink/tpd4s012.pdf

Tsuneo

Re: USB CDC freeze on SAM3X4C

Posted: Thu Jan 15, 2015 6:33 pm
by ResDev
Hi Tsuneo,

thanks so much for your reply.

We soldered off the IC1 component. Unfortunately, the problem still occurs.
We are going to measure the voltage of VBUS line on the defective board with and without IC1; I'll keep you updated. 
In the meanwhile, please let me know if you have any other suggestion to fix this issue.

Thanks,
ResDev

Re: USB CDC freeze on SAM3X4C

Posted: Fri Jan 16, 2015 9:19 pm
by ResDev
I have some news:

1) Defective boards with IC1: VBUS goes to almost 2.64V with USB unplugged
2) Defective boards without IC1: VBUS goes to 0V with USB unplugged
3) Working board with IC1: VBUS goes to 0V with USB unplugged

Points 1 and 2 confirm what you said about the voltage, anyway the problem still occurs. 
Moreover, the freeze appears when VBUS goes to 0V, not when it is 2.64V. It sounds very strange.

Thanks again,
ResDev

Re: USB CDC freeze on SAM3X4C

Posted: Tue Jan 20, 2015 5:51 pm
by ResDev
up

Re: USB CDC freeze on SAM3X4C

Posted: Thu Feb 12, 2015 10:24 am
by Adalbert
Hello together,

i have the same problem with usb and mC freezing.
Has someone solved this problem?
Or an idea of what this might be?

thanks a lot.
Adalbert