Verify HS clock source?

All about boards manufactured by ST
Post Reply
hardyn
Posts: 8
Joined: Sun Mar 28, 2021 5:33 am

Verify HS clock source?

Post by hardyn »

I have modified my Nucleo64 (F303RE) board to utilize an external CMOS oscillator though pin29, per the Nucleo64 datasheets. It appears to be working but as the remainder of my project relies on this external oscillator is there a method of determining if the HSE clock is being utilized or if it has fallen back onto the HSI RC clock?

Thanks in advance.
mlundin
Posts: 94
Joined: Wed Nov 04, 2020 1:20 pm
Answers: 6
Location: Sweden

Re: Verify HS clock source?

Post by mlundin »

You can check the RCC_CR and RCC_PLLCFGR to see what clocks are running and what source is selected for the PLL

Code: Select all

  
  Serial.printf("RCC_CR 0x%08X \n", RCC->CR);
  Serial.printf("RCC_CFGR 0x%08X \n", RCC->CFGR);
  Serial.printf("RCC_PLLCFGR 0x%08X \n", RCC->PLLCFGR);
Details of these regsters are found in the reference manual for the chip.
dannyf
Posts: 447
Joined: Sat Jul 04, 2020 7:46 pm

Re: Verify HS clock source?

Post by dannyf »

take a look at the implementation of SystemCoreClockUpdate() from CMSIS. Fairly straight forward to implement in your environment.
hardyn
Posts: 8
Joined: Sun Mar 28, 2021 5:33 am

Re: Verify HS clock source?

Post by hardyn »

Using @mlundin 's method I was able to determine the following:

According to the CFGR section of: https://www.st.com/resource/en/referenc ... ronics.pdf

RCC_CR: 3075D83; 0b11000001110101110110000011
Bit 17/16 are 11 which appears the HSE is good.

RCC_CFGR: 1D040A; 0b111010000010000001010
Bits 16/15 are 10 which appears The PLLSRC is using the HSE.

Thanks for everybody's help. This is good news :)
Post Reply

Return to “STM boards (Discovery, Eval, Nucleo, ...)”