cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F103 Clock Configuration

simon239955
Associate II
Posted on April 28, 2015 at 23:47

Hi,

I have a question concerning the clock configuration of an STM32F103RBT6. I used several STM32F4 chips before and generated the system_stm32f4xx.c file with the STM32F4 Clock Configuration Tool. It seems that there is no equivalent tool for the STM32F103? 

However, as the system_stm32f10x.c file contains functions to set the SysClock like ''SetSysClockTo36'' I thought the clock configuration should work by just setting the define to use the correct ''SetSysClockTo...'' function and defining the HSE Value in stm32f10x.c (as the SetSysClockTo functions are dependent on the HSE Value).

This works for STM32F103 Boards with the standard 8MHz HSE oscillator. For my boards with a 16MHz HSE oscillator, it does not work. So my question is, if it is possible to use the SetSysClockTo functions with different HSE Values and if there are any further steps to perform, despite defining the correct functions and the HSE Value. 

My goal is to set the CPU Speed to 72MHz with an 16MHz HSE. 

Thanks in advance!

#clock #stm32f1 #config
2 REPLIES 2
Posted on April 29, 2015 at 14:25

I'd imagine you'd select HSE/2 as the PLL Input, and 9 as the multiplier.

The F1 design has significantly less options for the clocking and is less complicated than the other platforms. The reference manual should illustrate the available settings, and diagrammed in the Clock Tree

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
simon239955
Associate II
Posted on April 29, 2015 at 19:38

Yes I intented PLLMUL 9 and HSE/2...

However, it seems that I overlooked the HSE/2. I edited the device specific line (1056) to 

RCC->CFGR |= (uint32_t)(RCC_CFGR_PLLSRC_HSE | RCC_CFGR_PLLMULL9 | RCC_CFGR_PLLXTPRE);

and now it works. I am not sure if this is the correct way to include the HSE/2 (RCC_CFGR_PLLXTPRE) but all clocks are working as they should.