AnsweredAssumed Answered

LL_Init1msTick disables SysTick interrupt

Question asked by Kamil Kisiel on Dec 1, 2017
Latest reply on Dec 4, 2017 by Kamil Kisiel

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.

Outcomes