cancel
Showing results for 
Search instead for 
Did you mean: 

Switching from default HSI to external HSE

Amir1
Associate II

Hello All

I am using Nucleo F446re. I am trying to switch my system clock from the default ​16-MHz HSI to the external 8-MHz HSE (which is already supplied as MCO by a crystal to Pin 5 of the MCU, as the schematic shows). To that end, is there anything involved other than setting HSEBYP and HSEON bits in the RCC_CR? While these have not worked alone, I have also tried to turn HSI off by clearing HSION bit before or after the aforementioned bit settings, but with no success; the system does not allow HSI to be turned off.

I have checked with a scope and seen that a robust 8-MHz pulse is indeed present at the corresponding OSC_IN GPIO pin. So a lack of pulse is not the cause.

Thank you for any insights.

Amir   

4 REPLIES 4

Besides setting HSEBYP and HSEON, you also want to switch the source of system clock. So, if you sourced the system clock from HSI, switch in RCC_CFGR.SW to HSE and wait until done. If PLL is involved, you need to switch the source of that, in RCC_PLLCFGR.PLLSRC, before you even switch PLL on.

JW

Amir1
Associate II

​Thank you, Jan. I proceeded as advised and succeeded.  

One other, related, question: Do one have to be careful playing with clocks and their prescaler values? Can the device be damaged by exceeding the limits? 

CubeMX would hint when maximum ratings were to be exceeded, but I am not using CubeMX anymore. Rather,  I am doing register-level programming.

Amir

>>Can the device be damaged by exceeding the limits?

No, It just stops functioning as you miss delivery deadlines on critical signal paths.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Thanks.