[Piotr] was working on a recent Arduino project when he ran into a problem. He was having trouble getting his Arduino Pro Mini to communicate with an ESP8266 module. He needed a way to snoop on the back and forth serial communications. Since he didn’t have a specialized tool for this task, [Piotr] ended up building his own.
The setup is pretty simple. You start with a standard serial cable containing the TX, RX, DTR, and GND wires. This cable connects the Arduino to the ESP8266 WiFi module. The TX and RX lines are then tapped into. Each wire is routed to the RX pin of two different serial to USB adapters. This way, the data being sent from the Arduino shows up on one COM port and the data being transmitted from the module shows up on the other.
The next piece of the puzzle was coming up with a way to see the data more clearly. [Piotr] could have opened two serial terminals simultaneously, but this wasn’t ideal because it would be difficult to compare the timing of the data. Instead, [Piotr] spent less than an hour writing his own simple serial terminal. This one connects to two COM ports at the same time and prints the data on the same screen. The data from each COM port is displayed in a separate color to make it easy to differentiate. The schematic and source code to this project can be found on [Piotr’s] website.
This is a great idea for troubleshooting simple communications and half duplex or command/reply message, but the twin USB host nature of the design will not preserve accurate character timing between the two USB ports at high speeds with full duplex communications. If this matters to a particular application, it will make debugging difficult.
yup, I’d like a dual serial sniffer that does preserve exact timing.
the hp (etc) proto analysers put timestamps on all data streams, iirc. been a long time since I last used one but they were neat little (big) machines.
I believe that this tool preserves exact timing and you can connect to several COM ports
https://www.eltima.com/arduino-serial-monitor-alternative/
Nice. I ended up using xbees to do something similar, but can’t remember the specifics. I spent some time searching for a terminal like this though.
Realterm does this
If I remember correctly, you have to buy the drivers to do the COM port spying.
True (unless you’re running win7 64 bit :( ), but you can also listen to two serial ports at once using the echo port tab
So does HHD Software’s “Free Device Monitoring Studio”, and no need to pay for drivers a la Realterm.
Docklight is great for this too. It even has the cable schema in its help guide…
OP is lucky. It gets very hard to correlate the timing info over 2 USB devices if there is a very high rate of traffic and volume between the two. Serial data only get buffered and transferred either when the FIFO is full or a time out happens on the USB to serial chip. (The timeout could be in the order of 1ms.) One way to handle it for such tricky cases might actually go back to motherboards that still have dual serial ports or a UC with USB and multiple serial ports.
FT2232 is a dual port version of the FT232, maybe it’s smart enough to order the packets correctly.
I use my $15 Saleae clone for such stuff, but this hack is nice and even less expensive, plus you get more readable output than with logic analyzer.
Is there a saleae clone available? $15 is cheap. Where can I find it?
if you only need 24MHz 8 pins, its actually only $7. but 24 is cutting too close to spy on USB1.0. Just search for logic analyser on aliexpress. black box with white label are compatible with the saleae software
Please don’t support the ripoff artists who are doing their best to put a small company out of business.
To be fair, if this thread can be believed, it’s not really saleae’s design: http://www.reddit.com/r/electronics/comments/234rmh/logic_pirate_8_channel_256k_sample_60msps_logic/cgtqiy3
The hardware’s pretty straightforward, yes. The software’s rather a lot more involved, though, and the clones make use of that.
What if I said I don’t use their software, but sigrok/PulseView ;)
I’d say you still shouldn’t buy them, because they’re committing trademark infringement by claiming to be from Saleae.
I’ll grant they likely arrive with the mal-branding, but you wouldn’t know before purchasing as most of the listings do not advertise it – I got mine assuming it was just some generic
Let me pay for great software then, not for hardware.
Either design something super nice and dificult to copy or sell great service.
because of service I would like to pay IDA pro and Winrar, because those are great and when I earn money from work, ill go legal for that. As a student, nope… books are expensive and teachers arent giving legal software aswell (hoped to get vxworks legaly, got a hack version.)
So, those Right to Copy chinese people do what they want, ill buy their crap and use it. If i realy like the tools, I might consider buying or supporting the real guys.
I dunno, should I crab popcorn?
Since it looks like OP is using Windows, com0com (http://com0com.sourceforge.net/) is good for MITMing serial connections. It’s super helpful for debugging/reverse engineering serial stuff.
Perfect! I need to snoop on a USB serial adapter to reverse engineer a fan controller’s software protocol so I can use it under Linux (Windows software only,) and I was struggling to find a way to do that.
SysInternals has had a package out for years just for this; PortMon https://technet.microsoft.com/en-us/library/bb896644.aspx
I did something similar to get access to various routers and a Definity PBX. Setup serial snoop fire up two terminals call support and wait for them to login. Its annoying owning the equipment and having someone say nope you can’t do that with it.
priceless!
I’ve tried to do something similar before, but I don’t understand why you can’t just OR the Rx and Tx signals with diodes. When I tried, I got Rx but not Tx on the terminal. I ended up using a logic analyzer, but realtime monitoring would have been a hell of a lot easier. I tried some MITM software, but I couldn’t get it to work for some reason and just gave up.
Was thinking the same thing, there would be a way to do it with diodes I’m sure.
Yes, to some extent you can do that with diodes. But then, you will not see which data is from which direction. You will also have a problem when two channels will be active at the same time.
I think you can do the terminal linking with programs like Termite as well. http://www.compuphase.com/software_termite.htm#FORWARDDATA I use termite almost daily, it lacks a few ‘standard’ features like special command key sequences and only supports basic data, which is all I ever use it for!
same principle applied for ethernet: http://ossmann.blogspot.de/2011/02/throwing-star-lan-tap.html
I needed the same thing, but portable. Ended up making this:
http://www.electrobob.com/ser-show/
I did this exact same thing – a serial cable with 4 ends – back in 2007 for reverse engineering the selector unit on a “multi electrode array neural stimulator” (MEA) and wrote a piece of linux code that mimicked the windows software.
I know that I’m just speculating here, but why not use an arduino mega r3 style board and hook up the two tx lines to be read to the microcontroller, and then just spit the resultant data out the ‘main’ serial port on the mega r3. The mega r3 should have enough processing power and I/o where you could add timestamps (from an attached RTC) or add prefix-headers to each line stating where it was coming from and going to…
Agree with most of the comment except with RTC. Use the hardware 16-bit timer for time stamping as RTC doesn’t have the resolution.
Hmmm Serialmon is free and do the job nicely. I never had a problem with it.