This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nRF52840 device ERROR 12290 when device out of range

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?

Parents
  • Hi Kostoulas, 

    ERROR 12290 is 0x3002 in hex, which corresponds to BLE_ERROR_INVALID_CONN_HANDLE. It seems that you got into the function that tries to send the data before the disconnect happened and invalidated the connection handle with a faster sample rate, while with a slow sample rate you have not yet seen the issue as it is less likely to happen. 

    You should anyway handle the error in a better way than passing it to the error handler, i.e.,

    if(err_code != BLE_ERROR_INVALID_CONN_HANDLE)
    {
      APP_ERROR_CHECK(err_code);
    }

    -Amanda H.

Reply
  • Hi Kostoulas, 

    ERROR 12290 is 0x3002 in hex, which corresponds to BLE_ERROR_INVALID_CONN_HANDLE. It seems that you got into the function that tries to send the data before the disconnect happened and invalidated the connection handle with a faster sample rate, while with a slow sample rate you have not yet seen the issue as it is less likely to happen. 

    You should anyway handle the error in a better way than passing it to the error handler, i.e.,

    if(err_code != BLE_ERROR_INVALID_CONN_HANDLE)
    {
      APP_ERROR_CHECK(err_code);
    }

    -Amanda H.

Children
  • Hi Amanda,

    I will try your suggestion. By the way, in case someone finds it helpful I found an other "solution" with this issue.

    Before I transmit a new packet I read the rssi value and if it is for example < -95 dBm I don't  transmit to the central.

    So, no data are sent when the connection signal strength is very weak (and probably about to be lost). I know that this solution is not the best because it limits the range of transmission but it works for now.

    Thank you for your time

Related