How to drop clock frequency when entering low power mode and then increase when exiting low power mode?
Hi. I am working on a battery operated project using STM32L031 microcontroller. I am using 32 MHz clock for normal operation. But if I use same clock in low power mode then it consumes current of about 2.7mA. But for higher battery life, current consumption should be minimum. So I tried running controller at 2MHz and the current consumption was found to be around 350uA in low power mode.
So I was thinking of using 32MHz for normal operation and when entering low power mode, drop that clock frequency to 2 MHz. And when exiting low power mode, clock frequency should be again switched to 32MHz.
My UART (with DMA) is always active since whenever I receive data, I come out of low power mode. My baud rate is 115200 and hence I cant go below 2MHz clock frequency.
So how can I implement this operation of changing clock frequency from low to high and vice versa?
Regards,
noobmaster69