Skip to main content
JKim.2
Associate III
March 20, 2025
Solved

STM32L4P5G-DK SystemClock_Config error

  • March 20, 2025
  • 1 reply
  • 605 views

Hello,

 

I configured the STM32L4P5G-DK project with STM32CubeIDE according to the AN5050 for Octal-SPI PSRAM. At debugging state, the process was halt at SystemClock_Config. The infinite loop looks caused by while(READ_BIT(RCC->CR, RCC_CR_HSERDY) == 0U) after __HAL_RCC_HSE_CONFIG(RCC_OscInitStruct->HSEState); step. The ioc file and main c-code is attached. Please help me to solve this issue.

 

Thanks.

Best answer by TDK

Disable HSE in the IOC file and regenerate code.

1 reply

TDK
Super User
March 20, 2025

> STM32L4P5G-DK

This board does not have an HSE crystal loaded. It is also disconnected from the 8 MHz clock signal from the ST-Link chip. So you can only use the internal HSI by default. Otherwise, you can bridge R49 and use the st-link clock, or load X3 and related caps/resistors to use the HSE crystal.

TDK_0-1742476249049.png

TDK_1-1742476403660.png

 

CubeMX really shouldn't be configuring X3 on this board by default, but it is, and this is the result.

"If you feel a post has answered your question, please click ""Accept as Solution""."
JKim.2
JKim.2Author
Associate III
March 20, 2025

Hello @TDK ,

 

Thank you for the comment. Is it possible to avoid the problem with modifying the source code? If so, could you show me the code snippet for the change? 

 

Thanks. 

TDK
TDKBest answer
Super User
March 20, 2025

Disable HSE in the IOC file and regenerate code.

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