nRF5 SDK instalation in PlatformIO - Power Management

Good morning,

I am developing a RAK4631 (Nordic nRF52840 + Semtech LoRa SX1262) and now I need to manage the power consumption.  My environment today is a VSCode/PlatformIO/FreeRTOS, and I need to install the nRF5 SDK in the PlatformIO to be able to work with the functions: nrf_pwr_mgmt_run() or _WFE or _WF

BSP Library : 1.6.1
Bootloader : s140 6.1.1

My code today already can read and send by LoRa a payload composed by sensors: LIS3DH, BME680, u-blox GNSS ZOE-M8Q.  My point is that I need to make the entire hardware goes to "deep sleep mode" during 15 minutes between each sensor reading cycle.

Could you help me?

Claudio

 

Parents
  • Hi,

    I am not familiar with Platform IO and it is not direclty supported by Nordic, but as you are usign the SoftDevice (S140 which to be clear is a Bluetooth stack and not a bootlodaer), you need to use SoftDevice API's to enter system ON low power mode. With a SoftDevice, this is achieved by callin sd_appp_evt_wait(), and with this, the CPU will sleep until an interrupt occurs. The typicall way to use this is to call sd_app_evt_wait() (or a library function that wraps around it such as nrf_pwr_mgmt_run()) in the main loop. You write that you are using FreeRTOS though, and in that case, this is handled by the idle thread, and that if you use the FreeRTOS port in the SDK, this is allready handled. So as long as no FreeRTOS threads are running, the idle thread will put the CPU in sleep mode.

    "deep sleep mode" during 15 minutes between each sensor reading cycle.

    As you write deep sleep, pwerhaps you are considering system OFF low power mode? Thi sis different, and wakeup from system off is only possible with a few selected wake up sources. The RTC is not one of those, so if you need to keep track of time internally in the nRF and not in an external device, system OFF mode cannot be used.

    Note that there are other factors that affect sleep current as well. The discussed methods only handles CPU sleep. But if for isntance the UART is enabeld, the HF clock will stay enabled and lead to a current consumption of several hunder micro amp even if the CPU is sleeping. And this is the case for other peripherals as well. And you also need to consider external cuircuitry.

Reply
  • Hi,

    I am not familiar with Platform IO and it is not direclty supported by Nordic, but as you are usign the SoftDevice (S140 which to be clear is a Bluetooth stack and not a bootlodaer), you need to use SoftDevice API's to enter system ON low power mode. With a SoftDevice, this is achieved by callin sd_appp_evt_wait(), and with this, the CPU will sleep until an interrupt occurs. The typicall way to use this is to call sd_app_evt_wait() (or a library function that wraps around it such as nrf_pwr_mgmt_run()) in the main loop. You write that you are using FreeRTOS though, and in that case, this is handled by the idle thread, and that if you use the FreeRTOS port in the SDK, this is allready handled. So as long as no FreeRTOS threads are running, the idle thread will put the CPU in sleep mode.

    "deep sleep mode" during 15 minutes between each sensor reading cycle.

    As you write deep sleep, pwerhaps you are considering system OFF low power mode? Thi sis different, and wakeup from system off is only possible with a few selected wake up sources. The RTC is not one of those, so if you need to keep track of time internally in the nRF and not in an external device, system OFF mode cannot be used.

    Note that there are other factors that affect sleep current as well. The discussed methods only handles CPU sleep. But if for isntance the UART is enabeld, the HF clock will stay enabled and lead to a current consumption of several hunder micro amp even if the CPU is sleeping. And this is the case for other peripherals as well. And you also need to consider external cuircuitry.

Children
Related