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

IOS devices suddenly can no longer connect or discover services

We have a custom BLE service with several Gatt characteristics using the nrf52832 SDK 15. On occasion a device is no longer able to connect to IOS devices. This occurs after several successful connections. It seems to be more frequent with iPhone x and iPhone 11.

When scanning via nrfConnect the device is discoverable, but not connectable, and the BLE services are not found (see attached image below). The same device is connectable with an an Android device.

We are handling both BLE_GATTS_EVT_EXCHANGE_MTU_REQUEST and BLE_GAP_EVT_PHY_UPDATE_REQUEST in the event handler. In previous similar cases this seemed to be the issue. We are also running fstorage concurrently, however no flash memory saves are performed while the BLE radio is active. Initialization of the fstorage instance is completed before the BLE service is initialized.

I have also seen that IOS caching has been an issue in the past, however our device is not stored in the bluetooth device list (i.e. the device cannot be 'forgotten').

  • Hi, 

    Could you take a screenshot on nRF Connect when scanning for the device that "discoverable but not connectable". What happened when you try to connect ? Could you show the advertising packet detail ? 
    Please try capture a sniffer trace as well. 

  • I have attached an image of the advertising scans as well as a successfully connected device. I have tried a few different advertising intervals without any noticeable change in the behavior.

    •  What happened when you try to connect ?

    Connection is not available, as you can see the 'Connect' button is grayed out and disabled on nrfConnect. We can't connect via our app either.

    Previously we were getting more of these issues when we didn't leave a delay between initializing the fstorage instance and the BLE service. I now have a 500 ms delay between the two which has reduced the frequency of these issues. However adding a delay is not ideal for our application as we need some events the occur right after the device awakes from sleep mode.

    I will try and capture a sniffer trace, the issue is sporadic and occurs with some of our beta users so it may take  little while before I am able to capture this data.

  • From what I can see your device is advertising as non-connectable. 
    Is there anything in the code that may set the advertising flag to this mode ? 
    Do you see the same issue with a SDK example ? 

    Please try to capture a sniffer trace. Also try to use an Android phone to scan&connect, just to cross check. 

  • We limit the device to only one peripheral connection. That is the only thing that I can think of that would cause the device to be set to non-connectable.

    No we haven't seen any issues with SDK examples, but we haven't tested those in a large deployment. As mentioned earlier this seems to be happening specifically with Iphones X and 11. We have also test on Iphones 8, 6 without issue.

    We did scan and connect with an Android phone. The Android phone was able to connect without issue when he had an unconnectable device with an iPhone.

    I will follow up once with have a sniffer trace.

  • One idea I have looked at is the the handler for BLE_GATTS_EVT_EXCHANGE_MTU_REQUEST

    In gatt_init  we run the following:

     err_code = nrf_ble_gatt_att_mtu_periph_set(&m_gatt, NRF_SDH_BLE_GATT_MAX_MTU_SIZE);

    However, the handler returns the following:

    err_code=sd_ble_gatts_exchange_mtu_reply(p_ble_evt->evt.gatts_evt.conn_handle,23);

    Could the mis-matched mtu sizes be causing an issue? I have tried setting handler setting to NRF_SDH_BLE_GATT_MAX_MTU_SIZE as well. So far we haven't had any issues, but we will need to test for at least a few more days to confirm.

Related