enabling and wake up from sleep mode (systemoff)?

through RTC i am trying it but it is not happening can  you give any propre example one for the sleep mode enabling and wakening up from the sleep mode.

  • Hello,

    Unfortunately, it is not possible to wake the nRF5340 from systemoff using the RTC. This is only possible on the nRF54L-series, which has a GRTC. Other nRF devices will not be able to have the RTC running in SystemOff, and hence, it is not possible to wake up from it. If you need to wake on a timer, you need to use systemOn-Idle. 

    You can read about systemoff on the nRF5340 here:

    https://docs.nordicsemi.com/bundle/ps_nrf5340/page/chapters/reset/doc/reset.html#ariaid-title5

    So from systemOff, the only things that can wake up the nRF5340 are GPIO interrupts, reset pin, power on reset or NFC. If you need to wake it up from a timer, you need to have an external timer module that can give a pulse after a given amount of time.

    Best regards,

    Edvin

  • Hello Edvin,

    Thank you for clarifying about the limitation with SystemOff and RTC wakeup on the nRF5340.

    I would like to understand more about SystemOn-Idle:

    1. How exactly does SystemOn-Idle work on the nRF5340? Is it automatically entered when the CPU executes WFI/WFE, or do we need to explicitly configure it through the Zephyr Power Management API?

    2. Are there any examples or reference projects showing how to put the device into SystemOn-Idle and then wake up again using the RTC or with out RTC?

    3. Could you please share some current consumption numbers for nRF5340:

      • In SystemOn-Idle with RTC running.

      • In SystemOn-Idle without RTC.

      • Compared to SystemOff.

    This will help me evaluate whether SystemOn-Idle meets my use case, since I need a periodic wakeup from the RTC while minimizing power consumption.

    Best regards,
    Lalith

  • tatic void system_on_idle(void)
    {

       gpio_pin_configure_dt(&leds, GPIO_OUTPUT_ACTIVE);
            /* Enter low-power idle mode until any interrupt/event occurs */
            __WFE();
            __SEV();
            __WFE();
    // NRF_VMC->RAM[0].POWER = 0x0001;
    // NRF_VMC->RAM[1].POWER = 0;
    // NRF_VMC->RAM[2].POWER = 0x8000;
    // NRF_VMC->RAM[3].POWER = 0xFFFF;
    // NRF_VMC->RAM[4].POWER = 0;
    // NRF_VMC->RAM[5].POWER = 0;
    // NRF_VMC->RAM[6].POWER = 0x8000;
    // NRF_VMC->RAM[7].POWER = 0;
            /* Optional: blink LED each time CPU wakes up */
            //gpio_pin_toggle_dt(&leds);

            /* Let other threads run / handle events */
           // k_msleep(1000);
       

    just explain about this how it will useful to power management 
  • lalith88 said:
    Is it automatically entered when the CPU executes WFI/WFE,

    Yes, but it will also be entered whenever it doesn't have any more tasks, so e.g. by calling k_sleep(), which is typcally what you will see in the samples. Also, when you are in a Bluetooth Low Energy connection, the system on idle is the state that it will be using between the connection events (the events occuring every connection interval). So whenever the radio is done maintaining the connection, it will go back to sleep (system on). So basically all samples use this system on state.

    lalith88 said:
    tatic void system_on_idle(void)
    {

       gpio_pin_configure_dt(&leds, GPIO_OUTPUT_ACTIVE);
            /* Enter low-power idle mode until any interrupt/event occurs */
            __WFE();
            __SEV();
            __WFE();
    // NRF_VMC->RAM[0].POWER = 0x0001;
    // NRF_VMC->RAM[1].POWER = 0;
    // NRF_VMC->RAM[2].POWER = 0x8000;
    // NRF_VMC->RAM[3].POWER = 0xFFFF;
    // NRF_VMC->RAM[4].POWER = 0;
    // NRF_VMC->RAM[5].POWER = 0;
    // NRF_VMC->RAM[6].POWER = 0x8000;
    // NRF_VMC->RAM[7].POWER = 0;
            /* Optional: blink LED each time CPU wakes up */
            //gpio_pin_toggle_dt(&leds);

            /* Let other threads run / handle events */
           // k_msleep(1000);
       

    I would remove the __WFE(), __SEV(), and __WFE(), and just use k_msleep(K_MSEC(1000)); to enter system on idle for 1 second.

    Here are some numbers for system on vs system off:

    https://docs.nordicsemi.com/bundle/ps_nrf5340/page/chapters/current_consumption/doc/current_consumption.html#ariaid-title3

    Best regards,

    Edvin

  • Hello Edvin,

    Thank you for sharing the details and current consumption link. I have a follow-up question:

    1. What is the practical difference between using:

      __WFE(); __SEV(); __WFE();

      versus simply using  k_msleep(K_MSEC(1000)); in Zephyr?

    2. I understand k_msleep() lets the thread sleep and the scheduler manages the idle entry, while the WFE sequence forces the CPU to sleep immediately. Could you please confirm if there are advantages in power saving or interrupt handling when using one approach vs the other?

    3. Also, as I understand, for the system to actually enter SystemOn-Idle, all other threads/events should be idle as well. What is the recommended way to manage multiple threads so the device consistently goes into SystemOn-Idle whenever possible?

    This will help me decide whether to rely fully on Zephyr APIs or mix in direct WFE/SEV calls for tighter control.

    Best regards,
    Lalith

Related