I am testing a WinCE device that loses all USB communication infrequently. I need to detect when the USB fails on this device. When it fails, the power is intact at the port, just no data at all on D+ and D- (I verified this with an oscilloscope). This host device is basically a black box to me so I can't do anything to it but check it's state.
My proposed solution: Use an arduino of some type (preferably an UNO since I have one already) programmed to detect USB activity to let me know when USB is failing on the host device I am testing.
Is this possible? The arduino seems like a good solution for me because I assume it is a USB client, which I need in this scenario. Any example or pointing me in the right direction would be of great help. Thanks!
-
1If you choose to use an Uno you probably need to reprogram the ATMega16u2 on the board, that does the usb-to-serial. I think it would be easier to have a arduino in which the main chip support USB, like the Leonardo or Micro. But I haven't done anything with USB myself.Gerben– Gerben2015年10月14日 17:59:57 +00:00Commented Oct 14, 2015 at 17:59
-
If you modify the firmware of the USB interface chip, implement software USB, or use a native-USB board like the Arduino Leonardo, it would be fairly trivial to run a time-out timer on USB traffic and thus see if the normally periodic polling of this slave ceases.Chris Stratton– Chris Stratton2015年10月16日 02:21:23 +00:00Commented Oct 16, 2015 at 2:21
-
Did you manage to figure this out? If so can you please share the code?NAMAE– NAMAE2024年05月05日 21:37:26 +00:00Commented May 5, 2024 at 21:37
1 Answer 1
If all you are interested in is the voltages on the D+ and D- lines you could wire those direct into two ADC inputs on the Arduino and wire +5V and GND into the +5V and GND pin. The Arduino can then sample the voltages and compare them to valid or invalid ranges.
-
This is a great idea. So glad I asked; I can't believe it didn't even cross my mind.Fuffer– Fuffer2015年10月15日 16:39:16 +00:00Commented Oct 15, 2015 at 16:39
-
1No, that's really not going to work well. The USB signalling is outside the bandwidth of the arduino ADC. You need to look for transitions, not levels.Chris Stratton– Chris Stratton2015年10月16日 02:19:47 +00:00Commented Oct 16, 2015 at 2:19