2026-04-10 2:55 AM - last edited on 2026-04-15 8:03 AM by Sara BEN HADJ YAHYA
Hello,
I have a problem verifying the HCLK frequency for Nucleo-C562RE. I configure the clock to 144MHz (see image below).
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
Edited to apply source code formatting - please see How to insert source code for future reference.
Solved! Go to Solution.
2026-04-10 7:52 AM
@gil_dobjanschi, RCC is disabled. Please enable it and test one more time.
2026-04-10 6:29 AM
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.
2026-04-10 6:41 AM - edited 2026-04-10 6:46 AM
2026-04-10 6:49 AM
Hello @gil_dobjanschi, and welcome to ST Community!
Let me check this and get back to you.
Best regards
2026-04-10 7:52 AM
@gil_dobjanschi, RCC is disabled. Please enable it and test one more time.
2026-04-10 8:43 AM
Hello @gil_dobjanschi
Thank you for bringing this issue to our attention.
I reported this internally.
Internal ticket number: CDM0061602.
2026-04-10 11:37 AM
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