cancel
Showing results for 
Search instead for 
Did you mean: 

Feature Request: Multi-Profile GPIO & Peripheral Configuration for Power Mode Transitions

Ufuk.Akkaya
Associate II

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:

  • Users can define custom modes (e.g., Run_Mode, UltraLowPower_Mode).
  • For each mode, the user can visually set GPIO states (Analog, Pull-up, Output levels, etc.) and peripheral states for all pins, not just the unused ones.
  • CubeMX generates distinct functions like MX_GPIO_Init_Run() and MX_GPIO_Init_LowPower().

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,

1 REPLY 1
Ghofrane GSOURI
ST Employee

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.