Skip to main content
MK..1
Associate III
October 8, 2024
Question

FreeRTOS, preemption priorities and IRQ response time

  • October 8, 2024
  • 1 reply
  • 1550 views

Hi

in my project I have enabled FreeRTOS, so the NVIC prios 0-4 are reserved for FreeRTOS.

I need to generate a highly accurate 1 sec timer interrupt.

Is it correct that FreeRTOS interrupts might delay my (cortex) timer intterupt handlers to be called?

Is there a way to figure out what the jitter of my timer will be?

Thx

 

1 reply

TDK
October 8, 2024

You can still use interrupts with high priority, they just can't call FreeRTOS functions. If this is critical to your application, there should be a way to make that work. If the 1sec timer is the most important things, set it to priority 0 and have everything else be 1+.

"If you feel a post has answered your question, please click ""Accept as Solution""."
MK..1
MK..1Author
Associate III
October 8, 2024

Well, Freertos/cube Reserves priorities 0-4. So the Timer Interrupt will have prio 5.  Right?

Bob S
Super User
October 8, 2024

FreeRTOS does not reserve any priorities.  The LIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY setting in CubeMX specifies the lowest interrupt priority value (i.e. highest priority) that is able to call FreeRTOS functions, as @TDK mentioned above.  If you use the default value of 5, that means priorities 0-4 are still available for you to use, but any interrupt code running at those priorities cannot call FreeRTOS functions (i.e. no mutex, semaphore, queue, etc. calls).