3

I am currently working on a project for my university course. I am design a device which will be an intermediate interface between the computer and a USB flash drive, i.e. data go from computer->my device->USB drive.

One of the functions I want on this device is to be able to detect if there is any data activity going on, and send this information to the microcontroller. I don't need to know anything about the data itself, just whether there is data being transferred.

I've done some research online about how USB works, but I can't seem to find a good way of doing this. I have spoken to a tutor at uni. Apparently this is "very easy" to do, but I don't really know how. Can anyone suggest some ideas? Thanks very much.

elfia_08
  • 33
  • 3

3 Answers3

3

In this case the simplest way is to use additional soft which can log USB protocol as well as a microcontroller, like USBlyzer (http://www.usblyzer.com/) or USB data capture (http://www.eltima.com/products/usb-capture/)

You need to insert your flash drive to device which is plugged to USB port in your computer. Then run USB data analyzer software and find the USB port. That's all! After that you can monitor and analyze all data between microcontroller and the app. Moreover, you can save and export captured data

ElenRey
  • 31
  • 4
1

Your tutor not quite right.
USB bus always have activity, even if no data transferred.

Carefully read USB specification (http://www.usb.org/developers/docs/), especially 'Protocol layer' section. Some basics you may read in 'USB in a nutshell' article.
Explore bus with oscilloscope.
Also you may use software analyzers like http://desowin.org/usbpcap/ or http://freeusbanalyzer.com/ to explore data on bus.

I think, will be enough to capture all packets on bus with external microcontroller, measure their duration and sort waste SOF packets and valuable data packets.

Sure, your microcontroller must be fast enough, to keep pace of USB 2.0 bus. Detection of activity of low-speed devices, like keyboard, will be much simplier, and may be done even with arduino.

Alexey Esaulenko
  • 499
  • 2
  • 10
0

You are trying to make a protocol analyzer like catc http://teledynelecroy.com/protocolanalyzer/protocolstandard.aspx?standardid=4 These is a device which is like man in middle for any network.

You would need your device to act as USB host(master) and USB device(slave) at same time. Also while copying data from one port to another you need to make a data copy for analysis. USB devices have critical timing requirements and operate at high data rate. So you might need good amount of processing power in your device. Also this makes such analyzers expensive.

If there is no requirement for analyzing USB protocol, you can have device that will analyze slower buses like uart,spi I2c etc.You can check hobby manufacturers like sparkfun for such tracing devices. Best luck with your endeavor

atamit81
  • 207
  • 1
  • 2
  • 7