cancel
Showing results for 
Search instead for 
Did you mean: 

STM32WL5MOCH - Error when using HSE as clock source for SYSCLK

biobuilder
Associate

The STM32CubeMX code generator allows you to enable the internal HSE and use it as the system clock source. However, when attempting to run the code, the system always fails into the Error Handler.

Capture.PNG

1 ACCEPTED SOLUTION

Accepted Solutions
biobuilder
Associate

The STM32WL5MOCH has an internal HSE TCXO, not a regular crystal.  Hence the initialization code from CubeMX is incorrect (as of 3/13/2025). 

 

In the function SystemClock_Config(), You need to change the HSEState from:

RCC_OscInitStruct.HSEState = RCC_HSE_ON;

To:

RCC_OscInitStruct.HSEState = RCC_HSE_BYPASS_PWR;

 

If the system does not start, check all the clock configurations closely.

View solution in original post

1 REPLY 1
biobuilder
Associate

The STM32WL5MOCH has an internal HSE TCXO, not a regular crystal.  Hence the initialization code from CubeMX is incorrect (as of 3/13/2025). 

 

In the function SystemClock_Config(), You need to change the HSEState from:

RCC_OscInitStruct.HSEState = RCC_HSE_ON;

To:

RCC_OscInitStruct.HSEState = RCC_HSE_BYPASS_PWR;

 

If the system does not start, check all the clock configurations closely.