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?

  • Thank you the library is a good Note but what i want to do with the raspberry pi exactly is: that he catch the data bit´s e.g. ...1111001000000111... and make a hex Code out of them e.g. 04 additionally should he add a timestemp in microseconds on every Databyte.Now the Raspberry should send the Bytes over the USB-Port to the PC in realtime and it should be possible to send Bytes from the PC over the raspberry to the slaves. – sniffi Apr 28 '16 at 5:42
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.