Skip to main content
BJerk.1
Associate II
July 9, 2020
Solved

STM32F030C6 wih external oscillator (HSE)

  • July 9, 2020
  • 2 replies
  • 905 views

I am trying to understand how to setup the microcontroller (STM32F030 in this case) to use external oscillator. I am using blinking LED as a test to see if the code is running.

To setup the HSE I did following:

  • selected Crystal/Ceramic Resonator in High Speed Clock under RCC
  • under TIM1 set Internal clock as a Clock Source
  • under clock configuration tab selected HSE under PLL source mux and System clock mux

When I run the microcontroller it runs even if I disconnect the external oscillator.

I am not sure if the microcontroller goes to internal RC when there is no external oscillator or I need to do some additional work?

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

Read the RCC registers and post them here, or you can check them against their description in the reference manual.

Code generated by CubeMX supports only two kinds of error handling, either ignoring any problem or locking up. Never use it in production code.

2 replies

TDK
July 9, 2020

The default CubeMX generated code will let the program continue even if the HSE fails to initialize. That may be what is happening here. I would instrument the Error_Handler() function with an infinite loop or something else to prevent it from returning immediately.

"If you feel a post has answered your question, please click ""Accept as Solution""."
berendi
berendiBest answer
Principal
July 9, 2020

Read the RCC registers and post them here, or you can check them against their description in the reference manual.

Code generated by CubeMX supports only two kinds of error handling, either ignoring any problem or locking up. Never use it in production code.