Skip to main content
Glenn Rosendahl
Associate II
June 5, 2019
Question

REAL TIME ISR (no interruptions) using the RTOS middlewares , HOW?

  • June 5, 2019
  • 5 replies
  • 1651 views

I using hte RTOS middlewares within CubeMX but I have an ISR routine that can't be interrupted by the RTOS how can I do this?

Many Thanks,

Glenn

This topic has been closed for replies.

5 replies

turboscrew
Senior III
June 5, 2019

There is probably some way to configure the BASEPRI value. Higher priority interrupts (lower number) are not nested, lower priority interrupts are.

In FreeRTOS that's the configMAX_API_CALL_INTERRUPT_PRIORITY.

Piranha
Principal III
June 5, 2019

Interrupt nesting is done by NVIC, not RTOS!

https://www.freertos.org/a00110.html

configMAX_SYSCALL_INTERRUPT_PRIORITY sets the highest interrupt priority from which interrupt safe FreeRTOS API functions can be called.

Therefore You can make higher priority interrupts, but You must not use FreeRTOS API from these. Set that real-time ISR at priority 0 and all other interrupts at lower priorities.

turboscrew
Senior III
June 5, 2019

FreeRTOS does it setting NVIC BASEPRI. And one shouldn't change that without the OS knowing.

From the ARMv7-M ARM:

"BASEPRI

The base priority mask, an 8-bit register. BASEPRI changes the priority level required for exception

preemption. It has an effect only when BASEPRI has a lower value than the unmasked priority level

of the currently executing software.

The number of implemented bits in BASEPRI is the same as the number of implemented bits in each

field of the priority registers, and BASEPRI has the same format as those fields. For more

information see Maximum supported priority value on page B1-526.

A value of zero disables masking by BASEPRI.

Unprivileged accesses are RAZ/WI."