# STM32 : set APB1 and APB2 to same clock frequency

When configuring a STM32 (or at least my STM32F722ZE based nucleo board), there are 2 clock frequencies, one for APB1, the other for APB2. The annoying thing is that some timers use APB1, other use APB2. So each time I want to configure a PWM (or other timer based application), I have to first check which timer is connected on which APB.

It would be easiest to just set the same frequency for both (so ne need anymore to look up what is connected to which APB).

This could easily be done in STMCubeIDE :

I can just replace the APB2 prescaler by "/4", and have all timers running at 108MHz (I have no need for a timer at 216 MHz).

Is there any downside to it?

Anything that would no longer work as expected?

(nb : I'm starting from a new project, so there is no code I wrote to mess up, but I have no idea about time keeping, UART, ...)

• @Sandro CubeMX is an example generator at best. If you want flexibility, I recommend rolling your own Timer class. You can get peripheral clock using HAL_RCC_GetPCLK1Freq() and HAL_RCC_GetPCLK2Freq() Jan 31 at 23:59