cancel
Showing results for 
Search instead for 
Did you mean: 

CubeMX 5 bug? - HAL_SYSTICK_IRQHandler() call missing from SysTick_Handler()

persyMG
Associate

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 */
}

7 REPLIES 7
Imen.D
ST Employee

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.

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
persyMG
Associate

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())?

Nawres GHARBI
ST Employee

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.

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

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.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

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...)