Hello
I'm currently running ble_app_uart__saadc_timer_driven__scan_mode and would like to modify it for faster sampling rate. However, NRF_ERROR_RESOURCE presents an obstacle for the BLE tranmission as higher sampling rate would produce too many packet and overload the buffer. Reading through the forum posts on similar subject, I came upon the solution of expanding the tx queue's size and having the program wait for BLE_GATTS_EVT_HVN_TX_COMPLETE before continuing sending.
For my approach, I add a case in on_ble_evt() to handle the BLE_GATTS_EVT_HVN_TX_COMPLETE event, setting the global flag queueIsFull=0. In saadc_callback(), after ble_nus_string_send is called, I try to implement the waiting procedure in the following manner:
if (err_code == NRF_ERROR_RESOURCES){
queueIsFull=1;
}
while(queueIsFull==1){
nrf_delay_ms(5);
}
The program is stuck in a while loop. From what I can tell, on_ble_evt() can not be triggered inside the while loop. Is there a better implementation for waiting on BLE_GATTS_EVT_HVN_TX_COMPLETE?