STM32 RCC Clock Tree

# STM32 PLL Clock Tree Calculator

Compute `PLLM`, `PLLN`, `PLLP` and `PLLQ` for STM32F4, STM32F7 and STM32H7 boards, flag out-of-spec VCO or APB limits, and emit ready-to-compile HAL RCC init code.

STM32 familySTM32F407 / F405 (168 MHz max)STM32F411 (100 MHz max)STM32F446 (180 MHz max)STM32F767 / F746 (216 MHz max)STM32H743 / H747 (480 MHz max)

PLL clock sourceHSE external clock / crystalHSI internal RC (16 MHz)

HSE frequency (MHz)Nucleo MCO bypass is 8 MHz; Black Pill crystal is 25 MHz

PLLM divider (2..63)

PLLN multiplier (50..432)

PLLP main divider/ 2/ 4/ 6/ 8

PLLQ divider (USB / FDCAN / SDIO)

AHB prescaler/ 1/ 2/ 4/ 8/ 16/ 64/ 128/ 256/ 512

APB1 prescaler (max 54 MHz)/ 1/ 2/ 4/ 8/ 16

APB2 prescaler (max 108 MHz)/ 1/ 2/ 4/ 8/ 16

Board presets:

All clock domains stay within STM32F767 / F746 (216 MHz max) datasheet bounds. Recommended Flash wait states at 3.3 V: `FLASH_LATENCY_7`.

SYSCLK / HCLK 216.00 MHz HCLK 216.00 MHz (max 216)

VCO In / Out 432.0 MHz Input 2.00 MHz

APB1 / TIMx 54.00 MHz Timers run at 108.00 MHz

APB2 / TIMx 108.00 MHz Timers run at 216.00 MHz

PLL48CLK (PLLQ) 48.00 MHz 48.00 MHz exact (USB OTG FS / RNG valid)

STM32CubeHAL RCC snippet

```
/* STM32F767 / F746 (216 MHz max) - SYSCLK 216.00 MHz, APB1 54.00 MHz, APB2 108.00 MHz */
RCC_OscInitTypeDef osc = {0};
osc.OscillatorType = RCC_OSCILLATORTYPE_HSE;
osc.HSEState = RCC_HSE_BYPASS; /* use RCC_HSE_ON for quartz crystal */
osc.PLL.PLLState = RCC_PLL_ON;
osc.PLL.PLLSource = RCC_PLLSOURCE_HSE;
osc.PLL.PLLM = 4;
osc.PLL.PLLN = 216;
osc.PLL.PLLP = RCC_PLLP_DIV2;
osc.PLL.PLLQ = 9;
HAL_RCC_OscConfig(&osc);

RCC_ClkInitTypeDef clk = {0};
clk.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;
clk.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
clk.AHBCLKDivider = RCC_SYSCLK_DIV1;
clk.APB1CLKDivider = RCC_HCLK_DIV4;
clk.APB2CLKDivider = RCC_HCLK_DIV2;
HAL_RCC_ClockConfig(&clk, FLASH_LATENCY_7);
```

## STM32 clock tree constraints

Clock startup bugs rarely fail loudly on a bench. A wrong `PLLM` value or missing HSE bypass flag causes `HAL_RCC_OscConfig()` to spin forever on `RCC_CR_HSERDY`.

| Stage            | Formula                | Design check                                                   |
| ---------------- | ---------------------- | -------------------------------------------------------------- |
| VCO input        | f\_in / PLLM           | Keep inside 1 to 2 MHz on F4/F7 (1 to 16 MHz on H7).           |
| VCO output       | (f\_in / PLLM) \* PLLN | 100 to 432 MHz on F4/F7; 192 to 960 MHz wide range on H7.      |
| SYSCLK           | f\_VCO / PLLP          | Must stay at or below part maximum (168, 180, 216 or 480 MHz). |
| USB / SDIO / RNG | f\_VCO / PLLQ          | Must hit 48 MHz for USB OTG FS without SOF errors.             |

## Frequently asked questions

| Question                                                                   | Answer                                                                                                                                                                                                       |
| -------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Why does STM32F4/F7 recommend a 2 MHz PLL VCO input?                       | ST reference manuals RM0090 and RM0410 specify a 1 to 2 MHz PLL input range and recommend 2 MHz to keep PLL jitter low. Setting PLLM equal to HSE/2 satisfies this rule cleanly.                             |
| Why do STM32 timers run at 2x the APB clock?                               | When an APB1 or APB2 prescaler is greater than 1, the internal RCC clock tree doubles the timer kernel clock. A 42 MHz APB1 bus with /4 prescaler drives TIM2 through TIM7 at 84 MHz.                        |
| What happens if Flash wait states are set too low before switching SYSCLK? | The CPU fetches corrupted instructions from Flash and traps in HardFault or BusFault immediately after RCC\_CFGR switches to PLLCLK. Always raise FLASH\_ACR.LATENCY before switching to a higher frequency. |

[Tool: PWM Timer Prescaler Calculator](https://circuittwin.ai/tools/pwm-timer-prescaler-calculator) [Tool: UART Baud Calculator](https://circuittwin.ai/tools/uart-baud-calculator) [Board: NUCLEO-F767ZI (216 MHz)](https://circuittwin.ai/boards/nucleo-f767zi) [Board: NUCLEO-H743ZI2 (480 MHz)](https://circuittwin.ai/boards/nucleo-h743zi2) [Guide: STM32F7 Firmware CI](https://circuittwin.ai/guides/stm32f7-firmware-ci)

> ## Verify RCC startup and HSE bypass on your real ELF
>
> Run your compiled STM32 binary on CircuitTwin board twins to catch RCC clock hangs, wrong APB baud rates and Flash wait-state faults in CI.
>
> [Start now](https://app.circuittwin.ai/try) [Inspect NUCLEO-F767ZI twin](https://circuittwin.ai/boards/nucleo-f767zi) [Connect a coding agent](https://circuittwin.ai/docs/agents)
