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

Can't get examples to run correctly

Hi

I've tried several of the example applications on the 52840 DK board and I'm not seeing the expected services when using the iOS nRF Connect App. No matter what I run I seem to only be able to see the LED Button Service.  I have tried cycle speed and cadence and the heart rate examples, both by building and running them within Segger as well as dropping the respective pre-built hex files onto the JLINK drive. I'm using a Mac. I've also tried looking for the services using another app on my phone called BLE Scanner with the same results. 

More specifics using the cycle speed example: In the nRF Connect scanner page, I see Nordic_CSC show up. The Service UUID section lists "Cycling Speed and Cadence<1816> Battery Service<180F> Device Information<180A>". When I press the Connect button it takes me to the Services page and only one service is listed: "LED Button Service".

The very first time I used this board after receiving it I tried the heart rate example and was seeing heart rate and battery level. I then loaded the Blinky example and since then I have not been able to see anything other than the LED Button Service.

What would cause this to happen?

SDK Version: nRF_SDK_15.3.0

MaxOS: Mojave 10.14.6

nRF Connect Version: 1.8.8

Segger Embedded Studio: Release 4.18

Parents
  • Hello,

    If you can find the device under your phone settings->bluetooth, try to press the (i) on the right side, and then click "Forget Device". 

    Phones tend to store services of BLE devices in the operating system. 

    I am not quite sure, but I believe there are times that it doesn't work as well, because if you never bonded the device, there is nothing to delete in the settings.

    Phones will typically update the services after a while, but if you don't want to wait for this, you can also try changing the address of the device.

    It is done a bit different in the different SDK versions. But look for the SDK15.4.0, you can add this snippet to the end of the ble_stack_init() function in main.c.

        ble_gap_addr_t my_addr;
        err_code = sd_ble_gap_addr_get(&my_addr);
        APP_ERROR_CHECK(err_code);
        NRF_LOG_INFO("my addr %02x,%02x,%02x,%02x,%02x,%02x", my_addr.addr[5],
                                                              my_addr.addr[4],
                                                              my_addr.addr[3],
                                                              my_addr.addr[2],
                                                              my_addr.addr[1],
                                                              my_addr.addr[0]);
        my_addr.addr[0]++;
        err_code = sd_ble_gap_addr_set(&my_addr);
        APP_ERROR_CHECK(err_code);
        NRF_LOG_INFO("my addr %02x,%02x,%02x,%02x,%02x,%02x", my_addr.addr[5],
                                                              my_addr.addr[4],
                                                              my_addr.addr[3],
                                                              my_addr.addr[2],
                                                              my_addr.addr[1],
                                                              my_addr.addr[0]);

    You can remove the NRF_LOG_INFO(...) part, but it is nice to have to see that the address change works as intended.

    But first, check if the device is stored in your phone settings.

    Also note that if you change the address, then the phone may store the settings for this address, so if you change again, use another address (incremented by 2 instead of 1, for example). 

    Best regards,

    Edvin

  • Thank you very much for the support. I am unable to "forget this device" as the BLE device does not show up in the list of Bluetooth devices unless it is connected within nRF Connect, and once it is connected the "I" button does not show up. It's there for all of the other devices in the list. However, your idea of changing the address seems to work, so I am now able to make progress in my evaluation.

    Thanks again.

  • Yes. The (i) button is only for bonded devices, meaning that they have exchanged keys for future encryption, so if you haven't ran an example that does this, it will not show.

    Sometimes it helps to just turn off and on Bluetooth from the phone settings (not the slide up panel on iOS, as this doesn't turn it off properly). Sometimes (!) it deletes the cached BLE data when you do this. But the failsafe way is to change the address, since it then will appear as a new device. 

    This becomes less annoying when you work mainly on one application, and don't have to add/change services that often.

    Note that there is also a "Service changed" service which will tell the connected device that they should do a new service discovery because something has changed. Most of the simple examples don't use this, and if it wasn't present the first time, adding it later will not help, since the phone is not aware of the service telling it to check for new services, ironically. But this is useful in applications where you intend to add services during the lifetime of the product.

    Best regards,

    Edvin

Reply
  • Yes. The (i) button is only for bonded devices, meaning that they have exchanged keys for future encryption, so if you haven't ran an example that does this, it will not show.

    Sometimes it helps to just turn off and on Bluetooth from the phone settings (not the slide up panel on iOS, as this doesn't turn it off properly). Sometimes (!) it deletes the cached BLE data when you do this. But the failsafe way is to change the address, since it then will appear as a new device. 

    This becomes less annoying when you work mainly on one application, and don't have to add/change services that often.

    Note that there is also a "Service changed" service which will tell the connected device that they should do a new service discovery because something has changed. Most of the simple examples don't use this, and if it wasn't present the first time, adding it later will not help, since the phone is not aware of the service telling it to check for new services, ironically. But this is useful in applications where you intend to add services during the lifetime of the product.

    Best regards,

    Edvin

Children
No Data
Related