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

Switching from BLE_ADV_EVT_SLOW to BLE_ADV_EVT_FAST not working

Hi,

I use S130 with SDK 12.3.0.

I have an application that permanently advertise with an interval of 10s but when the user push a button I switch to BLE_ADV_EVT_FAST . I use the ble_advertising module.

To switch to fast mode I call ble_advertising_start(BLE_ADV_MODE_FAST) when the button is pressed but I never receive the BLE_ADV_EVT_FAST on the _OnAdvEvt function.

My configuration is:

#define APP_ADV_FAST_INTERVAL           64                                         // Fast advertising interval (multiple of 0.625 ms) = 40 ms
#define APP_ADV_FAST_TIMEOUT_IN_SECONDS 2                                          // Fast advertising timeout = 2s
#define APP_ADV_SLOW_INTERVAL           16000                                      // Slow advertising interval (multiple of 0.625 ms) = 10s
#define APP_ADV_SLOW_TIMEOUT_IN_SECONDS 0                                          // Slow advertising timeout = 1mn

static void _AdvertisingInit(void)
{
    uint32_t u32_ErrCode;
    ble_advdata_t s_AdvData;
    ble_adv_modes_config_t s_Options;

    // Build advertising data struct to pass into @ref ble_advertising_init.
    memset(&s_AdvData, 0, sizeof(s_AdvData));
    s_AdvData.name_type               = BLE_ADVDATA_FULL_NAME;
    s_AdvData.include_appearance      = true;
    s_AdvData.flags                   = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;        //BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE;

    memset(&s_Options, 0, sizeof(s_Options));
    s_Options.ble_adv_fast_enabled  = true;
    s_Options.ble_adv_fast_interval = APP_ADV_FAST_INTERVAL;
    s_Options.ble_adv_fast_timeout  = APP_ADV_FAST_TIMEOUT_IN_SECONDS;
    s_Options.ble_adv_slow_enabled  = true;
    s_Options.ble_adv_slow_interval = APP_ADV_SLOW_INTERVAL;
    s_Options.ble_adv_slow_timeout  = APP_ADV_SLOW_TIMEOUT_IN_SECONDS;

    u32_ErrCode = ble_advertising_init(&s_AdvData, NULL, &s_Options, _OnAdvEvt, NULL);
    APP_ERROR_CHECK(u32_ErrCode);
}


I did another try with a APP_ADV_SLOW_TIMOUT_IN_SECONDS set to 60. I have the sequence FAST->SLOW->IDLE and when I receive the BLE_ADV_EVT_IDLE I do a ble_advertising_start(BLE_ADV_MODE_SLOW), it restart in slow mode. But when the user push the button it's not possible to switch to fast mode.

Best regards.
Parents Reply Children
No Data
Related