Timed wakeup from deep sleep

I am using an nrf54l10 with the NRFconnect SDK. I would be interested in a solution to go into a low power state and wake up again after a specific time (multiple hours to days). Currently I am using sys_poweroff() but I only found solution to wake the system up via gpio inputs. Is there specific solution recommended for this kind of problem?

Thanks and regards,

Vito

Parents Reply Children
  • Thank you for your help. I tried to implement the sample directly into my code, but when I add CONFIG_GRTC_WAKEUP_ENABLE=y to my proj.conf I get an undefined symbol error. Without this, the code compiles, but does not wake up after 2 seconds as expected.

  • Hi,

    You cannot use in your project. That is a config that only exist in the sample and used there. You can see in main.c how it is used to call z_nrf_grtc_wakeup_prepare() when configured s well as include the needed header file (zephyr/drivers/timer/nrf_grtc_timer.h). That is the only things you need to add to your application, in addition to the code that enters system OFF mode (see the last part of main.c in the sample for that).

  • Yes, this is basically what I did: I just use this 

    	int err = z_nrf_grtc_wakeup_prepare(DEEP_SLEEP_TIME_S * USEC_PER_SEC); // DEEP_SLEEP_TIME_S * USEC_PER_SEC
    
    	if (err != 0) {
    		printk("Unable to prepare GRTC as a wake up source (err = %d).\n", err);
    	} else {
    		printk("Entering system off; wait %u seconds to restart\n", DEEP_SLEEP_TIME_S);
    	}
    	
    	hwinfo_clear_reset_cause();
      	sys_poweroff();

    The code compiles fine and my sample goes to sleep after not sending error message but "Entering system off..." but does not wake up after 2 seconds. Is there anything else I might have missed?

  • Hi,

    This looks good (assuming you have the needed include and have defined the values you use). Do you get any build warnings or runetime errors in the log? (If you have not I recommend you test with the sample to see that it works, and then maybe it is easier to debug your application).

  • I got the sample to work on my board. Unfortunately I see the same behavior. After going to sleep the board does not wake up again. I know that its asleep because I can wake it up again via GPIO (button press).  This is my output and then nothing happens.

    *** Booting nRF Connect SDK v3.0.2-89ba1294ac9b ***<\r>
    <\n>*** Using Zephyr OS v4.0.99-f791c49f492c ***<\r>
    <\n><\r>
    <\n>nrf54l15dk system off demo<\r>
    <\n>Reset by debugger.<\r>
    <\n>Retained data not supported<\r>
    <\n>Entering system off; wait 2 seconds to restart
    I had no development board at hand so I installed the sample on one of my custom boards. I had to adjust the proj.conf as I am using the internal 32 kHz Clock: 
    CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
    CONFIG_CLOCK_CONTROL_NRF_K32SRC_500PPM=y
    CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC_CALIBRATION=y
    CONFIG_CLOCK_CONTROL_NRF_CALIBRATION_LF_ALWAYS_ON=y
    Could this be a reason for the sample to not work as intended?
Related