2025-09-26 12:45 PM - last edited on 2025-09-29 1:56 AM by Andrew Neil
For background see: https://community.st.com/t5/stm32cubemx-mcus/stm32cubemx-6-2-1-for-nucleo-h745zi-q-doesn-t-generate/m-p/226159/highlight/true#M10675
In many embedded systems most peripherals are off most of the time, for power saving, and they are enabled only when needed. When CubeMX moves peripheral clock configuration from the MSP file of the HAL peripheral to PeriphCommonClock_Config() it makes this behavior harder to achieve. Is there an option to tell CubeMX to leave clock configuration in the HAL MSPs rather than creating the shared function ?
2025-09-29 1:06 AM
Hello @sdtbb
CubeMX does not provide an option to keep peripheral clock configuration within the HAL MSP files when peripherals share a common clock source.
You can use user code sections in the MSP files to enable or disable individual peripheral clocks at runtime, while leaving the shared clock source configured at startup. This method is CubeMX-safe and allows for some level of dynamic control, though the shared clock source will remain active.
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.