Interrupt in FreeRTOS for S32K144

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Interrupt in FreeRTOS for S32K144

跳至解决方案
2,815 次查看
AnhNguyenDuc
NXP Employee
NXP Employee

I have a project using UART interrupt like this(pseudo code):

main(){

setPriority(UART, 7);

wait_tx();

func1();

};

Run this project, I can reach func1(). Then I import FreeRTOS into my project (with default configuration), then I stuck at wait_tx(). Then I try to change configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY from (0x01) (default) to (0x09) (bigger than Uart's priority) then I can reach func1(). I see that: configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY use to configure to call FreeRTOS API from ISR. But in my UART interrupt function I dont use any FreeRTOS API. What is my problem ?

 

0 项奖励
回复
1 解答
2,802 次查看
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

as mentioned in this article:

https://www.freertos.org/RTOS-Cortex-M3-M4.html

"...any interrupt service routine that uses an RTOS API function must have its priority manually set to a value that is numerically equal to or greater than the configMAX_SYSCALL_INTERRUPT_PRIORITY setting."

LPUART driver uses OSIF. If there's no freertos in your project, baremetal version of OSIF is used. Once you add freertos, freertos version of OSIF is used. So, the condition above should be met.

I guess that this could be the reason.

Regards,

Lukas

在原帖中查看解决方案

3 回复数
2,803 次查看
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

as mentioned in this article:

https://www.freertos.org/RTOS-Cortex-M3-M4.html

"...any interrupt service routine that uses an RTOS API function must have its priority manually set to a value that is numerically equal to or greater than the configMAX_SYSCALL_INTERRUPT_PRIORITY setting."

LPUART driver uses OSIF. If there's no freertos in your project, baremetal version of OSIF is used. Once you add freertos, freertos version of OSIF is used. So, the condition above should be met.

I guess that this could be the reason.

Regards,

Lukas

2,776 次查看
AnhNguyenDuc
NXP Employee
NXP Employee

Thank you. So, When I create a project on SDK and use LPUART, will LPUART use OSIF by default?. Can you explain more about this point or share a document about it?

0 项奖励
回复
2,745 次查看
lukaszadrapa
NXP TechSupport
NXP TechSupport

Some details about the OSIF can be found in the user manual:

c:\NXP\S32DS.3.4\S32DS\software\S32SDK_S32K1XX_RTM_4.0.2\doc\S32SDK_S32K144_UserManual.pdf

Or take a look at the source code of LPUART driver to see how it is implemented. It's used for timeouts, for example:

lukaszadrapa_0-1641798136264.png

Regards,

Lukas

0 项奖励
回复