This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Is the PWM Library A Piece

The pwm library seems to add 10KB worth of code to my program. Alot of it probably comes from the nrf_drivers that are used, but still 10KB. While enabled it seems to pull a rather incredible amount of power. After disabling it continues to pull a ton of power.

Is it a piece?

  • Hi Lucas

    What do you mean exactly with "piece"? PWM is a power consuming operation because it requires TIMER peripheral and 16MHz clock source to be constantly enabled. That together consumes at least 1mA. This is improved for nRF52 which has dedicated PWM hardware, see August 10th comments on this thread.

    Yes, the pwm in the SDK has a considerable footprint of 8kB in ROM. If you select level 3 optimization in Keil you can compress it to ~6kB it seems. This PWM library has somewhat lower footprint however.

    Update 17.8.2015 I do not have very exact numbers for the current consumption for generating PWM with the nRF52832. What the nRF52832 OPS says is that the PWM module itself consumes 200uA and it will additionally need 16MHz clock and regulator in order to operate. The internal high frequency oscillator is specified to consume 55uA and the regulator consumes also some uA. So best estimate now is perhaps around 300uA. We will find out when the PWM hardware is available with the nRF52832 engineering release.

    Update 2 17.8.2015 The current consumption of 200uA of the nRF52832 PWM module is pessimistic and is for the use case when the PWM duty cycle is updated very frequently. If the duty cycle is not updated frequently, the PWM module will consume somewhat less current.

  • Just something we say around the office in times of frustration. It seems the behavior I am seeing is expected. We are using GCC -O3 so that probably explains the code size differences from keil. We have an nrf52 board but haven't had a ton of time to develop as we are trying to close out our current design with the nrf51. As I understand, the nrf52 will have a true PWM module. What kinds of power reduction can we expect? I am trying to figure out if we need to incorporate external hardware to address LED dimming.

Related