ADC LowPowerFrequencyMode = Enable
Posted: Thu Jan 23, 2025 10:43 am
Hi all
Forgive the relative noob question, and go easy!
I have an existing custom board that was programmed previously with CubeIDE (of which I have almost no experience) by a retired engineer, that I have successfully re-written a simplified functional version of in Arduino IDE (due to a needed modification), but I'm struggling to get the STM32LO518KT's current draw down enough - its a constant sampling sensor application, so going to sleep isn't really an option as I see it.
I've managed to cobble together a revised PeripheralPins.c (needed pullups on the i2c pins) and generic_clock.c (to alter the closck speeds) and put it in the variant folder (based on what I can see in the Cube versions main.c), and got the overall circuit current down from 13mA to 5mA by altering the clock speeds, but I need it to be under 4mA (like the Cube version achieves). It uses one i2c, two ADC's and one PWM output. I have reprogrammed an original board (that previously used the cube code and achieved <4mA) so it's nothing hardware based limiting me.
I've noticed the Cube version sets things in the hadc.Init such as LowPowerFrequencyMode = Enable etc -
- can anyone help by advising how can i access these settings in my setup() part of my sketch? (assuming that's the correct place to do it??)
- Is that even possible when using analogRead(xxx)??? - a small example would be incredibly helpful
I'm happy to share the whole or sections of either/both code if that helps...
Thanks!
Forgive the relative noob question, and go easy!
I have an existing custom board that was programmed previously with CubeIDE (of which I have almost no experience) by a retired engineer, that I have successfully re-written a simplified functional version of in Arduino IDE (due to a needed modification), but I'm struggling to get the STM32LO518KT's current draw down enough - its a constant sampling sensor application, so going to sleep isn't really an option as I see it.
I've managed to cobble together a revised PeripheralPins.c (needed pullups on the i2c pins) and generic_clock.c (to alter the closck speeds) and put it in the variant folder (based on what I can see in the Cube versions main.c), and got the overall circuit current down from 13mA to 5mA by altering the clock speeds, but I need it to be under 4mA (like the Cube version achieves). It uses one i2c, two ADC's and one PWM output. I have reprogrammed an original board (that previously used the cube code and achieved <4mA) so it's nothing hardware based limiting me.
I've noticed the Cube version sets things in the hadc.Init such as LowPowerFrequencyMode = Enable etc -
- can anyone help by advising how can i access these settings in my setup() part of my sketch? (assuming that's the correct place to do it??)
- Is that even possible when using analogRead(xxx)??? - a small example would be incredibly helpful
I'm happy to share the whole or sections of either/both code if that helps...
Thanks!