Erich Styger gives me the answer:
“The thing is: check your configMAX_SYSCALL_INTERRUPT_PRIORITY setting. You cannot call any RTOS API functions like xSemaphoreGiveFromISR() from an interrupt which is higher (numerically lower) than configMAX_SYSCALL_INTERRUPT_PRIORITY.”
So I change the priority, and it is working
NVIC_SetPriority(PIT_IRQ_ID, configMAX_SYSCALL_INTERRUPT_PRIORITY-1);
Thanks
Raul
I came in to drop a comment that the solution seemed to mark
NVIC_SetPriority(PIT_IRQ_ID, configMAX_SYSCALL_INTERRUPT_PRIORITY-1);
as correct solution but it was not. That would actually put PIT_IRQ_ID to have an interrupt higher (numerically lower) than configMAX_SYSCALL_INTERRUPT_PRIORITY.
Erich Styger gives me the answer:
“The thing is: check your configMAX_SYSCALL_INTERRUPT_PRIORITY setting. You cannot call any RTOS API functions like xSemaphoreGiveFromISR() from an interrupt which is higher (numerically lower) than configMAX_SYSCALL_INTERRUPT_PRIORITY.”
So I change the priority, and it is working
NVIC_SetPriority(PIT_IRQ_ID, configMAX_SYSCALL_INTERRUPT_PRIORITY-1);
Thanks
Raul
Hi, Raul,
I have downloaded the SDK_2.0_FRDM-K64F.zip, I have checked the directory, there are Freertos example in SDK. For the event example, pls refer to the following example:
D:\Freescale\SDK2.0\boards\frdmk64f\rtos_examples\freertos_event\kds
For the interrupt example, you can refer to the directory:
D:\Freescale\SDK2.0\boards\frdmk64f\rtos_examples\freertos_swtimer\kds
You can post an event in the callback function of the swtimer, the task with the xEventGroupWaitBits() will be running with OS intervening..
You can refer to the Richard Barry reply for the task efficiency.
Hope it can help you.
BR
Xiangjun Rong
Hi Xianju
My problem is to synchronize an interrupt with a task (in this case when a buffer is full).
I understand that with FREERTOS is necessary to use xSemaphoreGiveFromISR or another instruction FromISR, but it is necessary to change the priority of the interrupt peripheral.
If you have an example for the FRDM K64 board with SDK and FREERTOS.
Thanks in advance
Raul Cortes
Information on how the interrupt priorities relates to FreeRTOS can be found on the following page: RTOS for ARM Cortex-M
There are lots of ways of doing this - the best depends on your particular scenario. The most efficient method would be to use a direct to task notification. You will find an example of the scenario you highlight on this page. You could also use a binary semaphore (see the example on the xSemaphoreGiveFromISR() page), counting semaphore, queue, event group, (others?), but as those methods use an intermediary object rather than sending the event directly to the task they will be less efficient.
Hi Richard
My problem is to synchronize an interrupt with a task (in this case when a buffer is full).
I understand that with FREERTOS is necessary to use xSemaphoreGiveFromISR or another instruction FromISR, but it is necessary to change the priority of the interrupt peripheral.
If you have an example for the FRDM K64 board with SDK and FREERTOS.
Thanks in advance
Raul Cortes