P1 Sleep Current Consumption Not Matching Datasheet

I’m running v0.7.0 of the Device OS and recently uncovered some very interesting behavior in my product. My product is battery powered and relies heavily on sleep modes. However, due to the deep sleep issue that is still pending resolution I can’t always use the deep sleep option. Specifically, I can’t go into deep sleep while my device is charging because the WKP is high. In this scenario I go into normal sleep instead. While in deep sleep my product draws about 60uA from the battery which is great. Better than listed in the P1 datasheet (likely because of mis-documentation). When my device goes into stop-mode sleep, however, the current consumption is 72mA which is about 70x the datasheet figure of 1-2mA. “Maybe I need to manually shut off WiFi before I go to sleep” I thought. Well, that made it worse sending my sleep current up to 128mA. :man_shrugging:

Finally I tossed out all of my product code and got back to a simple sketch that would just go to sleep in the setup() function. I found that the only way to get the stated sleep current was to comment out SYSTEM_MODE(MANUAL). When I did that I measured stop-mode sleep at 800uA which is exactly what I expect.

My question then is this. Is there some manual code I need to add before going into stop-mode sleep on the P1 if I intend to use SYSTEM_MODE(MANUAL) as well as SYSTEM_THREAD(ENABLED)? I found Electron SLEEP_MODE_DEEP tips and examples which discusses a similar problem on the Electron but the reason seems to be in how the modem works. Is there a similar issue/workaround possible on the P1? If so, where is this documented so I can use it?

The closest I could find for the P1 was Sleep mode explained using code samples but none of the examples use manual system mode.

See answer to parallel post

Ok closing the loop on this. Hopefully this can save somebody else some troubleshooting time. I have some connected peripherals in my product that draw a non-zero amount of quiescent current once the pins are initialized. In deep sleep on the P1 the pins return to a floating state so they essentially disconnect from my peripherals and don’t draw any current. In stop-mode sleep, however, that is not the case so my peripherals continued to draw current. The fix was to do the following before entering stop-mode sleep:

  1. Turn off the Wifi module ( I found it is unnecessary to disconnect first)
  2. Return any peripheral GPIO pins to inputs.

After these two tweaks my product’s stop-mode sleep current is 800uA as expected.

My original test was “tainted” with some of my product code so I no longer have any reason to believe this is related to SYSTEM_MODE(MANUAL) so I will try to rename the topic to clear any confusion. That said, I did see that automatic mode will turn off the Wifi for you before going to sleep so step 1 above is essential to get the lowest stop-mode sleep current.