We observed a weird, seemingly erroneous behaviour of the Softdevice when using the timeslot API. This concerns a product that we developed using Softdevice v4.0.5. The product implements a BLE peripheral which is also acting as an Enhanced ShockBurst PRX in the timeslots granted by the softdevice.
Summary of observed behaviour from the outside
About one in ten times when trying to connect the peripheral, the central is unable to connect while the peripheral still thinks it is connected. On the peripheral side, no connection events occur, but a connection timeout only happens after around two minutes.
Behaviour from central perspective
From the central perspective, the connection establishment fails somewhere. After this fails, the peripheral is not visible (i.e. not advertising at all) anymore.
Detailed behaviour of peripheral
I explain the steps that the peripheral goes through as logged through Segger RTT:
1. The softdevice dispatches BLE_GAP_EVT_CONNECTED.
2. The firmware tries to restart advertising as non-connectable. The call to sd_ble_gap_adv_start succeeds.
3. After 5 seconds we try to renegotiate connection parameters. Again, the call to sd_ble_gap_conn_param_update succeeds.
4. Within another 3 seconds, no response to the connection parameter update request was received.
5. After another second we retry negotiation. This time the call to sd_ble_gap_conn_param_update fails with NRF_ERROR_BUSY, probably because the Softdevice thinks it is still negotiating.
6. 20 seconds after BLE_GAP_EVT_CONNECTED, the peripheral successfully calls sd_ble_gap_disconnect.
7. Only after a long time, usually around 2 minutes after BLE_GAP_EVT_CONNECTED was signalled, will BLE_GAP_EVT_DISCONNECTED be signalled. The given disconnection reason is BLE_HCI_CONNECTION_TIMEOUT.
Protocol Analyzer
The BLE protocol analyzer showed that the connection was successfully established and the central tried to read out the primary service, but no response was received. After that, no communication occurs until after around two minutes. At that point BLE_GAP_EVT_DISCONNECTED occurs and the devices advertisings are visible again. (see screencap below)

Timeslot usage
As mentioned before, the peripheral uses the timeslot api to communicate using Enhanced ShockBurst. For the record, no ESB communication occurs during these tests.
Logic Analyzer traces
To see what happens, I looked at it with a logic analyzer. I traced the following events using GPIOS (from top down, as shown in the screenshots):
- "in timeslot" is high while a timeslot is active
- "BLE connected" is set high upen BLE_GAP_EVT_CONNECTED and to low upen BLE_GAP_EVT_DISCONNECTED
- "sd_signal_handler" is set high when entering the signal handler supplied to sd_radio_session_open and set low before exiting it.
- "START" is NRF_RADIO_CALLBACK_SIGNAL_TYPE_START
- "RADIO" is NRF_RADIO_CALLBACK_SIGNAL_TYPE_RADIO
- "TIMER0" is NRF_RADIO_CALLBACK_SIGNAL_TYPE_TIMER0
- "EXTEND_SUC..." is NRF_RADIO_CALLBACK_SIGNAL_TYPE_EXTEND_SUCCEEDED
- "EXTEND_FAIL..." is NRF_RADIO_CALLBACK_SIGNAL_TYPE_EXTEND_FAILED
The following trace shows a session where I cyclically connected and disconnected the peripheral. At some point at around 45s the described behaviour occurs. As you can see, the timeslot stretches on, uninterrupted for almost 25s. Usually this is even around 2 Minutes (which would about correspond to NRF_RADIO_DISTANCE_MAX_US).
The next screencap shows the "regular" and "correct" behaviour upon connection establishment in more detail:
The next screencap shows the erroneous behaviour:

As you can see, the softdevice seems to be unfazed by the newly established connection and starts to happily grant an "infinitely long" timeslot to my application when this weird behaviour occurs. On the other hand, when the connection can be successfully established, it understandably only grants very short timeslots while the connection interval is still low.
No softdevice assertion occurs at any time.
Do you have an explanation for this behaviour?