Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

SDK 14.2: Slow directed advertising doesn't work

I'm having issues with slow directed advertising. I'm having a BLE peripheral where I want the device to advertise (direct) upon disconnects. I initialize the advertising module as follows:

    init.config.ble_adv_fast_enabled            = true;
    init.config.ble_adv_fast_interval           = APP_ADV_INTERVAL;
    init.config.ble_adv_fast_timeout            = APP_ADV_TIMEOUT_IN_SECONDS;
    init.config.ble_adv_directed_enabled        = true;
    init.config.ble_adv_directed_slow_enabled   = true;
    init.config.ble_adv_directed_slow_interval  = 40;
    init.config.ble_adv_directed_slow_timeout   = 10;

When I disconnect my central (I have tried with both macOS and Android) I am able to connect I am really quick - hence regular (one-off) directed advertising seems to work, but if I wait until the slow directed advertising starts, I never manage to connect to it from the central. Once it times out and goes to regular fast advertising it works (my long-term goal is to disable the regular advertising to get a reconnect-to-last-device behavior).

I have an event handler registered and answers BLE_ADV_EVT_PEER_ADDR_REQUEST as expected (otherwise the one-off directed advertising wouldn't work, right?). I have added checks in ble_advertising.c and there is no error code returned by sd_ble_gap_adv_start. I get a BLE_ADV_EVT_DIRECTED_SLOW event.

Thanks, Jacob

Parents
  • Hi,

    What do you use on macOS and Android to connect to your device? nRF Connect? Do you get any errors on Central when trying to connect?

  • Have you tried increasing these parameters?

    init.config.ble_adv_directed_slow_interval 
    init.config.ble_adv_directed_slow_timeout

    According to ble_advertisement.h, ble_adv_directed_slow_timeout is number of tries. So your device will only do slow directed advertising in 400ms before it times out.

    typedef struct
    {
        bool     ble_adv_on_disconnect_disabled;  /**< Enable or disable automatic return to advertising upon disconnecting.*/
        bool     ble_adv_whitelist_enabled;       /**< Enable or disable use of the whitelist. */
        bool     ble_adv_directed_enabled;        /**< Enable or disable direct advertising mode. */
        bool     ble_adv_directed_slow_enabled;   /**< Enable or disable direct advertising mode. */
        bool     ble_adv_fast_enabled;            /**< Enable or disable fast advertising mode. */
        bool     ble_adv_slow_enabled;            /**< Enable or disable slow advertising mode. */
        uint32_t ble_adv_directed_slow_interval;  /**< Advertising interval for directed advertising. */
        uint32_t ble_adv_directed_slow_timeout;   /**< Time-out (number of tries) for direct advertising. */
        uint32_t ble_adv_fast_interval;           /**< Advertising interval for fast advertising. */
        uint32_t ble_adv_fast_timeout;            /**< Time-out (in seconds) for fast advertising. */
        uint32_t ble_adv_slow_interval;           /**< Advertising interval for slow advertising. */
        uint32_t ble_adv_slow_timeout;            /**< Time-out (in seconds) for slow advertising. */
    } ble_adv_modes_config_t;

     

  • Yes, I have tried changing the numbers up and down, and during slow (directed) advertising the device won't show up on the central side. It works on directed and fast advertising.

Reply Children
No Data
Related