Low power with Xiao nrf52840 on Zephyr RTOS

I stumbled onto a solution that gives reasonable idle mode power with the Xiao nrf52840 on Zephyr RTOS. I’m currently getting 1.0uA in system off sleep and 12uA in idle mode. I thought others might be interested.

I was stuck for a long time with idle power between 190-570 uA. The solution I stumbled into gets close to the 1uA idle, and 3uA system_off sleep that was achievable with the Arduino code base as described in Getting lower power consumption on Seeed XIAO nRF52840.

I was originally working on Zephyr 3.2 and nrf Connect for desktop. When I couldn’t make headway I upgraded to zephyr 3.3. In zephyr 3.3 the flash device was upgraded to the QSPI interface. However, there is a bug where it fails to come out of deep sleep (Exiting Deep Power Down on a p25q16h not working), so I ported the SPI flash configuration in 3.2 to the 3.3 environment. In the process I moved the device to spi2 from spi3. This solved a major idle mode power issue. I went back to 3.2 and confirmed that this also addressed the problem in that release.

I’ve tried to disabled non-critical devices, but haven’t gotten any closer to the 3uA achieved on the Arduino code base. Next I might try to explicitly put the flash chip in deep power down mode while in idle.

I’d be interested if anyone has info on this topic or other ideas to try.

Attached code snippets demonstrate system on sleep (idle), system off sleep, and wake from system off. This should work with both Zephyr 3.2 and 3.3.

power_test.zip (3.4 KB)

Power measurements with PPK2:

  • Starting point: idle 190uA, system off sleep 186uA
  • Enable default flash device on sp3: idle 570uA, system off sleep 41uA
  • CONFIG_PM_DEVICE=y: idle 566uA, system off sleep 1.0 uA
  • Put flash on spi2: idle 22uA, system off sleep 1.0 uA
  • Switch to sense interrupts: idle 11.5uA, system off sleep 1.0uA

This is cool. I am also trying to get low-power mode working, but I am stuck at 730uA following some of the other threads in this forum. I was going to try Zephyr next to gain total control, looks like I’m not the only one :slight_smile: . I’m still new to zephyr/embedded systems and learning as I go. Could you share the board file you are using?

I’m using the plain Xiao nrf52840.

I found it easier to optimize for memory size with Zephyr since it is highly configurable. I found it harder to optimize for power with Zephyr because of the abstraction and indirection. My target application is using Zephyr on a nrf52810 which I needed to optimized for size. I experimented with arduino to help figure out baseline power.

I was able to get 1uA system_off sleep and 15uA system_on idle with unmodified arduino. With modified arduino interrupt code I was able to get 3uA system_on. The code is posted here Getting lower power consumption on Seeed XIAO nRF52840. The topic also has links to other pages on nrf52 power optimization.

The board file I’m using is the default file that comes with zephyr: xiao_ble

I didn’t see that file originally and created my own, but lately I’ve been using the above.

I played around with this today. I verified with the debugger that the flash is put into deep sleep before the call to the main() entry point.

I don’t have another idea on what device to look at next. Maybe I’ll browse the various nrf52840 threads and see if I can find a case where someone changed power usage by 7uA.

7uA might not matter to most use cases, but I feel like I’ve been challenged with a quest. I’ll try a few more options before letting it drop.