Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 11:04 01 Aug 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Ideas needed for an RS232 Sniffer

Author Message
OA47

Guru

Joined: 11/04/2012
Location: Australia
Posts: 986
Posted: 06:08am 12 Dec 2022
Copy link to clipboard 
Print this post

I am currently playing around with the idea of using a Pi_pico to produce an RS232 sniffer. Does anyone have any ideas how I could use the pi_pico to sample a stream and determine the baudrate/structure of the stream?

OA47
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2640
Posted: 06:48am 12 Dec 2022
Copy link to clipboard 
Print this post

You could start with Peter's LOG CSub (the recompiled version) to grab a lump of data. Then determine pulse widths to get an idea of the baud rate. Look for gaps in the stream then count bits per block to work out parity and stop bits.
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 5089
Posted: 09:16am 12 Dec 2022
Copy link to clipboard 
Print this post

Hi OA47,

Pluto has previously been using a piece of PIO code I wrote that can measure pulse width very quickly. If you use that code and in a short loop in MMBasic find the lowest pulse width in a serial stream you (= 1 bit time) you can determine the baudrate quickly.

The beauty of that PIO code is that you can assign any input pin, also a pin that is assigned to a UART RX pin. (we will handle that aspect soon in the PIO training). So you can let the PIO snoop, then determine the baudrate, then initialize the UART and start receiving data.

Regards,

Volhout
Edited 2022-12-12 19:17 by Volhout
PicomiteVGA PETSCII ROBOTS
 
OA47

Guru

Joined: 11/04/2012
Location: Australia
Posts: 986
Posted: 09:25am 12 Dec 2022
Copy link to clipboard 
Print this post

Volhout sounds good will do some investigation.

OA47
 
oh3gdo
Regular Member

Joined: 18/11/2021
Location: Finland
Posts: 47
Posted: 11:19am 12 Dec 2022
Copy link to clipboard 
Print this post

I have a separate suggestion.

First build your own RS232/TTL converter.
You need 2 NPN transistors an few resistors.



Then made a test program, which looks if you get right answer.
Look what you get from your test program.  



I have done so about 50 years

Pekka
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 5089
Posted: 12:41pm 12 Dec 2022
Copy link to clipboard 
Print this post

For a sniffer you typically have only RX (sometimes 2x RX) to spy on existing communication. You do not need TX out.

The RX circuit (the NPN transistor and 2 10k resistors) is enough.

If you sniff, you have no control over the data on the bus, and you cannot force data (like "test") on the bus. That is why you need to analyze the activity, and determine the shortests pulses, these are most likely 1 bit time long.

Volhout
Edited 2022-12-12 22:42 by Volhout
PicomiteVGA PETSCII ROBOTS
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025