Reducing power. (STM32F072)
Posted: Sun Feb 26, 2017 9:49 am
I've been making an application and when it goes "off" it keeps on dissipating 30mA from the powersupply (12V).
The bulk of that goes through two linear regulators to the 3.3V input on the CPU. I would like to aim for less than 10mA. Not an ambitious target I'd say....
So because everybody says that you only enable peripherals that you need to save power, when there was nothing to do, I started disabling peripherals, but that didn't help much.
Looking at the STM32F072 datasheet (page 56 and following on my version), I see that "with all peripherals enabled" I should expect about 27mA at 48MHz, and something like 15mA with all peripherals disabled. So even when I disable ALL peripherals, that wouldn't be enough to hit my target. On the other hand, reducing the clock frequency to 1MHz WOULD do the trick, even much better than my not-so-ambitious target.
Looking at the table a bit more, leads me to think that maybe running at 1MHz off the internal oscilator is not possible. Then I'll have to settle for 8Mhz.
So... I would just mess with the RCC clock registers and select a 1MHz clock. Chibios just goes in "slowmotion" and I need to make my "check the buttons" task run about 50 times more often. (i.e. sleep for 2 ticks instead of 100).
Oh... My board has an USB connection. In the field nobody will be using it. I'm just using it for debugging and uploading firmware. If USB stops working in "off" mode, that's fine with me. Is the USB low level task maybe going to go bonkers and hog all of my CPU time?
Oh... As the core clock frequency has such a marked effect, I would have expected that enabling WFI has a significant effect. (according to the datasheet, this turns the core clock OFF). This appears to be not the case. Is this normal? Or maybe I have a "always runnable" task (unintentional). So how would I debug that? How do I find what task keeps my CPU active?
Any objections to this approach?
The bulk of that goes through two linear regulators to the 3.3V input on the CPU. I would like to aim for less than 10mA. Not an ambitious target I'd say....
So because everybody says that you only enable peripherals that you need to save power, when there was nothing to do, I started disabling peripherals, but that didn't help much.
Looking at the STM32F072 datasheet (page 56 and following on my version), I see that "with all peripherals enabled" I should expect about 27mA at 48MHz, and something like 15mA with all peripherals disabled. So even when I disable ALL peripherals, that wouldn't be enough to hit my target. On the other hand, reducing the clock frequency to 1MHz WOULD do the trick, even much better than my not-so-ambitious target.
Looking at the table a bit more, leads me to think that maybe running at 1MHz off the internal oscilator is not possible. Then I'll have to settle for 8Mhz.
So... I would just mess with the RCC clock registers and select a 1MHz clock. Chibios just goes in "slowmotion" and I need to make my "check the buttons" task run about 50 times more often. (i.e. sleep for 2 ticks instead of 100).
Oh... My board has an USB connection. In the field nobody will be using it. I'm just using it for debugging and uploading firmware. If USB stops working in "off" mode, that's fine with me. Is the USB low level task maybe going to go bonkers and hog all of my CPU time?
Oh... As the core clock frequency has such a marked effect, I would have expected that enabling WFI has a significant effect. (according to the datasheet, this turns the core clock OFF). This appears to be not the case. Is this normal? Or maybe I have a "always runnable" task (unintentional). So how would I debug that? How do I find what task keeps my CPU active?
Any objections to this approach?