When using blocking related code, the program is stuck in OSIF_SemaWait()

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

When using blocking related code, the program is stuck in OSIF_SemaWait()

跳至解决方案
1,599 次查看
Jau
Contributor II

I am currently developing with the S32K144.

Use IDE:S32 Design Studio for ARM Version 2.2

I configured a 200ms cycle lpit and used LPUART_DRV_SendDataBlocking() in the interrupt callback function to send data through the serial port cycle.But the program gets stuck at OSIF_SemaWait().

Similarly, the same situation occurs with SPI_MasterTransferBlocking().

Normal output when using non-blocking interface.

I tried to use this post's approach (https://community.nxp.com/t5/S32K/LPUART-DRV-SendDataBlocking-in-bootloader-not-allowing-User/m-p/97...), but it didn't work.

What should I do to use the blocking class interface properly?

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

Hi @Jau 

this is caused by priorities, most likely. Even if you call blocking function, an interrupt is used anyway (if DMA is not configured). You can take a look at source code:

lukaszadrapa_0-1701074546743.png

So, if LPIT has higher priority, it won't work.

To avoid such issues, I would use non-blocking function in interrupt handlers.

Regards,

Lukas

在原帖中查看解决方案

4 回复数
1,569 次查看
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi @Jau 

this is caused by priorities, most likely. Even if you call blocking function, an interrupt is used anyway (if DMA is not configured). You can take a look at source code:

lukaszadrapa_0-1701074546743.png

So, if LPIT has higher priority, it won't work.

To avoid such issues, I would use non-blocking function in interrupt handlers.

Regards,

Lukas

1,565 次查看
Jau
Contributor II

Hi,Lukas:

Thank you for your answer.
 
I think it's time for me to use another method to periodically output data.
 
One more question, can I go through Processor Expert to modify the interrupt priority to achieve the function output at LPIT? But it seems that there is no option to do so in the interrupt_manager module or in the UART module.
 

Regards,

Jau

标记 (1)
0 项奖励
回复
1,541 次查看
lukaszadrapa
NXP TechSupport
NXP TechSupport

You need to use function INT_SYS_SetPriority().

Regards,

Lukas

0 项奖励
回复
1,534 次查看
Jau
Contributor II

I will give it a try, thanks for the reply!

Regards,

Jau

0 项奖励
回复