1

I´m a really noob with the Raspberry so I think i ask here what i want to try.

I want use the Raspberry pi as a async serial sniffer. It should act as a man-in -the-middle which safe all received data on a file and send the data to the PC over the USB port. Is that possible and how?

sniffi
  • 49
  • 1
  • 8

1 Answers1

1

Probably. It depends on the serial data baud rate. I'd say yes for 19.2 kbps or slower with increasing errors for higher baud rates.

This has an answer using my pigpio library to bit bang serial data.

If all you want to do is sniff data it is quite simple. From the command line you could experiment with the pigs command (requires the pigpio daemon to be running, sudo pigpiod).

Assuming you are sniffing GPIO 23.

pigs slro 23 9600 9 # see http://abyz.me.uk/rpi/pigpio/pigs.html#SLRO

will start sniffing GPIO 23 at 9600 baud for 9 bit serial data and hold the sniffed data in an internal buffer.

pigs slr 23 1000 # see http://abyz.me.uk/rpi/pigpio/pigs.html#SLR

will read up to a 1000 bytes from the internal buffer and show it as bytes. The first number will be the number of bytes read.

Note, for 9 bit words there will be two bytes per word.

You can use C or Python to issue the same commands.

joan
  • 71,852
  • 5
  • 76
  • 108