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

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

Jump to solution
1,597 Views
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 Kudos
Reply
1 Solution
1,566 Views
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

View solution in original post

4 Replies
1,567 Views
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,563 Views
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

Tags (1)
0 Kudos
Reply
1,539 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

You need to use function INT_SYS_SetPriority().

Regards,

Lukas

0 Kudos
Reply
1,532 Views
Jau
Contributor II

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

Regards,

Jau

0 Kudos
Reply