Quetions about the task scheduler

I assume the official port is used. I wish I could answer all quetions, but some source code owned by MCU vendor, I don’t have the access.

Agree with @aggarg – I am also interested in the definition of those macros, portDISABLE_INTERRUPTS() and portSET_INTERRUPT_MASK_FROM_ISR(). And I am also interested in the value of configKERNEL_INTERRUPT_PRIORITY.

#define configKERNEL_INTERRUPT_PRIORITY 255

As @aggarg memtioned, configMAX_SYSCALL_INTERRUPT_PRIORITY masks the interrupts which can call FreeRTOS APIs. I am confused, because the ISR priority from my MCU vendor is:

Atomic sections: 3
Radio: 4
LL: 5
USART: 6
Others(default): 7

But configMAX_SYSCALL_INTERRUPT_PRIORITY is 48, which is loaded to basepri before PendSV_Handler calls vTaskSwitchContext. I am confused about 48, which seems cannot mask any ISR. Am I right?

Thanks for asking. Both of them are ulSetInterruptMask(). Then it isn’t the key change that caused this failed sympton.

A value of 48 (0x30) for configMAX_SYSCALL_INTERRUPT_PRIORITY is reasonable if your MCU uses 3 or 4 bits of interrupt priority. Remember that configMAX_SYSCALL_INTERRUPT_PRIORITY is shifted, just like BASEPRI.

If your MCU uses 3 interrupt priority bits, then 0x30 corresponds to interrupt priority 1 (because 0x30 >> 5 is 1). This would work correctly given the interrupt priorities you listed.

If your MCU uses 4 interrupt priority bits, then 0x30 corresponds to interrupt priority 3 (because 0x30 >> 4 is 3). This would also work correctly given the interrupt priorities you listed.

Thanks for your education, Jeff. Checked the doc, my MCU uses 3 bits.

well, if you still experience problems, you should publish your entire freertosconfig.h.

Got it! Thanks for great sharing, RAc!