cancel
Showing results for 
Search instead for 
Did you mean: 

STM32C011J4M6 trying to use HSE as clock

Franksterb92
Associate III

ok so when i debug and step through my code the hse ready bit in the rcc-cr register sets to one but when i run it it hangs at my while loop waiting for it to set why does this happen 

1 ACCEPTED SOLUTION

Accepted Solutions
Franksterb92
Associate III

so i put a bigger decoupling cap on the vdd vss for the mcu and it works now and i noticed that you have to clear bit 18 before setting bit 16 in the RCC->CR 

View solution in original post

3 REPLIES 3
TDK
Guru

Should set HSEBYP before or at the same time as HSEON.

HSERDY will remain clear until HSE is active. So perhaps you don't have a clock source coming in. What is your hardware? Verify clock with an oscilloscope.

Also note you can't disable HSI while it's being used as a clock source.

If you feel a post has answered your question, please click "Accept as Solution".

ii just have a 20mhz crystal hooked up to pin 1 and pin 8 can i measure a crystal with occiliscope or logic analizer

Franksterb92
Associate III

so i put a bigger decoupling cap on the vdd vss for the mcu and it works now and i noticed that you have to clear bit 18 before setting bit 16 in the RCC->CR