Section III: FreeRTOS Interrupt Test Experiment

table of Contents

(1) First understand the macros in FreeRTOSConfig.h.

configKERNEL_INTERRUPT_PRIORITY

This macro defines the kernel interrupt priority and determines how many priorities can be.

configMAX_SYSCALL_INTERRUPT_PRIORITY

This macro is to define system interrupt permissions. The interrupt cannot be disabled by the interrupt that is higher than the interrupt priority.

For example: STM32 is set to 16 priority levels, with 0 being the highest and 16 being the lowest. Configured as configKERNEL_INTERRUPT_PRIORITY=15,

configMAX_SYSCALL_INTERRUPT_PRIORITY=5.

The high level interrupt 0-4 will not be blocked by the kernel.

(2) FreeRTOS switch interrupt

portDISABLE_INTERRUPTS(); off interrupt portENABLE_INTERRUPTS(); open interrupt

Interrupts below configMAX_SYSCALL_INTERRUPT_PRIORITY=5 are blocked. Interrupts above configMAX_SYSCALL_INTERRUPT_PRIORITY will continue.

(3) Critical section protection

taskENTER_CRITICAL() and taskEXIT_CRITICAL()

Task-level critical protection code, one entering the critical section and one exiting the critical section.

taskENTER_CRITICAL_FROM_ISR() and taskEXIT_CRITICAL_FROM_ISR()

The interrupt level critical protection code, one enters the critical section and one exits the critical section.