Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to manage power consumption when working with peripheral_hr sample on NRF52832 #32070

Closed
selman-nus opened this issue Feb 8, 2021 · 10 comments

Comments

@selman-nus
Copy link

Hi,
I am using a modified version of the peripheral_hr example to sample ADC values and send it to a mobile phone using BLE (100Hz).
NRF52832 is using 3mA on average and I couldn't figure out how to reduce this. I checked several issue posts here and I guess current consumption should be less than 1 mA?

Is there a power management function that I can use to reduce power consumption?
(Maybe to reduce CPU frequency or to turn off unused blocks of the MCU?)

My modified code:
https://pastebin.com/Z1KHcXwV

These are the issues that I have seen:
#30304 (comment)
#31989 (comment)

@cvinayak
Copy link
Contributor

cvinayak commented Feb 8, 2021

Why do you use NRFX_DELAY_US ? This will not put the CPU to sleep. Revert back to using k_sleep.

@selman-nus
Copy link
Author

selman-nus commented Feb 8, 2021 via email

@pabigot
Copy link
Collaborator

pabigot commented Feb 8, 2021

k_sleep(K_MSEC(10));

@selman-nus
Copy link
Author

It turns out I had board related issues too. (EBSHSNZWZ - taiyo yuden)

  1. I separated the power line of NRF52 from the FTDI chip already but I didn't know I also had to cut rx/tx etc. It reduced most of the consumption by itself already.

  2. Then I changed NRFX_DELAY_US to k_sleep. It also helped a lot. I didn't expect NRF could transmit the packet that fast and go to sleep.

Below is the final current consumption while transmitting ADC data (1.8v).

Please advise me if there are other ways to reduce the consumption even more. One thing that comes to my mind is reducing the Tx power of BLE to the lowest dBm level.
Any other suggestions? I am pushing the limits here :)

image

In case the image is not visible:
average: 562uA
max: 9.3mA

@cvinayak
Copy link
Contributor

I see you idle current is higher, ~300 uA, ADC when in use should use 700uA, but otherwise when no other peripheral is in use your idle current should drop down < 10uA. Check for your idle current with your application running but with BLE and ADC code disabled.

@pabigot
Copy link
Collaborator

pabigot commented Feb 10, 2021

Also confirm whether you're measuring just the MCU, or the power consumed by the entire board. Unless the PCB is optimized for power consumption 300 uA as a minimum might be all you can expect. See what you get on an application that does nothing but go to sleep.

@selman-nus
Copy link
Author

Thank you for your suggestions. I did the following:

1- Change the board to nRF52 dev kit since it seems more reliable for power measurements.
2- Test the same code (ADC and BLE). Exact same current consumption.
3- Open hello_world example and measure the consumption. Result was 300uA. Still not below 10uA.
4- Delete printk functions and add k_sleep to enable low power state. Still same, 300uA.
5- Enable several power management configs:

CONFIG_DEVICE_POWER_MANAGEMENT
CONFIG_SYS_POWER_MANAGEMENT

and result is still same. 300uA.

My main file looks like this now:

#include <zephyr.h>
//#include <sys/printk.h>

void main(void)
{
	//printk("Hello World! %s\n", CONFIG_BOARD);
          k_sleep(K_SECONDS(5));
}

So I don't know what else to try to get that 10uA as @cvinayak advised. I am eager to listen to your suggestions?
.
.
.

Here is the result from the power profiler:
(All measurements are done on nRF52 dev kit and I am using SEGGER Studio with nRF Connect SDK which is executed by nRF toolchain manager)

image

@pabigot
Copy link
Collaborator

pabigot commented Feb 11, 2021

Set CONFIG_SERIAL=n. The 300uA is probably the UART peripheral being enabled.

@selman-nus
Copy link
Author

FInally! Haha thank you. This solves the problem.
The average is less than 3uA now.

Here is the final measurement on nRF52 dk

image

@pabigot
Copy link
Collaborator

pabigot commented Feb 11, 2021

Great! I'm intending to provide more information on power measurement and management in the samples/boards/nrf/system_off example. That already notes the need to disable UART, but it could probably be made more clear.

@pabigot pabigot closed this as completed Feb 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants