Hi,
for my system implementation with nRF52840, I use the Nordic Uart Service based on the nrf_ble_uart example.
I transfer sensor data every 10msec, or so, to BLE uart app of my smartphone and I want to reconnect
to the peripheral (nRF52840) after the connection is cut due to range or obstacles
I noticed a communication issue during BLE disconnection in two different cases.
1. When I disconnect my central device(smartphone) from the peripheral(nRF) through BLE uart app, the connection is terminated without errors and when I try to reconnect to the peripheral (nRF52840) again the connection is established without issues too. So far so good.
2. When the connection is lost due to range or the existence of obstacles between the two peers I cannot reconnect when the device is in range again.
The debugger enters the app_error_fault_handler and produces the following error
<error> app: ERROR 12290 [Unknown error code]
and that error occurs inside the transfer data function I use to transmit sensor data to the central (smartphone)
void BLE_transfer_data( ble_nus_t * ble_instance, uint8_t * dataPack, uint16_t * len, uint16_t comm_handler) { //if(BLE_connected == false) { do{ err_code = ble_nus_data_send(ble_instance, dataPack, len, comm_handler); if ((err_code != NRF_ERROR_INVALID_STATE) && (err_code != NRF_ERROR_RESOURCES) && (err_code != NRF_ERROR_NOT_FOUND)) { APP_ERROR_CHECK(err_code); //length-=1; } }while(err_code == NRF_ERROR_RESOURCES); //} }
I also noticed that, when I transmit sensor data continuously but with much lower frequency (1Hz)
the error does not occur and I can reconnect to the peripheral without problem.
When I increase the frequency again the same error occurs.
Any ideas why this happens?