cancel
Showing results for 
Search instead for 
Did you mean: 

BUG ! CubeH7/STM32H7 IRQ Priority issue in all FreeRTOS based examples

Manu Abraham
Senior

Hi Folks,

@ALABB​ @Imen DAHMEN​ @Amel NASRI​ 

In all the ST Cube H7 examples which use FreeRTOS;

There exists this weird Bug! You leave any of the FreeRTOS example in the Cube H7 repository. In all likelihood, that example might freeze immediately, after a minute, or an hour, or after a day, or much later. Depends upon your luck! It is impossible to determine when the freeze will occur.

eg:

HAL_NVIC_SetPriority(TIM6_DAC_IRQn, TickPriority ,0U);

or in ethernetif.c

 /* Enable the Ethernet global Interrupt */

 HAL_NVIC_SetPriority(ETH_IRQn, 0x7, 0);

 HAL_NVIC_EnableIRQ(ETH_IRQn);

As it turns out, I've had weird and random freezes.

It turns out that, the interrupt priority 0 (the highest).

That priority is too high to be making FreeRTOS API calls from. Hence the problem.

This BUG exists in *ALL* the CubeH7 examples. It is not limited to the Timer. It applies to *ALL* enabled IRQ's.

It is a one line simple change and fixable in a jiffy.

Please fix ASAP !

Change priority from 0 to anything higher than 5, recommended by the FreeRTOS folks.

I guess, this FreeRTOS IRQ priority BUG exists within @alister​  Ethernet fixes also.

"   /* Peripheral interrupt init */

   HAL_NVIC_SetPriority(ETH_IRQn, 12, 0);

   HAL_NVIC_EnableIRQ(ETH_IRQn); "

Thank You,

Manu

2 REPLIES 2
TDK
Guru

> HAL_NVIC_SetPriority(ETH_IRQn, 0x7, 0);

> It turns out that, the interrupt priority 0 (the highest).

> That priority is too high to be making FreeRTOS API calls from. Hence the problem.

But this sets the (preemption) priority to 7, not 0. The last argument is the subpriority, which is unused in the normal priority grouping scheme.

In all ethernetif.c files within the repository, the priority is always set to 7:

https://github.com/search?l=&p=1&q=HAL_NVIC_SetPriority+repo%3ASTMicroelectronics%2FSTM32CubeH7+path%3A%2FProjects%2F+filename%3Aethernetif.c&ref=advsearch&type=Code

If you feel a post has answered your question, please click "Accept as Solution".

Hi TDK,

You are right. I stand corrected. Sorry about the noise!

Argh! I still need to find out what causes the freezes.

This is really painful this platform. It has caused only debugging and even more debugging.

Somehow, the freeze disappearing, appears to be superficial, then. :(

Thanks,

Manu