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

Connection Loss between nRF and Iphone

Hi Nordic,

I'm using nRF51, SDK 12 and softdevice version S130 to stream data from nrf51 to iphone6 over BLE.

Sometimes, Few hours after launching streaming, the BLE communication between iphone and nrf51 is get lost.

Following the sniffing trace, the loss of connection was generated beacause nRF51 didn't respond to the connection event generated by smartphone.

nRF51 stream data using the code bellow :

memset(&params, 0, sizeof(params));
params.type = BLE_GATT_HVX_NOTIFICATION;
params.handle = p_translinks->rx_char_handles.value_handle;
params.p_data = data;
params.p_len = &length;

err_code  = sd_ble_gatts_hvx(p_translinks->conn_handle, &params);
if (err_code != NRF_SUCCESS &&
err_code != BLE_ERROR_INVALID_CONN_HANDLE &&
err_code != NRF_ERROR_INVALID_STATE &&
err_code != BLE_ERROR_NO_TX_PACKETS &&
err_code != NRF_ERROR_BUSY)
{
  APP_ERROR_CHECK(err_code);
}

When testing our work in another place this issue appears in a systematic way.

Could someone please can explain to me the cause of this issue

Best Regards,

Mehdi.

Parents Reply Children
  • Comments:

    1. The timeout seems to be 720 ms, which should be ok as it gives more than 20 missed packets before the link drops due to supervision timeout. (at a connection interval of 30ms)

    2. The accuracy used in the code is 20ppm but this needs to match the actual accuracy of the 32 KHz crystal as used by the manufacturer. The SDK code is intended to set the 32 KHz accuracy as it is on the board. If the number used in this case i.e. 20ppm is incorrect you will get link losses.

    Actions on your end:

    Get the 32 KHz crystal accuracy from your manufacturer or from the datasheets of the module

    - Change the crystal drift to a higher level perhaps 50ppm or more and verify if the stability increases

    - You can also change the 32KHz source to the internal 32KHz RC source so you are not dependent on the module vendor's 32 KHz clock source. Verify if the stability increases.

  • Hi David,

    I think you talk about this table. Right ?

      

    Best Regards

  • That seems to be it. It looks like the crystal has a +-40 ppm accuracy, so you should try to use that in your code rather than 20. As David mentions, you can also try to use even higher PPMs or the internal RC source to rule out any issues with your external crystal. 

Related