How to get HCLK for LL_Init1msTick?
Hi
I noticed on my STM32G071.. that the "LL_mDelay(1000)" function did not produce a steady 1000ms delay if I vary the HCLK frequency (code generated by CubeIDE)...
I did not have this problem with other MCUs code generated, it worked out of the box (F103/F407).
Then I stumbled upon the "LL_Init1msTick(uint32_t HCLKFrequency)" function which seemed to have solved my problem.
But what is the proper (dynamic) way to get the HCLK frequency for the function?
I currently use this in my main.c:
/* USER CODE BEGIN SysInit */
LL_Init1msTick(RCC_GetHCLKClockFreq(RCC_GetSystemClockFreq()));
/* USER CODE END SysInit */This seems to pass a valid HCLK to the function. But CubeIDE tells me a warning that:
../Core/Src/main.c: In function 'main':
../Core/Src/main.c:85:18: warning: implicit declaration of function 'RCC_GetHCLKClockFreq'; did you mean 'LL_RCC_GetCECClockFreq'? [-Wimplicit-function-declaration]
LL_Init1msTick(RCC_GetHCLKClockFreq(RCC_GetSystemClockFreq()));
^~~~~~~~~~~~~~~~~~~~
LL_RCC_GetCECClockFreq
../Core/Src/main.c:85:39: warning: implicit declaration of function 'RCC_GetSystemClockFreq'; did you mean 'LL_RCC_GetSystemClocksFreq'? [-Wimplicit-function-declaration]
LL_Init1msTick(RCC_GetHCLKClockFreq(RCC_GetSystemClockFreq()));
^~~~~~~~~~~~~~~~~~~~~~
LL_RCC_GetSystemClocksFreq
Whats the problem here?
