Hi e2e, just sharing my findings.
I had a thorough code review of the BLE bridge reference code, while diagnosing a failure involving random supervisor timeouts, intermittent disconnects, and unexpected serial numbers during connection events. It turns out, my problems were a symptom of a lack of synchronization between the circular buffer producer and consumer in the BLE Bridge reference software.
The following line registers the packet parser as a callback, invoked by the osal to poll the UART buffers.
NPI_InitTransport(cSerialPacketParser);
The packet parser both consumes from the 128 byte UART ring buffer, and populates the 500 byte software 'circular buffer'.
When the time comes to check the circular buffer for data to send ( SBP_SEND_EVT_PERIOD ), the BLE_Bridge_ProcessEvent function has no synchronization for circular_add and circular_diff. The heads and tails of the 500 byte buffer can be changed at any time. This is a legit race condition that was causing my system to fail.
To fix this, I pass a null pointer to NPI_InitTransport, to eliminate the asynchronous nature of the problem. I do not want this parsing happening outside of my 'scheduled' operation. I also eliminated the 500 byte circular buffer, along with the very strange circular_add() and circular_diff() functions. I've increased the UART ring buffer from 128 bytes to 500 bytes and eliminated an unpredictable layer of indirection.
I hope this can help someone else. Cheers