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

Advertising interval from Slow to fast without init process

Hi,

I am implementing a beacon solution and intrested to move from fast to slow and vis versa(slow to fast) advertising modes - 

i.e. BLE_ADV_MODE_FAST & BLE_ADV_MODE_SLOW

This is a coincell powered device and the goal for these transitions is to save battery.

I am using nRF5_SDK_14.2.

In this SDK version is there a way to move from SLOW to Fast without running again advertising_init()?


Related post https://devzone.nordicsemi.com/f/nordic-q-a/19074/can-i-change-nrf5-bluetooth-advertising-interval-dynamically/73766#73766

Parents
  • Hi Yaniv,

    Please take a look in the "Advertising Module documentation".

    Usually you have advertising go from  Fast -> Slow -> Idle.

    Do you only want to change from Fast -> Slow -> Fast -> Slow ? (aka. never enter sleep_mode?)

    If so you could just add that when Slow_adv_timeout runs out you go back to fast_adv in the IDLE case:

     switch (ble_adv_evt)
        {
            case BLE_ADV_EVT_FAST:
                err_code = bsp_indication_set(BSP_INDICATE_ADVERTISING);
                APP_ERROR_CHECK(err_code);
    						NRF_LOG_INFO("FAST ADVERTISING");
                break;
    				
    				case BLE_ADV_EVT_SLOW:
    					err_code = bsp_indication_set(BSP_INDICATE_ADVERTISING_SLOW);
    					APP_ERROR_CHECK(err_code);
    					NRF_LOG_INFO("SLOW ADVERTISING");
    				  break;
    				
            case BLE_ADV_EVT_IDLE:
    					  //NRF_LOG_INFO("IDLE");
                //sleep_mode_enter();
    						err_code = bsp_indication_set(BSP_INDICATE_ADVERTISING);
                APP_ERROR_CHECK(err_code);
    						NRF_LOG_INFO("FAST ADVERTISING");
    						
                break;
            default:
                break;
        }

     

Reply
  • Hi Yaniv,

    Please take a look in the "Advertising Module documentation".

    Usually you have advertising go from  Fast -> Slow -> Idle.

    Do you only want to change from Fast -> Slow -> Fast -> Slow ? (aka. never enter sleep_mode?)

    If so you could just add that when Slow_adv_timeout runs out you go back to fast_adv in the IDLE case:

     switch (ble_adv_evt)
        {
            case BLE_ADV_EVT_FAST:
                err_code = bsp_indication_set(BSP_INDICATE_ADVERTISING);
                APP_ERROR_CHECK(err_code);
    						NRF_LOG_INFO("FAST ADVERTISING");
                break;
    				
    				case BLE_ADV_EVT_SLOW:
    					err_code = bsp_indication_set(BSP_INDICATE_ADVERTISING_SLOW);
    					APP_ERROR_CHECK(err_code);
    					NRF_LOG_INFO("SLOW ADVERTISING");
    				  break;
    				
            case BLE_ADV_EVT_IDLE:
    					  //NRF_LOG_INFO("IDLE");
                //sleep_mode_enter();
    						err_code = bsp_indication_set(BSP_INDICATE_ADVERTISING);
                APP_ERROR_CHECK(err_code);
    						NRF_LOG_INFO("FAST ADVERTISING");
    						
                break;
            default:
                break;
        }

     

Children
No Data
Related