Then if I put a break point at xSemaphoreGive(SEM_INT); under periodic task. I found that it looks like execute this line for so many times before xSemaphoreTake( SEM_INT, portMAX_DELAY); been unblocked. The way I test it press F5 when process stop at break point, my expectation is it will execute next line when I press F5. Am I make wrong assumption?
On the other hand, my program freeze at this line for
/* This is the raw value as per the Cortex-M3 NVIC. Values can be 255
(lowest) to 0 (1?) (highest). */
#define configKERNEL_INTERRUPT_PRIORITY 255
#define configMAX_SYSCALL_INTERRUPT_PRIORITY 191 /* equivalent to 0xb0, or priority 11. */
/* This is the value being used as per the ST library which permits 16
priority values, 0 to 15. This must correspond to the
configKERNEL_INTERRUPT_PRIORITY setting. Here 15 corresponds to the lowest
NVIC value of 255. */
#define configLIBRARY_KERNEL_INTERRUPT_PRIORITY 15
The priority mentioned in point 3 refered to NVIC_IRQChannelPreemptionPriority or create task priority? Which is priority 3 for my task.
I saw point 3 before , but I don’t think I have using any API in ISR.
You are calling xSemaphoreGiveFromISR() from the ISR, so you are using a FreeRTOS API function in the ISR. Therefore you *must* set your interrupt priorities correctly otherwise you will get the exact symptom you are describing.
You are setting the interrupt to the highest possible priority, this is exactly what the linked warning is telling you not to do, and will result in the behaviour you are describing.
There are lots of other posts on this subject. Please learn about the MCU before learning about FreeRTOS.
Understand that almost 95% support request on this issue. I go through both purchased FreeRTOS both ebooks but still not fully understand on interrupt nesting priority configuration with FreeRTOS implemented.
#define configKERNEL_INTERRUPT_PRIORITY 255
#define configMAX_SYSCALL_INTERRUPT_PRIORITY 191 /* equivalent to 0xb0, or priority 11. */
Understand that KERNEL_INTTERRUPT_PRIORITY advice to remain at lowest which is 255. But MAX_SYSCALL_INTERRUPT_PRIORITY why set to priority 11? Is this value set for demo or we can change it accordingly to our requirement?
So far I am not facing problem without using RTOS, so I am lack of knowledge in interrupt priority configuration. So I wish that you could guide me on this issue.
From the purchased ebooks, it mentioned that priority of ISR that using FreeRTOS API should between MAX_SYSCALL_PRIORITY & KERNEL_INT_PRIORITY. Is this limit to API that end with “FromISR” or all RTOS API?
If I set my MAX_SYSCALL_PRIORITY to 0, then KERNEL_PRIORITY as default 255. Is that mean my NVIC priority of ISR that using FreeRTOS API can use any priority between 0-255? But changing MAX_SYSCALL_PRIORITY to highest will causing any problem?
irvind,
The only problem that I know that setting MAX_SYSCALL_PRIORITY to 0 will cause is that it then becomes impossible to have an interrupt (that doesn’t call FreeRTOS) , at a priority above MAX_SYSCALL_PRIORITY so that it doesn’t get delayed by critical sections in the kernel and user code. (Non-maskable interrupts/traps still can not call the FreeRTOS API)
quartus,
If you have the same problem, then you probably have the same solution. Any interrupt function that calls FreeRTOS functions must use the FromISR versions, and must have a priority lower (which on some processors is a smaller number and other is a larger number).