0

Can't put NRF52 Feather board into Low Power mode
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

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

by hathach on Thu Jan 03, 2019 9:50 pm

@vegarwe thanks for detail posts. The beacon example is written before other power improvement, there is no surprise if some of it is outdated. For waitForEvent(), it is discussed in the github issue. It is advisable to do so when you have nothing to do. That will cause cpu to sleep until the next tick event of freeRTOS (1 ms) or other hw/ble event. To put cpu into sleep mode more than freeRTOS tick (1ms), you should use delay() which will sleep as long as the delay ( freeRTOS tickless mode).

Thanks for the avatar comment, I don't own an 40 series LC, but 100 series. Though the 40 look much nicer in the picture :)

hathach
 
Posts: 838
Joined: Tue Apr 23, 2013 1:02 am

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

by wb8wka on Sun Jan 06, 2019 3:52 am

Well for completeness here is the before and after, you can see the 1ms RTOS ticks in the later. This is the stock beacon code with 100ms beacon time, before and after the power mods. I'm using a uCurrent gold with 1mv per uA on the vertical scale. Any thoughts if things can get lower then this? I'll replace the regulator with some that has lower quiescent current.

20msdiv_Devboard_before.png
200mv/20ms div, stock beacon code
20msdiv_Devboard_before.png (42.12 KiB) Viewed 131 times

200mv/20ms div, stock beacon code, avg current 976ua

20msdiv_Devboard_after.png
200mv/20ms div, power saved beacon code
20msdiv_Devboard_after.png (96.98 KiB) Viewed 131 times

200mv/20ms div, power saved beacon code, avg current 343 ua

2msdiv_Devboard_after.png
200mv/2ms div, power saved beacon code
2msdiv_Devboard_after.png (51.33 KiB) Viewed 131 times

200mv/20ms div, power saved beacon code

wb8wka
 
Posts: 26
Joined: Fri Sep 21, 2018 5:09 pm

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

by wb8wka on Sat Jan 12, 2019 6:02 am

hathach wrote: For waitForEvent(), it is discussed in the github issue. It is advisable to do so when you have nothing to do. That will cause cpu to sleep until the next tick event of freeRTOS (1 ms) or other hw/ble event. To put cpu into sleep mode more than freeRTOS tick (1ms), you should use delay() which will sleep as long as the delay ( freeRTOS tickless mode).

@hathach

Greetings. Per your suggestion I removed waitForEvent(); and instead inserted delay() using 10, 100 or 1000 values. The current goes from ~70ua up to around ~410ua and it appears to now be waking up every ~20usec. Instead of going to sleep it appears to be just going into a blocking mode. I'm using the beacon code as modified by vegarwe with my own board here (no USB serial) with the BLE beacon at 1000ms.

Was there a include or define I may have missed? I see the delay() being mentioned by others so I'm at a loss here at the point. Any suggestions welcome.

wb8wka
 
Posts: 26
Joined: Fri Sep 21, 2018 5:09 pm

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

by wb8wka on Sat Jan 12, 2019 5:46 pm

@hathach

One other comment, I did check FreeRTOSConfig.h and

#define configUSE_TICKLESS_IDLE 1

is set to 1

wb8wka
 
Posts: 26
Joined: Fri Sep 21, 2018 5:09 pm

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

by wb8wka on Sat Jan 12, 2019 5:59 pm

vegarwe wrote: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.


I added:

sd_power_dcdc_mode_set(NRF_POWER_DCDC_ENABLE);

to your example code and saved another ~10ua. I'm using the uCurrent gold with the averaging mode of a FLUKE 179

I'm hoping someone can chime in regarding waitForEvent() vs. delay() which is supposed to cut things even more... but I got sizable increase when I used delay instead of waitFor Event (see my post a few up).

wb8wka
 
Posts: 26
Joined: Fri Sep 21, 2018 5:09 pm

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

by elangel on Wed Jan 16, 2019 5:25 am

some Measurements with my NRF52832 module:

void loop()
{
// some other stuff to do...
sd_power_mode_set(NRF_POWER_MODE_LOWPWR);
waitForEvent();
}

i get arround 7µA current consumption (BLE advertising). This is the same value when i used RedBear Lib.
Settings:
2 sec advertise interval
4HZ RTOS Tick Rate (cant get lower)
no LED, no Serial, No I2C, No GPIOs

with delay(1000) in loop() i get arround 2000µA!
suspendLoop() i get arround 1000µA!

elangel
 
Posts: 1
Joined: Mon Jan 14, 2019 7:57 am

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

by 42volts on Sat Jan 19, 2019 12:03 pm

hathach wrote:It is not a low power library, just a few helper functions such as systemOff(). It is more about software discipline, and how you write/design your code. We only test out and provide a how-to guideline that we think could save most of power. We are waiting for next revision board to test out the code and number. However, we are currently focusing on the nrf52840 board. So it may takes some time.

For your use case, if it is ok for nrf52 to reboot, re-advertise and re-connect then go with system off (deep sleep). Otherwise, you may only want it sleep and wake up to keep the connection active. Most of peripherals, if you don't use it at all, it default to power down along with the cpu. Though please check the Nordic specs to be sure.


So now that the 840s are in people's hands, can you give a hint about where you are with respect to power management on it? When following all the tricks to get the 832 into reasonably low power (I'm seeing that some have gotten to around 300 uA), I'm seeing at best 620 uA on the 840 when powered by BAT, 800 uA when powered by USB, and confusingly, all the way up at 1000 uA when powered by 3V. From what I understand, the 840 should be more power efficient that the 832, but I'm seeing it use double the power.

42volts
 
Posts: 1
Joined: Sat Jan 19, 2019 11:20 am

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

by hathach on Mon Jan 21, 2019 2:25 am

There is still lots of following up work to complete the features for both 840 and BLE5. The API will probably change quite a lot in up coming release. Focusing on low power require stable API and a few weeks of work fine-tuning. There already lots of hints and the power consumed is good enough already, please follow those in discussion, if you figure out anything please let us and other here know.

hathach
 
Posts: 838
Joined: Tue Apr 23, 2013 1:02 am

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

by wb8wka on Tue Jan 22, 2019 8:40 pm

hathach wrote:There already lots of hints and the power consumed is good enough already, please follow those in discussion, if you figure out anything please let us and other here know.


i do and others have. I'm quite thankful for that. I do wish however Adafruit would take a bigger role here and followup on some of the questions.... sometimes 'hints' aren't enough. This question I'd like a answer on relative to the hint you gave on delays and power savings I couldn't duplicate.

viewtopic.php?f=57&t=146147

Also the one last night if you know how to identify the bootloaders. I have two identical boards, with different bootloaders. The newest bootloader with identical code draws more then double the current compared to a board with a older bootloader. If I knew how to ID the bootloader it might be useful information for a github issue.

viewtopic.php?f=57&t=146537

Sorry to not be entirely positive , but I've gotten current consumption on the beacon code down to 5ua on my board but need to wrap up a few things to make sure I can duplicate things... as well as do something useful (I need to read a SHT31 sensor). I'm happy to make up a sheet in more detail. But your knowledge here is invaluable.

wb8wka
 
Posts: 26
Joined: Fri Sep 21, 2018 5:09 pm

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

by hathach on Wed Jan 23, 2019 1:59 am

low power requires a few weeks of works to get it right, last time it took me ~ a month. Furthermore, the API is changing to adopt new SD features. If you find anything useful, please post it here, the next time I work on this I do re-read every post in this topic. I told all I know already, I couldn't provide anything more without actually working/analyzing it with the hw, which I don't have time now.

hathach
 
Posts: 838
Joined: Tue Apr 23, 2013 1:02 am

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

by wb8wka on Wed Jan 23, 2019 3:39 am

hathach wrote:low power requires a few weeks of works to get it right, last time it took me ~ a month. Furthermore, the API is changing to adopt new SD features. If you find anything useful, please post it here, the next time I work on this I do re-read every post in this topic. I told all I know already, I couldn't provide anything more without actually working/analyzing it with the hw, which I don't have time now.


Note I said 'Adafruit', and I said it because they are referring customers here for support. I know 10 months ago in this thread there was mention of a soon to be produced low power guide. Adafruit obviously needs to get you some help.

In the meantime, are you aware of a way to determine what version of bootloader is in a particular NRF52? I may have discovered a power bug in one of them.

wb8wka
 
Posts: 26
Joined: Fri Sep 21, 2018 5:09 pm

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

by hathach on Wed Jan 23, 2019 4:28 am

Either you said 'Adafruit' or me is the same, arduino core for nrf52 is not the only repo we are working on. If you are not happy with the current code, just grab the sdk, there is a whole team of Nordic developer support that. I don't want to get into a fight, please be patient and excellent to others.

For bootloader version, put feather into OTA mode, the BLE DIS should give the correct bootloader version. If you are sure it is bootloader bug, please file an issue here https://github.com/adafruit/Adafruit_nRF52_Bootloader

hathach
 
Posts: 838
Joined: Tue Apr 23, 2013 1:02 am

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

by wb8wka on Wed Jan 23, 2019 4:44 am

hathach wrote:Either you said 'Adafruit' or me is the same, arduino core for nrf52 is not the only repo we are working on. If you are not happy with the current code, just grab the sdk, there is a whole team of Nordic developer support that. I don't want to get into a fight, please be patient and excellent to others.


I don't either, just making an observation. It's obvious your plate is full and I savor your responses. I went with the AdaFruit Feather because I wanted an arduino platform for what I am working on so going with the nordic SDK would be counterproductive and I wanted to avoid that. BTW, I've already mentioned once if I could pay you for support, I'm still interested so get with me if so.

For bootloader version, put feather into OTA mode, the BLE DIS should give the correct bootloader version. If you are sure it is bootloader bug, please file an issue here https://github.com/adafruit/Adafruit_nRF52_Bootloader


That was the plan and if I can confirm what I am seeing, will do

Thank you for everything you do. I am planning on condensing all I've found so far with low power operations, I was just trying to close the loop on a few open issues. Most of the hints I've been able to flesh out, a few like the delay() hint you gave above I've not been able to. Give that a look if you could.

wb8wka
 
Posts: 26
Joined: Fri Sep 21, 2018 5:09 pm

Please be positive and constructive with your questions and comments.