I've created a PCB with an STM32L4x6 microcontroller and several peripherals, mainly I2C. I want to sample data at 512Hz using the internal ADC. The original plan was to configure the ADC with DMA and a timer, I'd put the MCU into other low-power states and wake up to DMA interrupt. However, I've encountered a problem in implementing this. Using 'Sleep' mode with RTC wake-up works, but power consumption decrease only with ~300uA, which is not ideal. The 'STOPX' mode doesn't work with the ADC.
I've tried reducing the clock frequency; currently, the MCU is running at 4MHz because I perform FFT calculations and other tasks after sampling, which would be too time-consuming at a lower clock speed within a 1-second timeframe.
I thought about increasing the clock speed during calculations and then reducing it, but I'm not sure how to execute this without affecting the ADC, DMA, and timer.
My question is, how can I efficiently achieve the following:
Thank you for any help 🙂
AN4746 (Optimizing power and performance with STM32L4 and STM32L4+ Series
microcontrollers) should be a good document deserved to read for your question.
Get rid of the HAL/Cube broken bloatware and software will run faster. Less CPU time also means less power in active mode and more time spent in low-power modes. And by the way, the code and data size also has a significant impact on execution speed, because the less the size, the less cache (ART) misses.