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!
Hello, may I ask how to solve or what causes the ready task to be modified abnormally? I ran into the same problem with cotex-M33 kernels
You have to provide more details. What do you mean by “ready task to be modified abnormally”? Which FreeRTOS version are you using? Which hardware are you using?
freertos_config.ino (7.9 KB)
Thanks for your reply, here is my configuration file.
- This is where I get hardfault while debugging
- The value of the retrieved member variable pvOwner is 0
- I sacrificed the real-time nature of all interrupts to solve this problem, but it still happens. Do you have any other debugging tools?
The images you shared show pxCurrentTCB
as NULL - it does not seem correct and seems like a memory corruption. Can you use data breakpoint to find the cause of memory corruption? You can declare a variable next to pxCurrentTCB
(say pxCurrentTCB2
) and put a data breakpoint on it. Since this variable should never be changed, any change detected is a memory corruption. This relies on the assumption that the compiler will put pxCurrentTCB2
next to pxCurrentTCB
and the corruption is not limited to 4 bytes only.
@zzz you are replying to a really old thread - I recommend starting a new support topic.
@rtel @aggarg Thanks for your reply. The problem has BEEN found. As described by other users on the forum, most of these errors are due to incorrect interrupt priority configuration. I didn’t read the manual carefully and configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY was misconfigured.
Thank you for reporting back!