Skip to main content
gil_dobjanschi
Associate II
April 10, 2026
Solved

Clock configuration

  • April 10, 2026
  • 4 replies
  • 309 views

Hello,

I have a problem verifying the HCLK frequency for Nucleo-C562RE. I configure the clock to 144MHz (see image below).

Screenshot from 2026-04-10 12-32-56.png

When I start the application I print the HCLK frequency:

SEGGER_RTT_printf("---- MCU started at %lu[Hz] ----\n", HAL_RCC_GetHCLKFreq());

I get 48MHz:

---- MCU started at 48000000[Hz] ----

While stepping through the HAL_Init code I see that the code thinks that the clock source is LL_RCC_SYS_CLKSOURCE_STATUS_HSIDIV3 (48MHz)

uint32_t HAL_RCC_GetSYSCLKFreq(void)
{
uint32_t sysclockfreq;
uint32_t sysclk_source;

sysclk_source = LL_RCC_GetSysClkSource();
if (sysclk_source == LL_RCC_SYS_CLKSOURCE_STATUS_HSIS)
{
/* HSIS used as system clock source */
sysclockfreq = HSI_VALUE;
}
else if (sysclk_source == LL_RCC_SYS_CLKSOURCE_STATUS_HSIDIV3)
{
/* HSIS used as system clock source */
sysclockfreq = HSI_VALUE / 3U;
}

#if defined(HSE_VALUE)
else if (sysclk_source == LL_RCC_SYS_CLKSOURCE_STATUS_HSE)
{
/* HSE used as system clock source */
sysclockfreq = HSE_VALUE;
}
#endif /* HSE_VALUE */

else
{
sysclockfreq = HAL_RCC_GetPSIClockFreq();
}

return sysclockfreq;
}

 

However the clock diagram indicates HSIS as the source of clock for System Mux.

 

Help would be appreciated,

Gil

gil_dobjanschi_0-1775813742862.png


Edited to apply source code formatting - please see How to insert source code for future reference.

Best answer by STackPointer64

@gil_dobjanschi, RCC is disabled. Please enable it and test one more time.

4 replies

TDK
Super User
April 10, 2026

HSIDIV3 is the default after reset. Is it possible the clock has not been changed yet in your code? Where are you calling HAL_RCC_GetHCLKFreq in relation to clock being set? Including your IOC or code may help.

 

"If you feel a post has answered your question, please click ""Accept as Solution""."
gil_dobjanschi
Associate II
April 10, 2026

Hi TDK,

I called it before mx_system_init and after mx_system_init in the while(1) loop of the application. It always prints 48MHz. I attached the zipped ioc2 file. 

 

Thanks,

Gil

Technical Moderator
April 10, 2026

Hello @gil_dobjanschi

Thank you for bringing this issue to our attention.

I reported this internally.

Internal ticket number: CDM0061602.

"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.Saket_Om"
Technical Moderator
April 10, 2026

Hello @gil_dobjanschi, and welcome to ST Community!

Let me check this and get back to you.

Best regards

To improve visibility of answered topics, please click 'Accept as Solution' on the reply that resolved your issue or answered your question.
STackPointer64Best answer
Technical Moderator
April 10, 2026

@gil_dobjanschi, RCC is disabled. Please enable it and test one more time.

To improve visibility of answered topics, please click 'Accept as Solution' on the reply that resolved your issue or answered your question.
gil_dobjanschi
Associate II
April 10, 2026

Hi @STackPointer64,

I confirm that by simply activating RCC the clock value is now correct. Specifically it is 48MHz on startup, before  invoking mx_system_init, and 144MHz right after mx_system_init. Thank you for the help!

 

@Saket_Om, I'm glad I can help! 

 

Regards,

Gil