how to synchronize a freertos task with an interrupt using an event ?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

how to synchronize a freertos task with an interrupt using an event ?

ソリューションへジャンプ
9,015件の閲覧回数
RaAolCortAcsMat
Contributor III

Do you have an example ?

Thanks

ラベル(1)
1 解決策
7,247件の閲覧回数
RaAolCortAcsMat
Contributor III

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

元の投稿で解決策を見る

9 返答(返信)
5,354件の閲覧回数
danny30
Contributor I

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.

0 件の賞賛
返信
5,352件の閲覧回数
ErichStyger
Specialist I

yes, you have to remove that -1. Or add something to it.

0 件の賞賛
返信
7,248件の閲覧回数
RaAolCortAcsMat
Contributor III

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

7,247件の閲覧回数
josei
Contributor II

In KDS with PEx use: INT_SYS_SetPriority(PIT_IRQ_ID, configMAX_SYSCALL_INTERRUPT_PRIORITY-1);

0 件の賞賛
返信
7,248件の閲覧回数
xiangjunrong
Contributor IV

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

7,248件の閲覧回数
RaAolCortAcsMat
Contributor III

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

0 件の賞賛
返信
7,248件の閲覧回数
FreeRTOS_org
Contributor IV

Information on how the interrupt priorities relates to FreeRTOS can be found on the following page: RTOS for ARM Cortex-M

0 件の賞賛
返信
7,248件の閲覧回数
FreeRTOS_org
Contributor IV

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.

7,247件の閲覧回数
RaAolCortAcsMat
Contributor III

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

0 件の賞賛
返信