nRF52840 deep sleep mode?

I’m using XIAO nRF52840 BLE, and I’m tryin to get it into deep sleep by a button that will be pressed, mainly for decreasing battery consumption.
Is there a way to do it? I didn’t find something that works well and will be happy to get some help.

You can use the following line of code to go into sleep mode.


I would also recommend checking out the NRF52840 chip documentation so you can check out the other registers. Just remember to add a 1000 ms or so delay when powering it back on so it has time to wake up. If you need anything else, let me know! I hope it works well!

Oh it’s actually WORKS!
Thanks a lot!!
I have another question,
Is there a a way to wake it up back? 'cause once it goes through the NRF_POWER command it shuting down and I cant use it again until I disconnect it and reconnect.

I’d be interested in the answer also, My project needs to wake up about once per second, or by button press.

slightly off topic, may help OP also, but can the nRF52840 be underclocked? would this save more power?

I’m having the same trouble you are with waking it back up. In some of my sketches, I call the shutdown code within the loop and by the time it starts looping again, it wakes up. Other times it goes to sleep and can’t wake up. I’ve been looking for some alternate ways to go in a low power mode while still being able to monitor readings from the IMU, but I’m lost. Here’s the nRF52840 docs so you can have a look.

I’m not too sure about under-clocking or if it would save any power.