Buffer Overruns and Data Loss

Top  Previous  Next

The on_bt_overrun event is generated when an RX buffer overrun occurs. It means that the data has been arriving faster than your app was handling it and that some data got lost. This code snippet starts blinking the red LED when an overrun happens:


Tibbo BASIC:

sub on_bt_overrun()


end sub


TX buffers overruns are not possible. This is not to be confused with data truncation, which is something that happens when you attempt to write more data than what the TX buffer could accommodate at the moment.

Even if you manage writing data to the TX buffer correctly, your data may still get lost on the way to the central device. Theoretically, as long as the BLE connection is stable, no TX data should ever be lost. In reality, some data may slip through the cracks, especially when the connection is unstable. In this regard, BLE connections do not have the reliability of flow-controlled serial links or TCP connections.