Hi…<span class=”uiOutputText” dir=”ltr”>I’m using STM32CubeMX to generate code for a custom STM32L051R8T6 project. SysTick functions as expected when HAL drivers are selected. SysTick does not work if LL drivers are selected. Is there a reason why STM32CubeMX generated SysTick code only works when HAL drivers are selected for ‘RCC’?</span>
It is hard to pinpoint the exact reason for the code that was generated by the external tool, however we can provide you with instructions for troubleshooting this.
Please try creating a regular “LEDBlink” project with the VisualGDB project wizard, set a breakpoint in HAL_IncTick() and run the program so that it hits. Then check the call stack.
You should normally see the following stack:
The interrupt handler that calls HAL_IntTick().
Running the “find all references” command on the handler should show that it’s referenced from the interrupt vector table (typically called g_pfnVectors). In turn, checking the map file for g_pfnVectors should show that it’s placed exactly at the beginning of the FLASH memory (where the CPU would expect the interrupt handler table to be).
Once you can confirm it, please follow those steps backwards for the LL project (i.e. interrupt vector table -> specific interrupt handler -> call to HAL_IncTick()). If the system ticks are not working, one of those components is likely missing. If you are not sure, please let us know your findings and we will help you find a way to restore it.