![]() |
Forum Index : Microcontroller and PC projects : Ideas needed for an RS232 Sniffer
Author | Message | ||||
OA47 Guru ![]() Joined: 11/04/2012 Location: AustraliaPosts: 986 |
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: AustraliaPosts: 2640 |
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: NetherlandsPosts: 5089 |
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: AustraliaPosts: 986 |
Volhout sounds good will do some investigation. OA47 |
||||
oh3gdo Regular Member ![]() Joined: 18/11/2021 Location: FinlandPosts: 47 |
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: NetherlandsPosts: 5089 |
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 |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |