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

ios disconnected after added the Service Changed characteristic

Hi Nordic gays guys,

After our 51822 firmware added the Service Changed characteristic.The Android OTA GATT_ERROR issue was solved.But there is a new problem in IOS.After updating the new firmware which added the Service Changed characteristic.When re-connecting to test APP or LightBule in IOS our 51822 board would disconnect with error message below.

image description

Do you know the reson?Can you give me some suggestion to find the problem and solve it? Does the 51822 can tell the connection phone is IOS or Android?I could enable the Service Changed characteristic in Android and disable the Service Changed characteristic in IOS if it can.Thanks!

Best Regards, Jay Yang

  • Hi.

    I am no sure what is causing this. The most likely reason is that your iphone has stored the service information about your device. When it suddenly does not match what the iphone has stored, it can cause an error. You should delete your device from the device list of your iphone, and try again.

    It could also be that lightblue does not handle the "Service Changed" Characteristic very well.

    What is the "test APP", is this your own custom app? If yes, you can use this app to see what is happening by printing error codes and events from your phone to a PC.

    Alternatively, you an use a BLE sniffer to catch the BLE transaction which leads to the disconnect.

    -Anders

  • I'm seeing this issue as well with SDK 14.2 and S140-6.0.0-6.alpha.  When NRF_SDH_BLE_SERVICE_CHANGED is set to 0 I have no issues with iOS, but if I change it to a 1 then I see some strange behavior.

    With LightBlue I see the same thing Jay mentioned above, where it disconnects immediately after connecting.  With nRF Connect it will stay connected and show the list of services, but if you click on a service it won't show any characteristics. 

    I did a sniff of the connection and found that one of the first things iOS does after connecting is enabling indications on the Service Changed characteristic (even though I haven't bonded to my device) and then at some point towards the end of GATT discovery an indication is sent from the Service Changed characteristic with a handle range of 0x000E - 0xFFFF (even though I haven't changed any services).  In the LightBlue case as soon as this indication is seen the iOS device disconnects.

    Why would the softdevice send a Service Changed indication in this case?  If the iOS device wasn't bonded there should be no record of the iOS device to know if the services had changed since it last connected.

    Android doesn't seem to ever enable indications on the Service Changed characteristic so this problem doesn't show up on Android.

  • Something else I discovered:  On my device I have the DIS service, BAS service and a custom service.  If I remove the BAS and custom service this problem does not occur.  I added back in just the BAS service and it occured again, but then I changed bas_init.support_notification from true to false and the problem went away.  Looking at the sniff the Service Change indication was never sent in this case, so it seems to be related to having other characteristics with client configuration descriptors.

  • I figured out what was causing this in my case.  I had the following code in my pm_event_handler in main.c:

        case PM_EVT_LOCAL_DB_CACHE_APPLIED:
          // The local database has likely changed, send service changed indications.
          pm_local_database_has_changed();
          break;

    This had been in my code since SDK11 - I'm not sure what example I originally pulled it from.  Removing it fixes the issue though.

Related