Page 1 of 1
Verify HS clock source?
Posted: Sat May 29, 2021 11:14 pm
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.
Re: Verify HS clock source?
Posted: Sun May 30, 2021 6:04 am
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.
Re: Verify HS clock source?
Posted: Wed Jun 02, 2021 9:22 pm
by dannyf
take a look at the implementation of SystemCoreClockUpdate() from CMSIS. Fairly straight forward to implement in your environment.
Re: Verify HS clock source?
Posted: Sat Jun 05, 2021 8:07 pm
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
