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

High Current Draw With Floating Point Calculation

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?

Related