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

nRF52840 DK restarts application after 3 minutes when not connected to any device via BLE

Hi. I have edited the Heart Rate Service Example project in SDK 17.02 and I am currently using nRF52840 DK.

I am not sure of the reason why the application restarts after 3 minutes when it is idle.

It does not restart when it is connected to nRF toolbox mobile app.

Is there a reason why?

I will appreciate the help.

Thank you.

Parents
  • Hi,

    the application advertising interval is 180 seconds (3 minutes). 

    #define APP_ADV_DURATION                    18000                                   /**< The advertising duration (180 seconds) in units of 10 milliseconds. */

    If the device wasn't connected within that period, the application enters the idle state ( adv event : BLE_ADV_EVT_IDLE ) in which it enters the deep sleep mode.

    static void on_adv_evt(ble_adv_evt_t ble_adv_evt)
    {
        ret_code_t err_code;
    
        switch (ble_adv_evt)
        {
            case BLE_ADV_EVT_FAST:
                NRF_LOG_INFO("Fast advertising.");
                err_code = bsp_indication_set(BSP_INDICATE_ADVERTISING);
                APP_ERROR_CHECK(err_code);
                break;
    
            case BLE_ADV_EVT_IDLE:
                sleep_mode_enter();
                break;
    
            default:
                break;
        }
    }

    One reason of the restart could be that you pressed the wakeup button.

    Note that the wakeup resets the application, means that it'll restart..

    Hope that helps,

  • Hi. I comment out the sleep mode as I am not required for the device to sleep when idle state.

    Therefore, the device now does not restart its application. Does this affect the device?

  • Hi,

    No it won't affect the device. It just won't enter the sleep mode when the advertising times out !

    Another fix for not having the advertising times out is by commenting this line : 

     init.config.ble_adv_fast_timeout  = APP_ADV_DURATION;

    You may consider the sleep mode at the stage we're you're looking to optimize the power consumption of your device.

    The Wakeup button is not the Reset button, but they have the same effect as they both reset the application.

    The Sleep and Wakeup buttons are by default set to the Button 0. You can check the bsp_btn_ble.c file available in the Board support folder in to the Project Explorer to the left in Segger for that.

    Hope that helps,

Reply
  • Hi,

    No it won't affect the device. It just won't enter the sleep mode when the advertising times out !

    Another fix for not having the advertising times out is by commenting this line : 

     init.config.ble_adv_fast_timeout  = APP_ADV_DURATION;

    You may consider the sleep mode at the stage we're you're looking to optimize the power consumption of your device.

    The Wakeup button is not the Reset button, but they have the same effect as they both reset the application.

    The Sleep and Wakeup buttons are by default set to the Button 0. You can check the bsp_btn_ble.c file available in the Board support folder in to the Project Explorer to the left in Segger for that.

    Hope that helps,

Children
No Data
Related