2018-11-25 11:25 AM
After upgrading from CubeMX 4.27 to 5.0 i found out that HAL_SYSTICK_IRQHandler() call is missing from SysTick_Handler(). Is this a bug or a feature??
See SysTick_Handler code from 4.27:
void SysTick_Handler(void)
{
/* USER CODE BEGIN SysTick_IRQn 0 */
/* USER CODE END SysTick_IRQn 0 */
HAL_IncTick();
HAL_SYSTICK_IRQHandler();
/* USER CODE BEGIN SysTick_IRQn 1 */
/* USER CODE END SysTick_IRQn 1 */
}
and now the same function generated by 5.0
void SysTick_Handler(void)
{
/* USER CODE BEGIN SysTick_IRQn 0 */
/* USER CODE END SysTick_IRQn 0 */
HAL_IncTick();
/* USER CODE BEGIN SysTick_IRQn 1 */
/* USER CODE END SysTick_IRQn 1 */
}
2018-11-26 01:03 AM
Hello @persyMG ,
A new implementation has been done on the STM32CubeMX version 5.0 for the systick: the HAL_SYSTICK_IRQHandler is used for debug purpose and should not be called if you refer to Cube coding rules. If needed, it can be added in the dedicated user sections.
Kind Regards,
Imen.
2018-11-26 01:07 AM
Thanks,
So SysTick is now not reccomended to be used for any other purpose than internal HAL "tick" handling? And SysTick callback sholud not be used (as it is not called without HAL_SYSTICK_IRQHandler())?
2018-11-26 02:08 AM
Hi @persyMG ,
Yes that's it, SysTick callback should be used only for debug purposes.
If needed you can add it manually in the dedicated user tags.
2018-12-29 06:18 AM
Dear Imen,
The following text is quoted from your user manual:
"System timer
The system timer, SysTick, is a 24-bit count-down timer. Use this as a Real Time
Operating System (RTOS) tick timer or as a simple counter."
See document: PM0056 Programming manual, DocID15491 Rev 6, page 12.
I can not find any 'Cube coding rules' or other statements in your documentation that says otherwise.
For our software applications this would become a serious problem, so please fix this or help us out, because in some applications all other timers are in use for other functions.
Kind regard,
Carlo
2018-12-29 06:30 AM
They aren't saying the SysTick isn't being used, simply that more like other HAL applications/examples it doesn't call the secondary handler.
Put the things you need to manage on the 1 KHz (1ms) in the user section of SysTick_Handler(), which the processor IS executing.
Why? well probably because stuff here, and things you might add into the callbacks have a significant risk of dead-locking the system or distorting the timebase used everywhere else.
2018-12-29 06:50 AM
2019-01-11 02:31 AM
Thank you for your explanation, Clive Two.Zero.
At first I understood from some explanations in this forum that Systick in general should only be used for debug purposes. But it's only applies in the context when the CubeMX generated code is used and has nothing to do with the reliability of the Systick-timer. (If I understand it correctly now...)