cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H755 HALTick Timer and FreeRtos - Problem with Code generation

Curtis B.
Senior

Hello folks,

I discovered a problem in the code generation of CubeIDE and I don't know if it is a bug or a PEBKAC.

I set up a project for te H755 nucleo board. First, I just started blinking some LEDs with both cores. Worked fine.

Then I changed the HAL tick timer from Systick to TIM7 for the CM7 core. Works as intended, too. But when I enable FreeRtos for the CM7 the program gets stuck, because the default handler is triggered.

I analysed that the interrupt that ended in the default handler ist the interrupt from TIM7. The reason for that is, when FreeRTOS is enabled, in the file "stm32h7xx_it.c" the IRQ handler for TIM7 is not generated that should normally look like this:

void TIM7_IRQHandler(void)
{
  /* USER CODE BEGIN TIM7_IRQn 0 */
 
  /* USER CODE END TIM7_IRQn 0 */
  HAL_TIM_IRQHandler(&htim7);
  /* USER CODE BEGIN TIM7_IRQn 1 */
 
  /* USER CODE END TIM7_IRQn 1 */
}

I added the snipped manually and everything works fine. But why is this code snippet not generated? In older firmaware packages for the H7 core and another controller it worked with no additional settings. Is the a bug, or did I miss something in the configuration?

Best regards,

Daniel

13 REPLIES 13
AShri.1
Associate II

0693W000000VKhMQAW.pngI ran into the same problem (on the STM32H745). For some reason the "Generate IRQ" and "Call HAL function" is unchecked in the code generation. So you either have to add it manually, or have to know to check the code generation option.

I don't see the logic as to why it's turned off, and I wasted a lot of time hunting down the root cause. I hope the default behaviour is changed in future versions.

Curtis B.
Senior

Hi AShri,

I thought that the SysTick interrupt is handled by the RTOS and the HalTick which I set to TIM7 should be generated by CubeIDE. Under NVIC1 TIM7 isn't present. For System Tick Timer I cannot activate Generate IRQ because it is greyed out. It is stated that this interrupt is handled by FreeRTOS. Only adding it manually worked for me.

Best Regards,

Daniel

I should have clarified: the code generator sometimes skips generating the isr for SysTick when you eneable -> then disable FreeRTOS. But I've also came across the same issue as you, where the isr for TIM7 (or whatever TIMx is used for SysTick) is not generated. I was able to trace it back to the code generation options.

This is a screenshot of a current project using FreeRTOS and TIM7 as the SysTick.

0693W000000VOaAQAW.png

Curtis B.
Senior

I see, in your project at least TIM 7 is listed in the code generation tab. This is how it looks in my project:

TIM7 does not even appear in the list. Annyways, fixing it manually works. At least I am not the only one with this problem. Thanks for your reply. :)

Khouloud ZEMMELI
ST Employee

Hello @Curtis B.​ ,

Could you please share your ioc file? issue not reproduced on my side..

Thanks,

Khouloud

Curtis B.
Senior

Hi Khouloud,

of course, please finde the file in the attachment.

Regards,

Daniel

Khouloud ZEMMELI
ST Employee

Thanks for the share, I need some more info

Did you created your ioc file from CubeIDE ? If yes which CubeIDE version?

Otherwise, your project (ioc ) was created with an old CubeMX version then you have migrate it to the 5.6.0 version ?

Thanks,

Khouloud

Khouloud ZEMMELI
ST Employee

Check the ioc attached, is it ok ?

Hi,

yes, the ioc file was created from CubeIDE it is the version 1.3.0.

Regards,

Daniel