2026-02-02 10:48 PM - edited 2026-02-02 10:59 PM
Hello ST Community,
I am working on an ultra-low-power project using STM32 MCUs and I have a question regarding the current capabilities of STM32CubeMX.
Current Situation: I am aware that STM32CubeMX has an option to "Set unused pins to Analog" to save power. However, this is not sufficient for complex low-power management. In many cases, pins that are actively used in "Run" mode need to be reconfigured into specific states—not necessarily Analog—before entering a low-power mode (e.g., keeping a specific Pull-up/Pull-down for an external sensor, or maintaining a specific Output level to prevent leakage through external circuitry).
Currently, CubeMX generates a single initialization function (e.g., MX_GPIO_Init()). To manage transitions for these "used" pins, we must manually write wrapper functions to change their states before sleep and re-initialize them upon wake-up. This manual process is time-consuming and prone to configuration errors.
My Question: Is there an existing feature or workflow within CubeMX that allows users to define two or more different configuration sets for the same pins/peripherals and generate separate initialization functions for them?
Feature Suggestion: If this is not currently supported, I believe it would be a massive improvement for the STM32 ecosystem. Ideally, CubeMX could have a "Mode Manager" tab where:
This would significantly reduce boilerplate code, prevent hardware-related leakage errors during manual transitions, and make power optimization much more intuitive.
I would love to hear if there are any workarounds or if this is something the dev team might consider for future releases.
Best regards,
2026-02-02 11:09 PM
Hello @Ufuk.Akkaya
I'm currently checking your request . I will get back to you asap.
THX
Ghofrane
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.