Skip to main content
Franksterb92
Senior
August 27, 2023
Solved

STM32C011J4M6 trying to use HSE as clock

  • August 27, 2023
  • 2 replies
  • 1596 views

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 

This topic has been closed for replies.
Best answer by Franksterb92

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 

2 replies

TDK
August 27, 2023

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""."
Franksterb92
Senior
August 27, 2023

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
Franksterb92AuthorBest answer
Senior
August 28, 2023

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