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

WakeUp from sleep mode

Hi,

we try to get the NRF52840 to sleep and then wake up from an GPIO interrupt.

We try it in debug mode which should give a emulated sleep mode. So we stop all processing and at a while(1) loop after calling sd_power_system_off.

The wakeup pin is configured as followed:

	nrf_gpio_cfg_input(IMU_INT2, NRF_GPIO_PIN_NOPULL);
	nrf_gpio_cfg_sense_set(IMU_INT2, NRF_GPIO_PIN_SENSE_HIGH);

Prior to setting the nrf to sleep the interrupt is firing and working as expected. And I can see the interrupt going high and low again when the nrf should be in sleep

but it does not produce a reset. Some other information the device is running with USB powered and usb_handling enabled and debugger disconnected.

I've already tried to uncomment the USB stuff and run it without USB but still no progress.
Help is appreciated ;-).

Kind regards,

C.W.

PS: SDK is 17.0.0

Parents
  • Hi again

    Okay, so it's not related to the debug mode specifically. I would suggest you check out some of our example projects that go to sleep using the sleep_mode_enter() function which prepares wakeup buttons and goes to system-off mode like this.

    /**@brief Function for putting the chip into sleep mode.
     *
     * @note This function will not return.
     */
    static void sleep_mode_enter(void)
    {
        ret_code_t err_code;
    
        err_code = bsp_indication_set(BSP_INDICATE_IDLE);
        APP_ERROR_CHECK(err_code);
    
        // Prepare wakeup buttons.
        err_code = bsp_btn_ble_sleep_mode_prepare();
        APP_ERROR_CHECK(err_code);
    
        // Go to system-off mode (this function will not return; wakeup will cause a reset).
        err_code = sd_power_system_off();
        APP_ERROR_CHECK(err_code);
    }

    See, I.E. the ble_app_hrs example for more details.

    Best regards,

    Simon

  • Hi Simon,

    okay we solved the first issue. The device can be now brought to sleep mode and it wakes up again. But the issue is that this is only possible when we call the sleep processing in the callback when the advertising switches to IDLE. If the the device is advertising ongoing and we call the sd_power_system_off it fails and cannot be brought to sleep mode.

    Do you have a explanation for this and how can be force the chip to sleep mode even in advertising?

    Kind regards,

    Constantin

Reply
  • Hi Simon,

    okay we solved the first issue. The device can be now brought to sleep mode and it wakes up again. But the issue is that this is only possible when we call the sleep processing in the callback when the advertising switches to IDLE. If the the device is advertising ongoing and we call the sd_power_system_off it fails and cannot be brought to sleep mode.

    Do you have a explanation for this and how can be force the chip to sleep mode even in advertising?

    Kind regards,

    Constantin

Children
No Data
Related