Skip to main content
Associate II
July 12, 2025
Solved

How to configure interrupt priorities in a ThreadX project

  • July 12, 2025
  • 4 replies
  • 648 views

Hello,

From my understanding in FreeRTOS, there is a defined highest priority one should set for interrupts whose ISRs may call RTOS APIs (configMAX_SYSCALL_INTERRUPT_PRIORITY).
For the same reasons, I would expect ThreadX to have a similar limitation, and to that extent I have found other ST forums posts suggesting one should set lower priorities for any interrupts whose ISRs may call RTOS APIs, but I can't find any documentation that explicitly states what the highest safe/allowable priority is, similar to FreeRTOS.

How do I know what's the highest interrupt priority I can safely set in such cases? Is there any documentation from ThreadX that I'm missing, because I can't seem to find any mention of this.

For context, I am using a U5 series MCU and I want to call queue related APIs in my CAN Rx callback.

Best answer by Haithem Rahmani

Hi @Hareesh_S  @Pavel A. 

Actually the BASEPRI support is available in ThreadX and configurable in STM32CubeMX.

HaithemRahmani_0-1752572204920.png

regards
haithem.

4 replies

AScha.3
Super User
July 12, 2025

Hi,

That's not so difficult:

If you want the rtos working, leave it it's high priorities.

Your tasks then at lower priorities as you like.

->

AScha3_0-1752395227281.png

 

"If you feel a post has answered your question, please click ""Accept as Solution""."
Pavel A.
Super User
July 13, 2025

in ThreadX you can customize macros TX_DISABLE and TX_RESTORE to behave like in FreeRTOS (use BASEPRI), but it seems that CubeMX GUI does not have this option.

 

Hareesh_SAuthor
Associate II
July 13, 2025

@AScha.3 
Yeah it's pretty straightforward in practice, but I just want to know (for educational purposes) what the actual hard limit is. I would assume its whatever the lowest priority is between pendSV, SysTick and SVCall?

@Pavel A. Interesting, but yeah, I was just assuming that ThreadX themselves would have a hard limit, or mention somewhere what that recommended limit is

Haithem Rahmani
Haithem RahmaniBest answer
ST Employee
July 15, 2025

Hi @Hareesh_S  @Pavel A. 

Actually the BASEPRI support is available in ThreadX and configurable in STM32CubeMX.

HaithemRahmani_0-1752572204920.png

regards
haithem.

Hareesh_SAuthor
Associate II
July 22, 2025

Hello @Haithem Rahmani 

Okay so essentially there is no fixed absolute limit and it is up to developer's discretion what the BASEPRI value is?
I don't fully understand the intended benefit of it in that case, but this answers my initial question regardless.
Much thanks!