High Current Draw With Floating Point Calculation

kenclark gravatar image

asked 2017-07-17 16:29:07 +0200

I'm attempting to optimize our application for battery life on the nrf52832.

If I execute a floating point calculation to rescale RGB to PWM, I start drawing 6.2mA, eliminating the calculation reduces current to an more reasonable 0.05mA. To be clear I am not using the calculation result to drive the PWM yet, just making the calculation & saving the result globally

volatile uint16_t blue_cmd; void rgb2pwm(uint8_t blue) { float blue_duty_cycle = (float)(blue)/2.55f; blue_cmd = (uint16_t)blue_duty_cycle; }

Is there something that needs to be done to minimize power for floating point calculations?

edit retag flag offensive close delete report spam

1 answer

Sort by » oldest newest most voted
joh2 gravatar image

answered 2017-07-17 17:04:18 +0200


Make sure you have implemented the workaround for PAN-87 - CPU: Unexpected wake from System ON Idle when using FPU.

Best regards,


edit flag offensive delete publish link more


That fixed the issue. Thank-you ken

Ken ( 2017-07-17 21:35:58 +0200 )editconvert to answer

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer. Do not ask a new question or reply to an answer here.

[hide preview]

Question Tools

1 follower


Asked: 2017-07-17 16:29:07 +0200

Seen: 53 times

Last updated: Jul 17