USB noise problem

Hello All, I am working on a CNC controller card which uses USB for communication with PC. CNC system is having AC drives, Stepper motors, Heavy contactors which generates large noise (EMI). The card is optically isolated, USB cable is also shielded.

But some time USB hangs means -> PC application software hangs

1) Then I have to unplug the USB cable & re-plug it, OR 2) By disabling and re-enabling the USB driver in device manager Application software starts running.

I am using Silab C8051F340 processor. While in this situation my processor never hangs, it responses to external IO's. So

-> I am confused when USB communication stops whether Host USB controller hangs or Slave USB or both hangs.

-> I want software solution for this problem means, I detect the this condition, either Slave side or Host side then I will reset the USB communication.

Regards, Kishor.

Reply to
kishor
Loading thread data ...

If unplugging and replugging it fixes the issue, then can't you have a timeout in the 8051 s/w that does a detach/reattach if it doesn't receive anything from the host in a certain period of time?

Of course you really should fix this problem at the root cause, otherwise the detach/reattach/enumerate/initialize may happen in the middle of an operation with powered tools...!

Reply to
larwe

If you can force the USB to operate at it's slowest mode (12Mbps?) you may get more noise immunity.

--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com

Do you need to implement control loops in software?
"Applied Control Theory for Embedded Systems" gives you just what it says.
See details at http://www.wescottdesign.com/actfes/actfes.html
Reply to
Tim Wescott

Bad idea. USB is flimsy interface intended for the tabletop conditions.

No wonder. This is what expected.

Because the USB software is developed in the assumption of the perfect communication link.

Then you have to develop all of the software and drivers yourself.

There is no good solution with USB. Use Ethernet.

Vladimir Vassilevsky DSP and Mixed Signal Design Consultant

formatting link

Reply to
Vladimir Vassilevsky

uses USB for

The C340 does not support high-speed USB (480 Mbps), so he's probably running at full speed (12 Mbps).

-a

Reply to
Andy Peters

Ground loops?

--

Tauno Voipio
tauno voipio (at) iki fi
Reply to
Tauno Voipio

Hi, USB speed is 12 mbps. We are taking care at next hardware design to reduce the noise. But still I want to know one think, **** How can I detect USB link breaks (or Hang condition) ???? please give me any "link" to this problem and also PCB design guidelines to reduce noise problem.

Thanks & Regards, kishore.

Reply to
kishor

The best site for USB info is:

formatting link

or

formatting link

Good paper on Board Layout issues

formatting link

EMI issues

formatting link

The device should no worry about loss of connectivity, beyond what the spec covers, which is part of the basic enumeration code that comes with the device. The device is a slave. If there are connectivity problems, it is up to the host to recognize that and handle them appropriately.

If the host hangs, the drivers or other software are improperly written. If this is Windows, your communication with the USB drivers should have timeouts in them.

Marco

The C340 does not support high-speed USB (480 Mbps), so he's probably running at full speed (12 Mbps).

-a

------------ And now a word from our sponsor --------------------- For a secure high performance FTP using SSL/TLS encryption upgrade to SurgeFTP

---- See

formatting link
----

Reply to
Marco

We are using read files and write file function of windows API to access our USB devices based on Silab microcontroller. For these functions there are timeout setting but these setting can be used for com ports and not for any other IO devices. So whenever we called read file function and the USB device does not responds, then application hangs. since software does not return from read file function we need to disconnect USB device to make read file function return error ie. "USB device not found" Please suggest any solution for this problem.

Thanks & Regards, Kishor.

Reply to
kishor

The big difference between a real serial port and a USB port is that USB serial ports can fail at any time. Consequently you must poll the serial port using ClearCommError() before every read and you must never request more data than is available. You need to look at both the error code and the status block.

It's a real pain, but it works. I'm sure that there's a better way using asynchronous modes, but I had to update an existing app.

Stephen

--
Stephen Pelc, stephenXXX@mpeforth.com
MicroProcessor Engineering Ltd - More Real, Less Time
133 Hill Lane, Southampton SO15 5AF, England
tel: +44 (0)23 8063 1441, fax: +44 (0)23 8033 9691
web: http://www.mpeforth.com - free VFX Forth downloads
Reply to
Stephen Pelc

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.