-
Notifications
You must be signed in to change notification settings - Fork 1
Description
On the UART serial connection, if a transmitter sends a large number of messages and the receiver is unable to consume them quickly enough, it may be possible to fill the receiving buffer of the serial port, causing the connection to drop bytes and leading to data corruption.
One solution is to use a hardware handshake; each side of the UART has a pair of GPIO pins (RTS/CTS and DTR/DSR) that signal when the other side has enough space to receive data. This solution requires the GPIO pins to be connected.
Another solution is to implement a software handshake where each RPC client sends a notification to the other side to acknowledge the number of messages successfully processed. Each client should then compare the number of sent messages with the number of acknowledged messages: if the difference exceeds a fixed threshold, the client should pause sending messages until the difference drops below the threshold again.
This solution also implies the presence of a "reset message" to restart the counting from 0.