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!

  • 1
    If 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
    Oct 14 '15 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. Oct 16 '15 at 2:21

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
    Oct 15 '15 at 16:39
  • No, 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. Oct 16 '15 at 2:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.