cancel
Showing results for 
Search instead for 
Did you mean: 

HAL_SYSTICK_IRQHandler() call is missing in CubeMX v5 generated Systick_Handler.

Innomatic
Associate II

When STM32CubeMX v.5 generates project, it does not insert HAL_SYSTICK_IRQHander() inside SysTick_Handler(). As a result, your HAL_SYSTICK_Callback() no longer works. Previous versions of CubeMX used to generate following code for SysTick_Handler()

/**
* @brief This function handles System tick timer.
*/
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 */
}

In version 5. it becomes

/**
* @brief This function handles System tick timer.
*/
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 */
}

23 REPLIES 23

What do you mean for "is used for debug purpose"? What harm can cause a SYSTICK callback already initialized and running? If this exclusion is aimed to discourage the use of SYSTICK callback as main location of programming (to avoid problems as Clive said) I can imagine it's reasonable, but not enough. Why not leave the code generation as it was (not breaking up things) and warn users about the correct use of Systick Callback?

In the end, the misuse of a MCU is end-user affair, expecially if the said user was warned before.

Noppe.Jack
Senior

There is a bigger issue at play here also. Code generation changes should be documented in the release notes. Irrespective of philosophical arguments about right and wrong, ST has the right to make decisions about what behaviours they want to change. That said, if they make these changes without warning the developer community, it results in distrust of the utility. We can all adjust to changes if we know about them, but when we have to discover these through troubleshooting, then the frustration levels become too high.

Please can we get a commitment from ST to document changes in code generation rules?

T J
Lead

I had to add this to fix it:

// in stm32h7xx_it.c

void SysTick_Handler(void)

{

 /* USER CODE BEGIN SysTick_IRQn 0 */

   HAL_SYSTICK_Callback(); // <---------- added this line

 /* USER CODE END SysTick_IRQn 0 */

 HAL_IncTick();

 /* USER CODE BEGIN SysTick_IRQn 1 */

 /* USER CODE END SysTick_IRQn 1 */

}

Dear Nawres,

There are no announcements on this modification inside the code, and according to UM1718 Rev 31, p101, HAL_SYSTICK_IRQHandler is still called. If there is a new implementation, at least states it beside the original implementation, and modify the user manual. It is really confusing.