Can't put NRF52 Feather board into Low Power mode

For Adafruit customers who seek help with microcontrollers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
dennis1a4
 
Posts: 6
Joined: Thu Apr 05, 2018 4:20 pm

Re: Can't put NRF52 Feather board into Low Power mode

Post by dennis1a4 »

Any chance you could push these updates to the design files on GItHub? https://github.com/adafruit/Adafruit-nR ... eather-PCB

User avatar
vegarwe
 
Posts: 5
Joined: Tue Jan 09, 2018 12:45 am

Re: Can't put NRF52 Feather board into Low Power mode

Post by vegarwe »

I've gotten updated boards now and ran the same test as I did in January with the previous boards. I have a FW that goes into a sort of stand by mode where it leaves the RTC running to track time, the RAM powered and it samples the battery voltage every to seconds to see if it's being charged (in which case I want to exit standby).

The numbers are quite good, I see an average draw of about 138uA draw (sampling over several minutes using ee203 power meter). The same code on a highly power optimised wearable board runs at 70uA (measured using the same tools and with the same FW).

User avatar
_Joost_
 
Posts: 11
Joined: Sat Sep 22, 2018 1:57 am

Re: Can't put NRF52 Feather board into Low Power mode

Post by _Joost_ »

Hi vegarwe,

that sounds pretty cool! I'm trying to get below 0.79mA with the nRF52 Feather; would you mind posting a short code example of your optimisations?
There are a couple of threads and issues on this topic; as far as I can see your numbers are the best/lowest so far so it would surely be interesting to others as well!

Thanks and best regards,

Joost

User avatar
vegarwe
 
Posts: 5
Joined: Tue Jan 09, 2018 12:45 am

Re: Can't put NRF52 Feather board into Low Power mode

Post by vegarwe »

_Joost_ wrote:I'm trying to get below 0.79mA with the nRF52 Feather; would you mind posting a short code example of your optimisations?
The FW I was running isn't really something I can post. Also, it wouldn't be very useful as it doesn't do almost anything. It turns off everything non-essential, including the radio. The point of that FW is to look for leak currents, by trying to get the power consumption as low as possible short of turning off the entire device.

One caveat, I don't run Arduino or Newt or any other RTOS. I buy the Newt because I want the SWD 0.05" Pitch Connector. And I use the SEGGER J-Link EDU Mini because it's a sweet, cheap little debugger. And I usually start with a code example from Nordic Semiconductor.

Tried just now compiling and flashing the ble_app_blinky example from the Nordic Semiconductor SDK. I turned off all the LED's and disabled the UART logging ("#define NRF_LOG_ENABLED 0"). Running that example without any other optimisation and I get about 0.165mA while keeping a BLE connection.

That's the kind of numbers you should expect. Add a sensor to that for another 0.2mA and you should still be way below 0.79mA.

User avatar
wb8wka
 
Posts: 48
Joined: Fri Sep 21, 2018 5:09 pm

Re: Can't put NRF52 Feather board into Low Power mode

Post by wb8wka »

hathach wrote:We are still working on low power code and guide to how achieve it, so stay tuned.
Hi, did the above ever happen? If not, a quick example using Adafruits example "beacon" could would be very welcome. It's currently idling at about 940ua.

User avatar
wb8wka
 
Posts: 48
Joined: Fri Sep 21, 2018 5:09 pm

Re: Can't put NRF52 Feather board into Low Power mode

Post by wb8wka »

Bump

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: Can't put NRF52 Feather board into Low Power mode

Post by adafruit_support_mike »

For low-power applications, we strongly suggest using a strobed power approach, controlled by a timer like the TPL5110:

https://www.adafruit.com/product/3435

If you disable the power-on LED, it uses less than 100nA while idle. That's at least a couple orders of magnitude better than anything you're likely to get from a microcontroller. It also eliminates leakage currents through the rest of the components, which are a major source of loss in low-power systems.

User avatar
wb8wka
 
Posts: 48
Joined: Fri Sep 21, 2018 5:09 pm

Re: Can't put NRF52 Feather board into Low Power mode

Post by wb8wka »

That seems like a kludge. Does the native nordic NRF52 code require this? Even a PIC I can put to sleep (low power mode) and wakeup without resorting to outside circuits. I have to think such is possible on the NRF52.

User avatar
hathach
 
Posts: 1271
Joined: Tue Apr 23, 2013 1:02 am

Re: Can't put NRF52 Feather board into Low Power mode

Post by hathach »

I still haven't found time to work on this yet. Will do some time later on

User avatar
wb8wka
 
Posts: 48
Joined: Fri Sep 21, 2018 5:09 pm

Re: Can't put NRF52 Feather board into Low Power mode

Post by wb8wka »

hathach wrote:I still haven't found time to work on this yet. Will do some time later on
A quick hint, or direction might help. Trying to decide if I need to dump the arduino implementation and goto native NRF52 as another user did a few months back. Please see my other post on this topic as well. I'm not the only one asking about this and not having this kinda defeats the biggest advantage of BLE (coin cell operation etc)

User avatar
hathach
 
Posts: 1271
Joined: Tue Apr 23, 2013 1:02 am

Re: Can't put NRF52 Feather board into Low Power mode

Post by hathach »

There is lots of hint in this topic and github issue, please try to follow those.

User avatar
wb8wka
 
Posts: 48
Joined: Fri Sep 21, 2018 5:09 pm

Re: Can't put NRF52 Feather board into Low Power mode

Post by wb8wka »

I saw them but I'm still a newbie. Also nobody seemed to have actually solved the issue. Had hoped after this long an example might be forthcoming. Your beacon program seems to me to be the idle one to implement it on.

User avatar
wb8wka
 
Posts: 48
Joined: Fri Sep 21, 2018 5:09 pm

Re: Can't put NRF52 Feather board into Low Power mode

Post by wb8wka »

Here is what I am trying to do and seeing in another thread:

viewtopic.php?f=57&t=145605

So what would AdaFruit charge me to convert the example beacon code to be low power and meet the Nordic power consumption specs? (less any of the known leakage currents) If the arduino code base isn't up to the task (which I strongly suspect after looking over all the posts and GitHub) I can move to the native Nordic environment. Just hoping to stay with Arduino.

User avatar
vegarwe
 
Posts: 5
Joined: Tue Jan 09, 2018 12:45 am

Re: Can't put NRF52 Feather board into Low Power mode

Post by vegarwe »

wb8wka wrote:
hathach wrote:We are still working on low power code and guide to how achieve it, so stay tuned.
Hi, did the above ever happen? If not, a quick example using Adafruits example "beacon" could would be very welcome. It's currently idling at about 940ua.
For me it always seemed smarter to go straight for the nRF52 SDK rather than dealing with the Arduino framework on top. But spent a few hours tinkering and got some results. I started with the beacon example and did some very small modifications (took some time to figure out which where significant):

Code: Select all

$ diff beacon.ino beacon_power_saver.ino
59,60c59,60
<   // Suspend Loop() to save power, since we didn't have any code there
<   suspendLoop();
---
>   Serial.end();
>   sd_power_mode_set(NRF_POWER_MODE_LOWPWR);
85c85
<   Bluefruit.Advertising.setInterval(160, 160);    // in unit of 0.625 ms
---
>   Bluefruit.Advertising.setInterval(200, 400);    // in unit of 0.625 ms
92c92
<   // loop is already suspended, CPU will not run loop() at all
---
>   waitForEvent();
First of all, the comment "Suspend Loop() to save power" is just wrong. I didn't look into what suspendLoop does, but it certainly doesn't save power. Also, turning off the Serial port helped. I tried to figure out exactly why. So the uart peripheral on nRF52 (if left on) will not release the high frequency clock (HF_CLK) which uses A LOT of power. So there is no way you'll get low numbers with that thing on. But from the source code it looked like someone implemented a SoftwareSerial which doesn't make sense to me. Anyway, end()'ing it did help.

Then turning down the advertisement interval slightly (from 100ms pr adv packet to 125ms) does help. This can be turned down more, but that does affect the connection setup time.

And finally we do need to call waitForEvent in the loop, to turn the CPU off while nothing is happening.

With these changes (in my local setup) I dropped from 1.013mA to 0.417mA (which is significant in my book). Now that is still high compared to running without the Arduino stuff (I get somewhere around 0.210mA for a similar setup). Now, at some point I had power_mode_set inside the loop() instead of at the end of setup() and that gave a significant higher amp usage (more than 50uA extra), which tells me that the loop is called awfully often. I think this is due to the RTOS in the Arduino framework which I know next to nothing about. But I'm sure it's possible to get it to be less aggressive, which should drop the numbers down below 0.400mA total.

To get even lower would require more investigation/trial-and-measure. There might be some pins that should/should-not be floating. Or maybe some other tuning can be done.

Btw @hathach: Love your 40 series Land Cruiser avatar!

User avatar
wb8wka
 
Posts: 48
Joined: Fri Sep 21, 2018 5:09 pm

Re: Can't put NRF52 Feather board into Low Power mode

Post by wb8wka »

First of all, thank you for the examples, they got immediate results!
vegarwe wrote:
For me it always seemed smarter to go straight for the nRF52 SDK rather than dealing with the Arduino framework on top.
Yes, that is what I was trying to decide at this point. I'll keep trying as there are some advantages to staying with Arduino for this project.
With these changes (in my local setup) I dropped from 1.013mA to 0.417mA (which is significant in my book). Now that is still high compared to running without the Arduino stuff (I get somewhere around 0.210mA for a similar setup).
Just going with your changes, I went from 940ua to 319.2 ua average current. That with the 100ms beacon. With 125ms (your code verbatim) I'm at 297.1ua on the NRF52 feather board. As I mentioned in the other thread I'm using a Agilent U1241B with a uCurrent gold.

On a test board I laid out with a SHT31 temp/humidity sensor (no USB, optimized pullups, no regulator), I'm seeing about 100ua average with your beacon code.

Still a ways to go and I just had time tonight to briefly try things but good progress. My next challenge is to graft the SHT31 code back in.

Thanks again!

Locked
Please be positive and constructive with your questions and comments.

Return to “Microcontrollers”