Handling Buffer Overruns
Handling RX buffer overruns
The on_ser_overrun event is generated when an RX buffer overrun has occurred. It means the data has been arriving to the UART faster than you were handling it and that some data got lost.
This event is generated just once, no matter how much data is lost. A new event will be generated only after exiting the handler for the previous one. In the UART/full-duplex mode (see UART Mode for details) you can typically prevent this from happening by using the flow control (ser.flowcontrol).
Typically, the user of your system wants to know when an overrun has occurred. For example, you could blink a red LED when this happens.
** Tibbo Basic **
sub on_ser_overrun pat.play("R-R-R-R") end sub
Are TX buffer overruns possible?
TX buffer overruns are not possible. The serial port won't let you overload its TX buffer. If you try to add more data to the TX buffer than the free space in the buffer allows to store then the data you are adding will be truncated.
See Sending Data for explanation on how to TX data correctly.