System Power off on nRF5240

Hi all,

I was wondering if anyone has any recommendations before turning the system off using sys_poweroff(); ? I plan to use this API to turn the system off upon command from another mcu in order to save power. I have been testing it and saw the system comes back on when I trigger the RST pin. I also have some devices such as peripherals (I2C, SPI, GPIO), should I "suspend" those devices using the pm API? If this is recommended, would those devices return to running state upon reset?

Any insight would be highly appreciated! BR,

Kevin 

Parents
  • Hello,

    Will the device always be reset using the reset pin? Or will it sometimes be reset using another pin?

    The only ways to wake up the nRF52840 from System Off mode is either the reset pin, some other GPIO interrupt or NFC. So if you enter system off, pretty much everything else will be shut off. The only thing that I can think of is that if you have I2C, SPI and GPIO, these pins will have the same pin configuration as they had before you entered system off. So if you want to make sure they it is not unintentionally woken up by interrupts on these pins (the ones that are input pins in these peripherals), you may want to disable these peripherals, or at least put their pins in the default state (disconnected input). Another reason to turn them off is that a pin that is either set as an active output (high or low), or an input pin, will draw some power. So unless you need them while in system off, it is recommended to "suspend" or "uninit" these peripheral instances, if you want to save the most power.

    I don't know what SDK type you are using (nRF5 SDK or nRF Connect SDK), but both of these has API to disable peripherals. 

    Let me know what SDK you are using if you struggle finding it. 

    Best regards,

    Edvin

  • Hi Edvin, 

    Thanks for replying. The device will only be reset using the reset pin. I am using NCS V2.5.0. At this time, I have the "sleep" pin configurations for those peripherals to be the same as the default, as such:

    spi0_default: spi0_default {
            group1 {
                psels = <NRF_PSEL(SPIS_SCK, 0, 14)>,
                        <NRF_PSEL(SPIS_MOSI, 0, 16)>,                    
                        <NRF_PSEL(SPIS_MISO, 0, 15)>,
                        <NRF_PSEL(SPIS_CSN, 0 ,13)>;
            };
        };
        spi0_sleep: spi0_sleep {
            group1 {
                psels = <NRF_PSEL(SPIS_SCK, 0, 14)>,
                        <NRF_PSEL(SPIS_MOSI, 0, 16)>,
                        <NRF_PSEL(SPIS_MISO, 0, 15)>,
                        <NRF_PSEL(SPIS_CSN, 0 ,13)>;
            };
        };
    Is this what you were referring to earlier?
    BR,
    Kevin 

  • Hello Kevin,

    This tells me that you are using NCS (nRF Connect SDK). Good. 

    It looks like you spi peripheral is an SPI slave, is that the case? In that case, are you sure that you don't want the ability to wake up from the SCK pin when you enter system off? And similarly, are you sure that you don't want to wake on I2C when you are in system off? If the answer to both of these is that you don't need to wake from these sources, then you can safely disable these before going to system off. 

    You can do so using pm_device_action_run(<peripheral_device>, PM_DEVICE_ACTION_SUSPEND);

    And you can confirm via debugging that the GPIO pin configuration registers are set to their default state (0x00000002). The same goes for GPIO (that are not SPI or I2C). If you have any input or output pins, you can set these as disconnected input pins as well. There is probably a function similar to the one that initialized them that will uninit them. If you can't find it, please let me know what you used to set them to input/output pins.

    Best regards,

    Edvin

  • Hi Edvin, 

    Yes, my SPI is a slave. I might not suspend or unitialize any GPIO. I was doing some power consumption measurements and the consumption is very low already. I was just wondering if it was necessary to suspend or turn off any devices before turning the system off. But I have also been testing turning the system off and then waking the chip up (through reset) and the devices work just fine upon reset, I did not observe any negative effects. 

    For the GPIO pins, I used the driver in  <zephyr/drivers/gpio.h>. If need be, I will look into suspending the peripherals and disconnecting the GPIO. Thanks for your help and insight!

    Best regards,

    Kevin 

  • Hello Kevin,

    So I understand correctly if you cannot turn off the peripherals and GPIOs, then. Right?

    In that case, there is no need to do anything particular with them before entering system off. They are already quite low power because they are not using the HFCLK when they are idle. So it is only the current from the GPIOs, more or less.

    Best regards,

    Edvin

Reply Children
No Data
Related