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.

  • The major problem is that without the nRF5 SDK installed, I can´t handle low power MCU functions.  Do you have any way to install nRF5 SDK in Arduino environment?

    Claudio

  • Hi Claudio,

    Unfortunately, we do not support or have any advice regardign Ardutino on the nRF5 devices, unfortunately.

    I do not know the detailf your your deviec (and I am a bit confused as there are ferences to both nRF5 SDK, FreeRTOS and Arduino), but to be clear: There is no requierment to use the nRF5 SDK to achieve low power. The SoC features are there regardless of which firmware components you are using. As the lowest level, entering system ON low power mode is just a matter of calling WFE (but it needs to be doen in a way that works with other comonents, as I described when using the SoftDevice).

    And system OFF mode is simpler, as wakeup involves a reset. By using low-level APIs. When using a SoftDevice (as you are as you describe S140), you do that with a call to sd_power_system_off(). Note that you need to configure the wakeup-source first.

  • My device will be installed in a train wagon, then I can´t have a button dependency.

    Please correct me if I am wrong, but I think that  I need to have a RTC interruption and a _WFI (wait for interruption) and it is inside o nRF5 SDK librarries.

    Claudio

  • Hi,

    Yes, the SoftDevice will use RTC0 for keeping track of time. And if you youse FreeRTOS that will also use an RTC instance for that. And if using for instance app_timer and not FreeRTOS, that will use RTC1.

  • My point is how to work with _WFI in the FreeRTOS?  I mean, what is the library that I need to have support for _WFI?

    Claudio

  • If you use the FreeRTOS port from the nRF5 SDK, this is allready handled in the FreeRTOS idle task. You can see the implementation of this in external/freertos/portable/CMSIS/nrf52/port_cmsis_systick.c. Note that as mentionned before, this only means that the CPU will enter low power mode whenever no tasks are running. You still need to ensure that other parts of the system is not consuming power (both internally in the nRF, particularily peripherals that keep the HF clock active, as well as other parts of your product/PCB).

Reply Children
No Data
Related