cancel
Showing results for 
Search instead for 
Did you mean: 

Default CubeMX project for Nucleo-U5A5ZJ error in SystemClock_Config

andreasp00
Associate II

Hello.

I'm working on setting up a brand new Nucleo STM32U5A5Z development board and have some issues.

My project is a completely bare-bones default with no security or BSP enabled. The application fails in SystemClock_Config() and enters the error handler. The issue seems to be related to the HSE as SystemClock_Config returns HAL_TIMEOUT here:

      /* Check the HSE State */
      if (pRCC_OscInitStruct->HSEState != RCC_HSE_OFF)
      {
        tickstart = HAL_GetTick();

        /* Wait till HSE is ready */
        while (READ_BIT(RCC->CR, RCC_CR_HSERDY) == 0U)
        {
          if ((HAL_GetTick() - tickstart) > HSE_TIMEOUT_VALUE)
          {
            return HAL_TIMEOUT;
          }
        }
      }

Thanks!

3 REPLIES 3
mƎALLEm
ST Employee

Hello,

1- In next time please use </> to share a code. Please read How to write your question to maximize your chances to find a solution . So I invite you to edit your post to comply with the rule.

2- What clock source frequency value you set to HSE? 16MHz in HSE crystal mode?:

mALLEm_0-1770038170154.png

mALLEm_1-1770038200226.png

 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

Thanks for the response!

My bad with the code, I've been getting too used to writing in markdown :)

Here is a snippet of the default clock config:

andreasp00_0-1770042413188.png

- System clock is set to 16 MHz

- HSE at 8 MHz is used as clock source.

- HSE enabled as "BYPASS Clock Source"

Aren't these settings weird as a default for the Nucleo board? I would expect 160 MHz as the sysclk. Also, changing HSE to "Crystal/Ceramic Resonator" seems to fix the error in SystemClock_Config().

Hello,

Thank you for the sharing.

It seems to be an issue with that default config.

Please try the configuration I shared previously. According to the board's schematic, HSE is not using Bypass mode (For STLINK MCO output) but a crystal of 16MHz:

mALLEm_0-1770043362645.png

As you can see in the schematic, STLINK-MCO is disconnected by default and the default configuration is a Crystal of 16MHz.

If you confirm that, I will raise a ticket to fix that in CubeMx.

Hope that helps.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.