R
R
RokkerRuslan2014-07-09 07:50:31
linux
RokkerRuslan, 2014-07-09 07:50:31

How to transfer information through the com port correctly?

I transfer data to the port with the command
sudo cat data > /dev/ttyUSB0
I accept
cat /dev/ttyUSB0 > temp
This, the ones that come are completely different, firstly, a lot of extra line breaks that are not in data, and secondly, the data is duplicated (sometimes), the duplicates overlap. Okay if you transfer text information, but if binary data? For example link the computer with the uart of the microcontroller?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jcmvbkbc, 2014-07-09
@jcmvbkbc

In addition to the port settings mentioned by @pi314 (which, most likely, have nothing to do with it: with an incorrect baud rate, nothing meaningful can usually be obtained) there are 100,500 more terminal parameters available for change via stty. Among them are, for example, local echo or insertion of additional CR before LF. When exchanging binary data, the terminal should be switched to raw mode (stty -F <device> raw).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question