What does RCC mean on STM32?
On STM32, RCC stands for Reset and Clock Control.
It’s a big central block inside the microcontroller that is responsible for:
-
Clocks (the “C” in RCC)
RCC generates and distributes clocks to:-
The CPU core
-
Buses (AHB, APB1, APB2, etc.)
-
Peripherals (GPIO, USART, SPI, I²C, TIM, ADC, etc.)
Typical things RCC does:
-
Select clock sources: HSI (internal), HSE (external crystal), PLL, LSI, LSE, etc.
-
Set prescalers to divide clocks for different buses.
-
Choose the system clock (SYSCLK) and derived clocks like HCLK, PCLK1, PCLK2.
-
-
Resets (the “R” in RCC)
RCC can reset:-
The entire chip (system reset)
-
Individual peripherals (e.g. reset just USART1, SPI2, etc.)
This is used to:
-
Bring peripherals to a known default state
-
Recover a misconfigured peripheral by toggling its reset bit.
-
-
Enabling / disabling peripheral clocks
Before you can use most peripherals on STM32, you must enable their clock in RCC.
Examples:Or at register level (depends on family):
If you don’t enable the RCC clock:
-
The peripheral’s registers may appear “dead” or read as zero.
-
Your code may HardFault when trying to use it.
-
-
Where you see RCC in practice
-
In CubeMX / CubeIDE, the “Clock Configuration” tab is basically configuring the RCC.
-
In code, anything named like
__HAL_RCC_XXX_CLK_ENABLE(),RCC_CFGR,RCC_CR, etc. is part of this block. -
When you see diagrams like “STM32 Clock Tree” in the datasheet – that’s all RCC-related.

评论
发表评论