Answer the question
In order to leave comments, you need to log in
Is it possible to lose data via UART?
I will describe the situation in more detail.
There is a PC that connects to the Arduino Uno via USB (UART). There is a need to make communication between them in the form of packets (analogous to communication via TCP).
Suppose there is a packet structure: a header of 2 bytes (1 - data size, 1 - opcode), then the data size is in the header.
Serial connection with 9600 8N1 (8E1) configuration.
USB 1 meter)
If packet reading is not controlled with start and end markers, or with hashsums, can data loss or corruption occur, causing the data stream to be read out of sync?
Answer the question
In order to leave comments, you need to log in
A much more different situation can happen: you start processing the packet not from the beginning, but from the middle and get garbage instead of normal data.
Loss of data during transmission over serial protocols is possible. If you need to overcome this situation, then turn your attention to the Kermit protocol .
In the 90s, we connected a PC to a UNIX server via RS-232, and using the Kermit software package of the same name, we not only worked in the terminal, but also transferred various files (including binary ones) between systems connected by a three-wire line.
Study the sources (you will learn a lot of useful things for yourself), simplify them to the level of use in Arduino (or take them as an idea), and you will succeed.
The data is transferred via the USB protocol. In the case of a virtual COM port, the protocol implies resending the packet if the packet is received with an error.
But they can be lost on the Arduino side if the received data processor does not have time to process them during the time between packets. This problem can be easily solved if the computer, after sending the packet, waits for a response from the Arduino that the packet has been received and processed.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question