I'm reading data from /dev/ttyACM0 using cat /dev/ttyACM0 on a Raspberry Pi. The data comes from a device, which sends lines in the form

15.00   1316013 15

where the first number is a value, the second a millisecond timestamp from the device.

When I do cat /dev/ttyACM0 > file.csv I receive one value every 12~13ms, but when I do the exact same thing over the network, I get a 1~2 second gap every 5 seconds.

Is it possible that there is lost data somewhere? Or that the OS blocks the serial device so it has to wait a couple of seconds to send more data? Is there any relation between a serial device and a piped network command?

I'm using either netcat or ssh to pipe the data. The device is sending data at 9600 bps


Turns out cat /dev/ttyACM0 | awk is not exactly the same as </dev/ttyACM awk

And awk does buffering too, as cpugeniusmv commented.

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.