2017-12-01 12:45 PM
I recently generated code for a project using STM32CubeMX which used mixed LL and HAL drivers (HAL only for USB). At the beginning of main the generated code calls HAL_Init, which is all well and good, but then later calls SystemClock_Config which in turn calls LL_Init1msTick. The problem is that LL_Init1msTick (which then calls LL_InitTick) overwrites the SysTick->CTRL register with the value SysTick_CTRL_CLKSOURCE_Msk | SysTick_CTRL_ENABLE_Msk; Notably absent is the SysTick_CTRL_TICKINT_Msk flag which is required for the SysTick interrupt to be called. This causes any subsequent HAL calls to fail because most of the use HAL_Delay or HAL_GetTick in some way, and now the tick is no longer being enabled.
Seems like a pretty nasty bug for anyone trying to mix HAL and LL drivers.
2017-12-04 07:11 AM
Hi
Kisiel.Kamil
,Thank you for sharing this issue.It is reported internally for check.
-Nesrine-
2017-12-04 10:45 AM
Thanks Nesrine,
I guess I should specify that this was with the STM32F4 HAL, but I just checked the most recent F0 and F7 HAL and they seem to have the same problem.
2018-12-11 02:08 PM
I can confirm the same problem with STM32L4 HAL LL. I was scratching my head about why the SysTick handler was not being called until I looked in the CTRL register and found it disabled.
2019-08-01 12:37 PM
If you've got HAL libraries available something like this seems to work:
HAL_SuspendTick();
LL_Init1msTick( 8000000 );
HAL_ResumeTick();
I'm working with the STM32F030CC and dynamically changing system clock source between 48 MHz PLL and 8 MHz HSI. This gets SysTick back tracking. But on the other hand, when I try to flip back later in the code, something heads south. Don't know yet if that's related or a new mystery.
2019-09-08 01:22 AM
You need LL_SYSTICK_EnableIT();
because for LL the IT is not enabled (HAL enables it automatically)