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

service and characteristics not updating after switching example projects

After switching from the Blinky example to another project, the BLE services have not been cleared from the Blinky project. The newly built UART App example will load, but when connected to a BLE Phone App, it still shows the characteristics from the previously loaded App. The Advertisement shows that it is the UART app, but the tx and rx characteristics did not get setup, still set for the previous example app. Is there some call needed to clear the previous setup prior to loading the new one?

Steps: dev kit nrf52840

1. Load, build, and run the UART example project

2. connect to the Nordic Phone app and terminal PC program

3. The UART example ran fine.

4. Loaded the Blinky app and it ran fine.

5. switched back to the UART app, and started debugging

    problem:  The UART exampls started, but the characteristics remained as setup in the Blinky App.

                    The Tx and Rx characteristics for the UART did not get setup and dont show on the connected Phone App.

Is there a step needed to clear the services and characteristics prior to loaded new ones?

Thanks,

Dan

Parents
  • Its always a good practice to erase full chip before loading new firmware. May be it's in settings of your IDE.

    May be stupid question but did you close the app and reopened, because it can have cache problem on phone side too.

  • Thanks for the suggestions.  I tried the full erase and closing the phone app, but still the services and 

    characteristics did not update.

    But what finally worked was to disable BLE on the iPhone's  Settings, then re-enabled after a minute.   This cleared the problem and LightBlue and the nrf Toolbox apps worked normally.

    Thanks,

    Dan

  • Hi Dan,

    Disabling and re-enabling BLE in settings clears the attribute cache, and thefore forces the iphone to perform a new service discovery on the following connection. You can avoid caching by including the service changed characteristic in your attribute table. Set the NRF_SDH_BLE_SERVICE_CHANGED symbol in sdk_config to '1' to enable it.

    Note: for bonded devices you need to send a service changed indication to make the central perfom a new service discovery. You can find more information about attribute caching in Bluetooth core specification, vol. 3, part G, section 2.5.2.

Reply
  • Hi Dan,

    Disabling and re-enabling BLE in settings clears the attribute cache, and thefore forces the iphone to perform a new service discovery on the following connection. You can avoid caching by including the service changed characteristic in your attribute table. Set the NRF_SDH_BLE_SERVICE_CHANGED symbol in sdk_config to '1' to enable it.

    Note: for bonded devices you need to send a service changed indication to make the central perfom a new service discovery. You can find more information about attribute caching in Bluetooth core specification, vol. 3, part G, section 2.5.2.

Children
No Data
Related