Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8121

SDK • Re: Receiving data from Pico on Linux

$
0
0
Is a newline always required? Is the Linux machine defaulting to certain settings?
When a terminal device (/dev/tty*) is in canonical input processing mode, the kernel waits for newline (or end-of-file) before it passes input to the local process. It also allows the remote user to correct typos in various basic ways, again before the application sees the input.

Although this is called "canonical" mode and is the default, it is wholly inappropriate if the line is connected to anything other than a human typist, and it should be disabled. Most software that is intended for use with serial communications will do this automatically. If you wanted to use generic utilities like cat you would first do something like:

Code:

stty -icanon -echo -isig -opost -hupcl -F /dev/ttyACM0
Once out of canonical mode, the minimum amount of kernel buffering is instead controlled by the min and time parameters. You still need some kind of convention for detecting when a message is complete, because there is no guarantee that a printf() on the Pico will correspond to a single read() on the Pi.

Statistics: Posted by jojopi — Wed Oct 23, 2024 12:06 am



Viewing all articles
Browse latest Browse all 8121

Trending Articles