# Keep NRF52840 and its peripherals operating during sleep?

**URL:** <https://community.particle.io/t/keep-nrf52840-and-its-peripherals-operating-during-sleep/64678>\
**Category:** Edge Systems\
**Created:** [June 1, 2023, 6:18pm UTC](https://community.particle.io/t/keep-nrf52840-and-its-peripherals-operating-during-sleep/64678 "2023-06-01T18:18:41Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![nickB](https://avatars.discourse-cdn.com/v4/letter/n/f08c70/32.png) [@nickB](https://community.particle.io/u/nickB)\
**Post date:** [June 1, 2023, 6:18pm UTC](https://community.particle.io/t/keep-nrf52840-and-its-peripherals-operating-during-sleep/64678/1 "2023-06-01T18:18:41Z")

</div>

We are working on an application using T-SOM. Our application needs the T-SOM to continuously monitor two sensors, one on the I2C bus and one using the UART of the NRF52840, as well as the IMU onboard the T-SOM. Our power budget does not permit an always-on cellular connection!

Is it possible to (using the user firmware on the T-SOM) to get into a low power state (ideally under 1 mA) without relying on the sleep function that is configured through the web console?

---

<div class="post-metadata">

**Author:** ![rickkas7](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rickkas7/32/8681_2.png) [@rickkas7](https://community.particle.io/u/rickkas7)\
**Post date:** [June 1, 2023, 7:16pm UTC](https://community.particle.io/t/keep-nrf52840-and-its-peripherals-operating-during-sleep/64678/2 "2023-06-01T19:16:05Z")

</div>

There's no easy way to get to 1 mA, but with the nRF52 in normal operating mode, peripherals and cellular disabled, it's 3.38 mA. Add in a little for the IMU, you'll be under 4 mA, much less than with cellular on.

| Parameter | Symbol | Min | Typ | Peak | Unit |
| --- | --- | --- | --- | --- | --- |
| Operating Current (uC on, peripherals and radio disabled) | Iidle | 3.35 | 3.38 | 4.39 | mA |
| Operating Current (uC on, cellular connected but idle) | Icell\_cloud\_idle | 19.2 | 21.2 | 97.1 | mA |
| Operating Current (uC on, cellular connected and transmitting) | Icell\_cloud\_tx | 19.5 | 63.6 | 280 | mA |

Technically the nRF52 can operate in a mode where it microsleeps in sub-milliseconds increments, for example between transactions to poll your sensors, but there's no way to access that from Device OS.

---

<div class="post-metadata">

**Author:** ![nickB](https://avatars.discourse-cdn.com/v4/letter/n/f08c70/32.png) [@nickB](https://community.particle.io/u/nickB)\
**Post date:** [June 1, 2023, 8:15pm UTC](https://community.particle.io/t/keep-nrf52840-and-its-peripherals-operating-during-sleep/64678/3 "2023-06-01T20:15:28Z")

</div>

4 mA is not too bad, especially because by "continuously" I mean "at least once every five seconds". How would I modify the tracker source code to keep the I2C and usart peripheral on?

---

<div class="post-metadata">

**Author:** ![rickkas7](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rickkas7/32/8681_2.png) [@rickkas7](https://community.particle.io/u/rickkas7)\
**Post date:** [June 1, 2023, 8:37pm UTC](https://community.particle.io/t/keep-nrf52840-and-its-peripherals-operating-during-sleep/64678/4 "2023-06-01T20:37:57Z")

</div>

Even in normal operating state with cellular off you'll be under 5 mA. It will probably mostly be making sure both cellular and CAN are turned off.

In other words, the all peripherals off measurement is just a contrived state for testing purposes; Tracker Edge is not ever in that state normally.

---

<div class="post-metadata">

**Author:** ![nickB](https://avatars.discourse-cdn.com/v4/letter/n/f08c70/32.png) [@nickB](https://community.particle.io/u/nickB)\
**Post date:** [June 1, 2023, 8:39pm UTC](https://community.particle.io/t/keep-nrf52840-and-its-peripherals-operating-during-sleep/64678/5 "2023-06-01T20:39:25Z")

</div>

So would the right approach be to disable sleep in the web console for my project, then manually handle turning the cell modem on and off on my end?

---

<div class="post-metadata">

**Author:** ![rickkas7](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rickkas7/32/8681_2.png) [@rickkas7](https://community.particle.io/u/rickkas7)\
**Post date:** [June 1, 2023, 8:41pm UTC](https://community.particle.io/t/keep-nrf52840-and-its-peripherals-operating-during-sleep/64678/6 "2023-06-01T20:41:44Z")

</div>

Correct

---

<div class="post-metadata">

**Author:** ![nickB](https://avatars.discourse-cdn.com/v4/letter/n/f08c70/32.png) [@nickB](https://community.particle.io/u/nickB)\
**Post date:** [June 1, 2023, 10:20pm UTC](https://community.particle.io/t/keep-nrf52840-and-its-peripherals-operating-during-sleep/64678/7 "2023-06-01T22:20:40Z")

</div>

Is there an app note or example of how to do that properly, ideally while allowing the Tracker software to continue to provide motion, GNSS, state of charge, etc?

---

<div class="post-metadata">

**Author:** ![nickB](https://avatars.discourse-cdn.com/v4/letter/n/f08c70/32.png) [@nickB](https://community.particle.io/u/nickB)\
**Post date:** [June 2, 2023, 2:09pm UTC](https://community.particle.io/t/keep-nrf52840-and-its-peripherals-operating-during-sleep/64678/8 "2023-06-02T14:09:34Z")

</div>

I've figured out how to put the Tracker into a low power (300-400 uA) state that can wake from time or IMU events, but now I am trying to prevent the Tracker from reconnecting to the cell network when it wakes. Any advice?

---

<div class="post-metadata">

**Author:** ![gusgonnet](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/gusgonnet/32/27491_2.png) [@gusgonnet](https://community.particle.io/u/gusgonnet)\
**Post date:** [June 2, 2023, 2:17pm UTC](https://community.particle.io/t/keep-nrf52840-and-its-peripherals-operating-during-sleep/64678/9 "2023-06-02T14:17:46Z")

</div>

Hi, do you see this line in setup()?

> Particle.connect();

if so, you can control the connection by controlling when your fw executes it.

You should also have this line outside setup() and loop() (usually at the top, under the #include statements):

> SYSTEM\_MODE(SEMI\_AUTOMATIC);

Does that help?
