2020-11-25 12:41 AM
Evening,
I have been working on a FreeRTOS project for the last six months and all was going well until the last STMCubeIDE & CubeMX update.
Rightly or wrongly, I have been using the usarts with the below interrupt config
/* UART8 interrupt Init */
HAL_NVIC_SetPriority(UART8_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(UART8_IRQn);
Preemption = 0.
After the last CubeMX update, my four uart comms no longer worked.
After much digging, I found that the CubeMX was setting the Uart Preemption = 5, thus generating the below code.
/* UART8 interrupt Init */
HAL_NVIC_SetPriority(UART8_IRQn, 5, 0);
HAL_NVIC_EnableIRQ(UART8_IRQn);
When it is set at 5, my code no longer works. The uart interrupts do not respond at all.
A value of 5 appears to be a reasonable value or even in the range of 5..15.
Why does my code no longer work??
P.S. I used the CubeMX builder for the original project design and used it's defaults.
It would appear that all Preemption's = 0 not just the Uart channels.
Solved! Go to Solution.
2020-11-25 08:35 AM
Hello @NW27
Thanks for your feedback,
Well, when FreeRTOS is enabled the Preemption Priority changes.. if you want to set your IP preemption priority to 0 (or other value less than 5) you need to uncheck its "uses FreeRTOS functions".
Best Regards,
Khouloud
2020-11-25 08:35 AM
Hello @NW27
Thanks for your feedback,
Well, when FreeRTOS is enabled the Preemption Priority changes.. if you want to set your IP preemption priority to 0 (or other value less than 5) you need to uncheck its "uses FreeRTOS functions".
Best Regards,
Khouloud
2020-11-25 01:07 PM
Thanks for your reply.
I understand why the CubeMX is changing it but my question is as to why changing it to 5 from 0 would stop the Uarts from working?
2020-11-27 01:29 AM
It may depends on your application and some configurations .. as a workaround, you can change the priority as mentioned in the first comment if it suits you.
Hope this helped you to solve the problem you have faced.
Thanks for your feedback
Khouloud