Skip to main content
Graduate
October 22, 2024
Question

Hse and hsi clock select

  • October 22, 2024
  • 2 replies
  • 1260 views

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

 

    This topic has been closed for replies.

    2 replies

    ST Employee
    October 22, 2024

    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!

     

    Graduate
    October 23, 2024

    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

    ST Employee
    October 25, 2024

    Hello @Alex_reynold

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