Help with Sleep Mode on nRF54L15 in Zigbee Light Switch

Hello,

I am developing a Zigbee switch based on the nRF54L15. One of the mandatory features is transitioning into sleep mode when the device is not in use. I thought I had implemented this using the same approach as in the example (zigbee_configure_sleepy_behavior(true);).

I purchased the Power Profiler Kit 2 to verify its operation. However, I did not see the microcontroller enter sleep mode at all. I even tried forcing it into sleep mode (zb_set_rx_on_when_idle(ZB_FALSE); zb_sleep_now();), but the microcontroller just reset with an error.

It seems that certain conditions need to be met before going to sleep, which may be indicated by a specific event. However, I first wanted to practice transitioning the microcontroller into different sleep modes while measuring current consumption.

By the end of the day, I was only able to achieve the deepest sleep mode, but I could not get the other modes to work. I also couldn't find clear examples—most attempts ended in failure. I’m concerned that solving this might take several days, so I’m reaching out here as a potential way to find a solution more quickly.

Is it possible to put the device into sleep mode when not in use in the Zigbee Light Switch example? What is the simplest way to transition the microcontroller into sleep mode? I believe I need System ON with GRTC.

Thank you!

Parents
  • Hello again,

    I am continuing to explore this topic. Based on the power consumption table:
    Power Consumption Table

    The "POWER ON IDLE with GRTC 256 kB RAM (3 μA)" mode is acceptable for my power consumption requirements, but I do not yet understand how to achieve it. I am reading the available documentation, and I have two concepts in mind:

    1. The system automatically reduces power consumption depending on the active resources, and I need to manually disable device drivers.
    2. I manually issue a command to enter a low-power mode, with some function remaining active that can wake up the microcontroller from this state.

    So far, deep sleep is the only mode I have successfully implemented. From the documentation, I understand that wake-up from this state can occur via a signal on GPIO pins (The DETECT signal generated by the GPIO peripheral).
    PMU Documentation

    This means I can implement my intended functionality using this mode. The key question is how long after pressing a button in sleep mode the microcontroller will reboot and send a Zigbee signal based on the pressed key. If this delay is too long, deep sleep mode may become impractical.

    Currently, I am trying to write a simple example program to train myself in entering deep sleep and waking up via one of two buttons, using the nRF54L15 development board.

    I have defined the button pins using DT aliases in the device tree and am using sw1 and sw2. I believe the microcontroller successfully enters sleep mode, but it does not wake up.

    Current Code:

    #include <zephyr/kernel.h>
    #include <zephyr/sys/poweroff.h>
    #include <zephyr/drivers/gpio.h>
    #include <zephyr/logging/log.h>
    
    LOG_MODULE_REGISTER(sleep_test, LOG_LEVEL_DBG);
    
    #define WAKEUP_PIN1_NODE DT_ALIAS(sw1)
    #define WAKEUP_PIN2_NODE DT_ALIAS(sw2)
    
    void configure_wakeup_pins(void)
    {
        LOG_INF("Configuring wakeup pins...");
        const struct device *gpio_dev1 = DEVICE_DT_GET(DT_GPIO_CTLR(WAKEUP_PIN1_NODE, gpios));
        const struct device *gpio_dev2 = DEVICE_DT_GET(DT_GPIO_CTLR(WAKEUP_PIN2_NODE, gpios));
    
        gpio_pin_configure(gpio_dev1, DT_GPIO_PIN(WAKEUP_PIN1_NODE, gpios), GPIO_INPUT | GPIO_PULL_UP);
        gpio_pin_configure(gpio_dev2, DT_GPIO_PIN(WAKEUP_PIN2_NODE, gpios), GPIO_INPUT | GPIO_PULL_UP);
        
        gpio_pin_interrupt_configure(gpio_dev1, DT_GPIO_PIN(WAKEUP_PIN1_NODE, gpios), GPIO_INT_EDGE_TO_ACTIVE);
        gpio_pin_interrupt_configure(gpio_dev2, DT_GPIO_PIN(WAKEUP_PIN2_NODE, gpios), GPIO_INT_EDGE_TO_ACTIVE);
        LOG_INF("Wakeup pins configured.");
    }
    
    int main(void)
    {
            LOG_INF("Starting system...");
            configure_wakeup_pins();
            LOG_INF("Entering System OFF mode.");
            k_msleep(2000);
            sys_poweroff();
            LOG_ERR("This should never be printed! System OFF should not return.");
    	while (1) {
    		k_msleep(2000);
                    LOG_INF("while 2000");
    	}
    }

    Configuration File (prj.conf):

    CONFIG_REBOOT=y
    CONFIG_POWEROFF=y
    
    CONFIG_UART_INTERRUPT_DRIVEN=y
    CONFIG_SERIAL=y
    CONFIG_GPIO=y
    CONFIG_CONSOLE=y
    CONFIG_UART_CONSOLE=y
    CONFIG_LOG=y

    Additionally, I would also like to implement "POWER ON IDLE with GRTC" mode in the future to better understand power management in Zephyr and the nRF54L15.

    I would appreciate any references to articles or documentation that can help me better understand power management modes and their proper implementation.

    Thank you in advance!

Reply
  • Hello again,

    I am continuing to explore this topic. Based on the power consumption table:
    Power Consumption Table

    The "POWER ON IDLE with GRTC 256 kB RAM (3 μA)" mode is acceptable for my power consumption requirements, but I do not yet understand how to achieve it. I am reading the available documentation, and I have two concepts in mind:

    1. The system automatically reduces power consumption depending on the active resources, and I need to manually disable device drivers.
    2. I manually issue a command to enter a low-power mode, with some function remaining active that can wake up the microcontroller from this state.

    So far, deep sleep is the only mode I have successfully implemented. From the documentation, I understand that wake-up from this state can occur via a signal on GPIO pins (The DETECT signal generated by the GPIO peripheral).
    PMU Documentation

    This means I can implement my intended functionality using this mode. The key question is how long after pressing a button in sleep mode the microcontroller will reboot and send a Zigbee signal based on the pressed key. If this delay is too long, deep sleep mode may become impractical.

    Currently, I am trying to write a simple example program to train myself in entering deep sleep and waking up via one of two buttons, using the nRF54L15 development board.

    I have defined the button pins using DT aliases in the device tree and am using sw1 and sw2. I believe the microcontroller successfully enters sleep mode, but it does not wake up.

    Current Code:

    #include <zephyr/kernel.h>
    #include <zephyr/sys/poweroff.h>
    #include <zephyr/drivers/gpio.h>
    #include <zephyr/logging/log.h>
    
    LOG_MODULE_REGISTER(sleep_test, LOG_LEVEL_DBG);
    
    #define WAKEUP_PIN1_NODE DT_ALIAS(sw1)
    #define WAKEUP_PIN2_NODE DT_ALIAS(sw2)
    
    void configure_wakeup_pins(void)
    {
        LOG_INF("Configuring wakeup pins...");
        const struct device *gpio_dev1 = DEVICE_DT_GET(DT_GPIO_CTLR(WAKEUP_PIN1_NODE, gpios));
        const struct device *gpio_dev2 = DEVICE_DT_GET(DT_GPIO_CTLR(WAKEUP_PIN2_NODE, gpios));
    
        gpio_pin_configure(gpio_dev1, DT_GPIO_PIN(WAKEUP_PIN1_NODE, gpios), GPIO_INPUT | GPIO_PULL_UP);
        gpio_pin_configure(gpio_dev2, DT_GPIO_PIN(WAKEUP_PIN2_NODE, gpios), GPIO_INPUT | GPIO_PULL_UP);
        
        gpio_pin_interrupt_configure(gpio_dev1, DT_GPIO_PIN(WAKEUP_PIN1_NODE, gpios), GPIO_INT_EDGE_TO_ACTIVE);
        gpio_pin_interrupt_configure(gpio_dev2, DT_GPIO_PIN(WAKEUP_PIN2_NODE, gpios), GPIO_INT_EDGE_TO_ACTIVE);
        LOG_INF("Wakeup pins configured.");
    }
    
    int main(void)
    {
            LOG_INF("Starting system...");
            configure_wakeup_pins();
            LOG_INF("Entering System OFF mode.");
            k_msleep(2000);
            sys_poweroff();
            LOG_ERR("This should never be printed! System OFF should not return.");
    	while (1) {
    		k_msleep(2000);
                    LOG_INF("while 2000");
    	}
    }

    Configuration File (prj.conf):

    CONFIG_REBOOT=y
    CONFIG_POWEROFF=y
    
    CONFIG_UART_INTERRUPT_DRIVEN=y
    CONFIG_SERIAL=y
    CONFIG_GPIO=y
    CONFIG_CONSOLE=y
    CONFIG_UART_CONSOLE=y
    CONFIG_LOG=y

    Additionally, I would also like to implement "POWER ON IDLE with GRTC" mode in the future to better understand power management in Zephyr and the nRF54L15.

    I would appreciate any references to articles or documentation that can help me better understand power management modes and their proper implementation.

    Thank you in advance!

Children
No Data
Related