Beh
Beh

Reputation: 35

STM32 clock adjustment

I'm using STM32f103 micro controller for a while and today I just confused about clock source and PLL configuration! I know the clock source is HSI by default when micro starts and startup_stm32f10x_xx.s runs, but I don't know if PLL sets or not!? how can I know whats my micro freq?

thank you

Upvotes: 1

Views: 7275

Answers (2)

Fiddling Bits
Fiddling Bits

Reputation: 8861

A call to RCC_GetClocksFreq() will tell you the clock frequencies (SYSCLK, HCLK, PCLK1, PCLK2, ADCCLK).

Upvotes: 3

rjp
rjp

Reputation: 1820

If you are using the CMSIS library for the STM32, it has functions to configure the clock and also functions to tell you at runtime what the clock is.

If you are not, you will have to look to see where the clock source is being set, and if it is the HSE you will need to know what crystal you have. Once you have that info, you can then look at the M, N, and P parameters of the PLL (if used) to calculate your HCLK. You should be able to find all this information in the reference manual for the STM32F103 in the RCC (reset and clock control) section.

Upvotes: 2

Related Questions