2025-06-27 1:15 PM
I have an application in which I'm required to check the status of an accelerometer 5000 times per second but it's a battery powered device so I want to minimize power consumption. I'm using an STM32L053C8 on a custom board with an external LSE crystal but I think that this would be a problem with any STM32.
I've tried setting up LPTIM clocked from the LSE source to generate interrupts and then putting the MCU into stop mode. The problem is that you can only generate frequencies which are an integer fraction of the LSE frequency so 32768/6 = 5461 Hz which is too fast for my application. 32768/7 = 4681 Hz is too slow.
Using the RTC clocked by the LSE is even more restrictive. The best that I can see would be an integer fraction of 16384 Hz.
The regular timers TIM2, TIM6 etc don't work in stop mode.
Am I missing something ?
Solved! Go to Solution.
2025-06-27 3:14 PM
HSI16 can be kept on in stop mode by setting HSI16KERON.
HSE can't be used, missed that.
2025-06-27 1:38 PM
Clock LPTIM using HSI16 or HSE.
2025-06-27 2:47 PM
Is it possible to keep HSE or HSI running in stop mode ? I don't think so.
Alternatively, is there another way to minimize power consumption ?
2025-06-27 3:14 PM
HSI16 can be kept on in stop mode by setting HSI16KERON.
HSE can't be used, missed that.
2025-06-27 4:58 PM
Sadly this doesn't seem to work. It looks as though when configured this way LPTIM still stops upon entering stop mode. The data sheet says:
"The low-power timer has an independent clock and is running also in Stop mode if it is clocked by LSE, LSI or an external clock."
So not when clocked by HSI ?