cancel
Showing results for 
Search instead for 
Did you mean: 

Hse and hsi clock select

Alex_reynold
Associate III

I am just switching clock source to MCU in RCC_CR register by making HSEON bit of above register high and waiting till HSERDY but turnsup.

But thing after HSERDY turns up when I read rcc_cr register both HSEON,HSION bit of RCC cr are at logic 1.

Then how controller will read this means MCU will consider which one as source?.if my understanding is wrong,please provide code block to switch the clock source from HSI to HSE

 

3 REPLIES 3
Sarra.S
ST Employee

Hello @Alex_reynold

You can select the source by switching the system to HSE using SW bit in RCC_CFGR register as follows: 

SarraS_1-1729590363801.png

Ideally, set SW to 10, so PLL is selected as a system clock and select HSE oscillator as PLLSRC in RCC_PLLCFGR register: 

SarraS_0-1729590329892.png

Hope that's clear now!

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Alex_reynold
Associate III

Hi,

I tried to switch source of  system clk  between hsi,hse.its working properly.but this will give standard clock of 16Mhz and 8Mhz respectively.but when I try to switch pllp as system clock it is not working.

Requirement how can I configure system clock to 48MHz  using pll.currently I am not modifying RCC_PLLCFGR(RESET VALUE 0x24003010).As per this,PLLM 16 ,PLLN 192,PLLP 2.SO PLLCLK SHOULD BE 48Mhz.but not getting it.note that PLLSRC is set to 1 soe freq input to pllsrc is Hse I.E HSE clock

Hello @Alex_reynold

I didn't fully understand your issue using PLL, could explain clearly what frequency you want to get 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.