2018-11-20 07:04 PM
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 */
}
2018-12-14 02:50 AM
Hi, I have a similar problem. I used HAL_SYSTICK_IRQHandler () to increment my own timer software to count the duration of the event on the GPIO microcontroller.
Now, instead of using HAL_SYSTICK_IRQHandler(), do I set up a hardware Timer and use it to count the duration? Or can I getting the value from the system variable 'uwTick' which is incremented in HAL_IncTick () - is checking the value of 'uwTick' is ugly? and not suitable for the final release solution ??
2018-12-14 04:06 AM
Hello,
actually you can still call HAL_SYSTICK_IRQHandler(), but you have to place the call in the "USER" area by yourself.
2018-12-29 04:31 AM
Dear Nawres,
I really hope you made a mistake in claiming "the HAL_SYSTICK_IRQHandler is used for debug purpose", because we are getting in real large problems with many of our software applications. Please solve this what we experience as a serious bug/misunderstanding.
Thank you in advance for your understanding and your help.
Kind regards,
Carlo
2018-12-29 06:15 AM
Dear Nawres,
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.
And I can not find any 'Cube coding rules' or any other statement in the documentation that says otherwise.
Kind regards,
Carlo
2018-12-29 06:38 AM
That's chip level programming document.
The HAL examples don't use HAL_SYSTICK_IRQHandler();
More importantly, the thing everyone seems to miss is the chronic issues and dead locks that will result from callback functions trying to use all kinds of other HAL sub-functions which have dependencies on the ticker and timeouts, and that callbacks occur under interrupt context, and the processor can't preempt an interrrupt it is already in.
2018-12-29 06:43 AM
No, not a bug.
The bug is everyone putting random crap in the callbacks which have run-times >1ms, blocking, or otherwise having a circular dependency on the 1ms(1KHz) ticker incrementing. So basically a whole class of dead-lock and priority inversion type issues. For the mechanics of other parts of the HAL to work the SysTick must have the highest priority and preempt all other IRQ.
2018-12-29 06:49 AM
I'd guess it is this
2018-12-29 07:00 AM
Sorry, but if you open first document on Page 102/327 of UM1718 Rev 2 the document tells us:
Example of configuration using SysTick without FreeRTOS:
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 */
}
But when code is created with Cube V. 5.0, HAL_SYSTICK_IRQHandler(); is missing! Thats the problem! With previous versions of Cube the call was created automatically.
2019-01-15 03:17 AM
I found some more missing points:
1) In *msp.c we do not have anymore the priority setting for SYSTICK. However, Cube allows you to modify the SYSTICK priority. So where is it located ?
2) During clock initialization, we do not have anymore any call to SYSTICK functions like HAL_SYSTICK_Config() or HAL_SYSTICK_CLKSourceConfig().
Reading the documentation, it is stated that "SysTick_Handler not generated in the code when FreeRTOSTM is enabled" but my project does not have FreeRTOS and all Systick related items are missing.
In my opinion, SYSTICK is a valuable resource and should be made available for developers as before. We use it for many tick based applications.
2019-02-04 07:55 AM
Hi,
Same for me. When I passed my code with this new version of CubeMX, nothing work.
I spent several hours to find that the problem is the missing "HAL_SYSTICK_IRQHandler();" line >:(
Hopefully I found this post of Innomatic :)