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

Sleep and wake up using timer interrupt

Dear  All,

I am working with SDK version 15 and softdevice 132.

I want the device to advertise for 1 minute. Then go to low power mode. Again wake up after 5 minutes. Advertise again for 1 minutes...go on... like this.

I am using app_timer which is calling the interrupt handler for  each 5 minute duration.

I am planning to call the function advertising_start() from  the handler.

But I am facing the following issue. as soon as the advertising stops the the apptimer  interrupt handler is not getting called.

Please let me know I I am wrong any where?

  • I am not sure why this happens, but I was able to make it work with an app timer and the following timeout_handler:

    static void awesome_timeout_handler(void * p_context)
    {
       if(!advertising_on)
       {
          NRF_LOG_INFO("Start advertising");
          advertising_start();
       }
       else
       {
          NRF_LOG_INFO("Stop advertising!!");
          (void) sd_ble_gap_adv_stop(m_advertising.adv_handle);
       }
          advertising_on = !advertising_on;
    }

    Check out the code yourself:

    ble_app_uart.zip

    Best regards, Simon

  • Hi, 

    Thank you very much for the reply. It was because the system was calling the a function ( sd_power_system_off() called from  sleep_mode_enter())  to go to low power mode. I think this stops the timer also. I commented this and now the code is working fine.  And advertising is happening periodically.Please share your ideas. And in the main function i am calling the function 'sd_app_evt_wait()'  to go to low power mode.

Related