S32K144 Uart Async Receive message fail

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

S32K144 Uart Async Receive message fail

828 Views
KILLERzheng
Contributor IV

I create a S32K144 project with MCAL based on SDK(PlatformSDK_S32K1_2021_08_S32K144_M4F), and I want to receive and send message via Uart. It could send message out, but when I try to receive uart message via the function Std_ReturnType Uart_AsyncReceive(uint8 Channel, uint8* Buffer, uint32 BufferSize), it could not work well, especially when the BufferSize is not equal to the number of byte that the slave answers. In this case, the Uart_AsyncReceive return the uart receive is ongoing and I have to abort receive otherwise it could not send any message out again.

I want to know is there any better way to deal with the case that we don't know the answer length before we send the ask command?

KILLERzheng_0-1641885123233.png

 

Tags (1)
0 Kudos
1 Reply

800 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

try to use continuous reception, having some longer or circular receive buffer, doing single byte reception and within each rx callback check receive byte if the current receive should be finished or not.
Refer to attached example, based on previous SDK. But functions should be similar .

BR, Petr

0 Kudos