Configuration: 52840 / S140 / V610, SDK 15.2
As approaching production, I am continuously testing S140 on various environments.
I noticed during testing that there are few chances that BLE_GATTS_EVT_HVN_TX_COMPLETE not fire. I do not have hard evidence on it but seems to be a reasonable deduction.
A simplified test setup can be a bi-directional communication between 2 52840, one as central and one as peripheral. Peripheral keeps sending notifications to central using
sd_ble_gatts_hvx(), and the central send packet back to peripheral using
sd_ble_gattc_write().
So at the peripheral end, just as the regular procedure, sd_ble_gatts_hvx() is called and the next packet will be sent after BLE_GATTS_EVT_HVN_TX_COMPLETE event is raised. Following code snippet briefly shows this process:
{
...
case BLE_GATTS_EVT_HVN_TX_COMPLETE:
....
send_next_packet();
break;
....
}
uint32_t send_next_packet () {
...
err_code = sd_ble_gatts_hvx(....);
if (err_code == NRF_SUCCESS) {
....
}
else {
LEDS_ON(BSP_LED_3_MASK);
....
}
}
And I can observed that in some cases this chain of notification sending stalled there. It is not an error returned by sd_ble_gatts_hvx() as I can not see any sign indicated by the error handling block. The physical link is also still remain connected as I can still receive packet from the central in reversed direction. so I can only conclude that BLE_GATTS_EVT_HVN_TX_COMPLETE event did not fire as expected. The chance is rare, (like in a 10-minutes testing run there maybe 1 time of this problem happening), but it did happen.
So is there any suggestion from Nordic engineer team that why this issue can happen, and how should I handle this situation?
Thank you in advance.