This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Hung up on advertising

I'm migrating an old (but working) app from the S110 5.2.1 (SDK 4.X) to the latest SDK9/S110 8.0. I've read the migration doc, and I'm following the examples carefully (specifically app_hids_keyboard, app_uart, and app_hrs). All my init functions are happy: timer, scheduler (with the new APPSH stuff), softdevice (using SOFTDEVICE_HANDLER_APPSH_INIT), everything comes up nicely. Scheduler works.

Then, I call ble_advertising_start(), I get a single BLE_ADV_EVT_FAST, then never another event of any kind. My phone can't see it advertising like it used to, and I never get any errors or anything--just quiet.

The major difference I noticed with my old code is that is has the sec_params_init() and responds to BLE_GAP_EVT_SEC_INFO_REQUEST, while most of the demos respond to that with a BLE_GAP_SEC_STATUS_PAIRING_NOT_SUPP. I never get that event in any case. I noticed that the device manager seems to make those similar security settings, but when I add it into the mix, I don't even get the first advertising event I was getting.

I'm really at a loss what to look for to debug this: If I get errors, I can see them; if I get events, I can see them. But I'm getting nothing.

  • You don't have the option of infinite advertising anymore. There is an interval for advertising and after that you receive a BLE_ADV_FAST or SLOW and advertising stops. In initializing the advertising, you can enable to have fast or slow or both of the advertisings. If you have both, after passing the fast advertising interval, the device switches to slow advertising and at the end of slow advertising stops advertising. I think the maximum interval for slow advertising should be around 4 hours and for the fast one, few minutes. If you want to advertise infinitely, you should start advertising again when you receive the BLE_ADV_FAST or SLOW events.

  • Are you seeing any advertising at all?

  • SDK 9.0 has this release note for a bugfix: "Advertising module can be set to infinite time-out." Additionally, they added the option to use low duty-cycle directed advertisement. The underlying BLE stack has always supported infinite advertising.

  • I was not using any 0 timeouts as far as I could tell. Another difference I noticed is that my code, along with most of the examples, used ble_advertising_start(), while my older working code used sd_ble_gap_adv_start(). So I switched. I'm now using:

    ble_gap_adv_params_t adv_params = {
        .type = BLE_GAP_ADV_TYPE_ADV_IND,
        .p_peer_addr = NULL,
        .fp = BLE_GAP_ADV_FP_ANY,
        .interval = APP_ADV_INTERVAL,           // 64
        .timeout = APP_ADV_TIMEOUT_IN_SECONDS   // 180
    };
    uint32_t err_code = sd_ble_gap_adv_start(&adv_params);
    

    I am not getting any events at all. My main loop is running, but neither my ble_evt_dispatch() nor my on_adv_evt() are getting anything at all.

    I'm not sure how to test whether or not there's any actual advertising going on. I'm trying to connect with my Nexus7 tablet (Android 5.1) using the nRF UART app.

  • Installed Master Control Panel. Old code shows up, connects, shows GAP, GATT, and NUS services as expected. New code never shows up in list, so it doesn't seem to be broadcasting at all.

Related