Can you tap USB comm

Go To Last Post
10 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

Just wondering if you can tap USB serial comm in a manner comparable to tapping RS232.  While there were sniffer programs, I used to open a couple of terminal windows on a separate PC and feed one from the TX and one from the RX.  I've used sniffers, and they're better because they present the data in alternating lines on the same window -- but I didn't have one(!)

 

Anyway, just wondering if its reasonably possible to do the same thing for USB serial.

 

Thanks,

 

hj

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

USB is a bit more complex as there's a few layers of protocol. You can get hardware based analysers, these tend to be expensive. There may be plug-ins for the cheaper logic analysers - especially low speed usb comms. 

 

Wireshark has USB support and there may be filters for USB->serial traffic to make your job easier.

 

In short, it probably won't be as simple as sniffing RS232.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

yes you can.

 

we have a tool at work called "ellisys usb analyzer"  if you google that you will get a lot of info. Our Fw guys are using it a lot to see what exactly happens when things go wrong.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

Back in the past (actually getting on for 20 years ago now!) when we were developing some USB stuff we just went to one of the main test hire equipment companies and hire a USB protocol analyzer. I think such devices are still available to hire.

 

EDIT: actually, when I now type "USB protocol analyzer" into Google there's a raft of cheap/free systems to do that so I maybe you no longer need a $5,000 box to achieve this (things have clearly changed a bit in 20 years!).

 

When I follow some of those links I hit things like:

 

http://www.lineeye.com/html/p_LE-650H2.html

 

The diagram there seems to show exactly the kind of thing you are likely to want to do:

 

 

(it does cost a grand though!)

 

Last Edited: Mon. Apr 1, 2019 - 08:47 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:
There may be plug-ins for the cheaper logic analysers - especially low speed usb comms.
sigrok has several for low-level USB.

Protocol decoders - sigrok

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ford2go wrote:
While there were sniffer programs, ...
GitHub - djpnewton/busdog: busdog is a filter driver for MS Windows (XP and above) to sniff USB traffic.

An assumption is WinUSB.sys has acceptable data.

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I've successfully captured a bit of low-speed (1.5Mbit/s) USB connunication with Sigrok and the EUR 5 "saleae" clones (CY7C68013A).

For Full-speed (12Mbit/s) you'll need better hardware then I have.

It was quite fun to see the effect of T-states, bit stuffing, checksums and a whole lot of other things moving over the wires. USB is a quite complicated protocol.

I saw all that in "Pulseview", which is the GUI for sigrok. Sigrok also has a cli, and I think it's possible to only filter out the data that goes to the endpoints, and redirect that to the monitor or a file.

 

I'm not sure where your interests are at the moment.

Do you want / need to debug the low level stuff, or do you only want to capture USB data?

 

I'm not sure, but there may be plugins for Wireshark to split the data on the OS level and make a copy.

Simple searches for USB sniffer / monitor / analyser also give plenty results for a few days of reading. 

https://duckduckgo.com/html?q="usb+sniffer"

https://duckduckgo.com/html?q="USB+monitor"

https://duckduckgo.com/html?q="usb+analyser"

 

Also:

When you're only interested in capturing data from a USB <--> Serial connection, then you can also simply tap the data on the serial side.

Just add another 2 USB <--> Serial converters (for RxD and TxD) and put them in 2 USB ports of your 2nd PC, or plug it all in a hub or whatever.

Doing magic with a USD 7 Logic Analyser: https://www.avrfreaks.net/comment/2421756#comment-2421756

Bunch of old projects with AVR's: http://www.hoevendesign.com

Last Edited: Mon. Apr 1, 2019 - 11:41 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

OK, but how about this -- I just want serial data.

 

Could I take 4 USB to serial cables?

 - Cables  1 and 2 connect together betrween my USB devices

- Cable 3 connects its RS 232 Rx to Cable 1's RS-232 TX

- Cable 4  connects its RS232 RX to Cable 2's RS-232 TX

 

Cables 3 and 4 USB ports  are opened in terminal windows on a PC

 

Not elegant, but I think that it might work. Sorry if I misled anyone into thinking that I was looking for something more.

 

hj

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That should work!

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
stack gold/silver https://www.onegold.com/join/713...

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You can stick all of your RS232 dongles into the same USB hub and it should still work.

 

Also:

Some time ago I experimented a bit with the STM32F103C8T6 aka "Blue Pill".

I has hardware USB and 3 UsART's and I found a demo program on github to use all 3 UsART's through the single USB port.

 

Compiled & Flashed the program, and sure enough. 2 serial ports turned up on my Linux box.

Then I connected 2 terminal emulator programs to 2 of the serial ports, and data was echoed from one terminal to the other.

 

 

As said before, USB is a bit complicated, but using multiple USB to Serial dongles on a PC should work just fine.

Your PC may need a way to keep those devices separated from each other, and needs to be able to identify them properly.

Usually this is done with an EEprom next to the USB <=> Serial chip which has vendor and product ID's. but the price of an EEprom is often too much for the cheap devices.

This may lead to some problems such as your PC not recognizing the hardware properly.

I seem to recall that this is (was?) especially a problem on Windoze, but I have not used that OS for years.

 

 

 

Doing magic with a USD 7 Logic Analyser: https://www.avrfreaks.net/comment/2421756#comment-2421756

Bunch of old projects with AVR's: http://www.hoevendesign.com