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

Slow / fast advertising

Hi,

I have a question regarding fast/slow advertising

I'd like to advertise for 180s using a 100ms interval, then switch to a 1s interval, preferably for ever. I set advertise options as shown in the image.

When I test the software I find that advertising stops after 3 seconds. Why?

Thank you for helping me out on this M

image description

Parents
  • Like you have suggested I have tried out your ANCS example. It turns out the example works as I would expect. Here is how I setup advertising, what do I do wrong?

    #define APP_ADV_FAST_ENABLED             true        
    #define APP_ADV_FAST_INTERVAL             160    /* (corresponding to 100ms) */
    #define APP_ADV_FAST_TIMEOUT_IN_SECONDS   180            /* Adv. timeout [s] */
    
    #define APP_ADV_SLOW_ENABLED             true
    #define APP_ADV_SLOW_INTERVAL            1600    /* (corresponding to 1s)    */
    #define APP_ADV_SLOW_TIMEOUT_IN_SECONDS  1000            /* Adv. timeout [s] */
    
        static void  initAdvertising (void)
        {
            uint32_t                err_code;
            ble_advdata_t           adv_data, scan_data;
            ble_uuid_t              adv_list, scan_list;
            ble_adv_modes_config_t  adv_opts;
        
                                 /* Build advertising and scan response UUID lists:- */
            adv_list.uuid  = 0;        /* Byte 12/13 -> zero'ed out (= service UUID) */
            adv_list.type  = BLE_UUID_TYPE_VENDOR_BEGIN + 4;   /* service[4] = MIDAS */
        
            scan_list.uuid = 0;        /* Byte 12/13 -> zero'ed out (= service UUID) */
            scan_list.type = BLE_UUID_TYPE_VENDOR_BEGIN + 3;   /* service[3] = MDC   */
                                                           /* Configure advertising: */
            memset (&adv_data, 0, sizeof (adv_data));
            adv_data.name_type               = BLE_ADVDATA_FULL_NAME;
            adv_data.flags                   = BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE;
            adv_data.uuids_complete.uuid_cnt = 1;
            adv_data.uuids_complete.p_uuids  = &adv_list;
                                                         /* Configure scan response: */
            memset (&scan_data, 0, sizeof (scan_data));
            scan_data.uuids_complete.uuid_cnt = 1;
            scan_data.uuids_complete.p_uuids  = &scan_list;
                                                               /* Configure options: */
            memset (&adv_opts, 0, sizeof (adv_opts));
            adv_opts.ble_adv_fast_enabled  = BLE_ADV_FAST_ENABLED;
            adv_opts.ble_adv_fast_interval = APP_ADV_FAST_INTERVAL;
            adv_opts.ble_adv_fast_timeout  = APP_ADV_FAST_TIMEOUT_IN_SECONDS;
            adv_opts.ble_adv_slow_enabled  = BLE_ADV_SLOW_ENABLED;
            adv_opts.ble_adv_slow_interval = APP_ADV_SLOW_INTERVAL;
            adv_opts.ble_adv_slow_timeout  = APP_ADV_SLOW_TIMEOUT_IN_SECONDS;
        
            err_code = ble_advertising_init (&adv_data, &scan_data, &adv_opts, onAdvertisingEvent, NULL);
            APP_ERROR_CHECK (err_code);
        }
    

    Thank you Matthias

Reply
  • Like you have suggested I have tried out your ANCS example. It turns out the example works as I would expect. Here is how I setup advertising, what do I do wrong?

    #define APP_ADV_FAST_ENABLED             true        
    #define APP_ADV_FAST_INTERVAL             160    /* (corresponding to 100ms) */
    #define APP_ADV_FAST_TIMEOUT_IN_SECONDS   180            /* Adv. timeout [s] */
    
    #define APP_ADV_SLOW_ENABLED             true
    #define APP_ADV_SLOW_INTERVAL            1600    /* (corresponding to 1s)    */
    #define APP_ADV_SLOW_TIMEOUT_IN_SECONDS  1000            /* Adv. timeout [s] */
    
        static void  initAdvertising (void)
        {
            uint32_t                err_code;
            ble_advdata_t           adv_data, scan_data;
            ble_uuid_t              adv_list, scan_list;
            ble_adv_modes_config_t  adv_opts;
        
                                 /* Build advertising and scan response UUID lists:- */
            adv_list.uuid  = 0;        /* Byte 12/13 -> zero'ed out (= service UUID) */
            adv_list.type  = BLE_UUID_TYPE_VENDOR_BEGIN + 4;   /* service[4] = MIDAS */
        
            scan_list.uuid = 0;        /* Byte 12/13 -> zero'ed out (= service UUID) */
            scan_list.type = BLE_UUID_TYPE_VENDOR_BEGIN + 3;   /* service[3] = MDC   */
                                                           /* Configure advertising: */
            memset (&adv_data, 0, sizeof (adv_data));
            adv_data.name_type               = BLE_ADVDATA_FULL_NAME;
            adv_data.flags                   = BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE;
            adv_data.uuids_complete.uuid_cnt = 1;
            adv_data.uuids_complete.p_uuids  = &adv_list;
                                                         /* Configure scan response: */
            memset (&scan_data, 0, sizeof (scan_data));
            scan_data.uuids_complete.uuid_cnt = 1;
            scan_data.uuids_complete.p_uuids  = &scan_list;
                                                               /* Configure options: */
            memset (&adv_opts, 0, sizeof (adv_opts));
            adv_opts.ble_adv_fast_enabled  = BLE_ADV_FAST_ENABLED;
            adv_opts.ble_adv_fast_interval = APP_ADV_FAST_INTERVAL;
            adv_opts.ble_adv_fast_timeout  = APP_ADV_FAST_TIMEOUT_IN_SECONDS;
            adv_opts.ble_adv_slow_enabled  = BLE_ADV_SLOW_ENABLED;
            adv_opts.ble_adv_slow_interval = APP_ADV_SLOW_INTERVAL;
            adv_opts.ble_adv_slow_timeout  = APP_ADV_SLOW_TIMEOUT_IN_SECONDS;
        
            err_code = ble_advertising_init (&adv_data, &scan_data, &adv_opts, onAdvertisingEvent, NULL);
            APP_ERROR_CHECK (err_code);
        }
    

    Thank you Matthias

Children
No Data
Related