UART DMA problems。CPU isS32K118

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

UART DMA problems。CPU isS32K118

685 Views
zhaowei961
Contributor III

Every time I use it, I need to call the receive function once to turn on the receive function. I need the DMA function to be on all the time and use it when I have data. But the library function is not implemented in this way. Every time I receive data, it will turn off the receiving function. How can I know when I receive the data? Is there a solution?

Labels (1)
0 Kudos
2 Replies

575 Views
B46399
NXP Employee
NXP Employee

Hello,

For the usecase you described, a suitable implementation would be using an RX callback. The example project provided in the SDK shows such an implementation.

The idea is to install a callback, then call the receive function for one byte; once the first byte is received, the callback is called and inside the callback you can call LPUART_DRV_SetRxBuffer to update the receive buffer address. When no more bytes are expected, the communication is terminated (buffer is not updated anymore) - this will shut down the rx logic (and dma requests as well). This approach implements a continuous receive scenario, where the hw logic is not reinitialized for each transfer, basically receiving a variable number of bytes.

Please let me know if you have other questions!

Regards,

Vlad Lionte

0 Kudos

575 Views
zhaowei961
Contributor III

thank you for your help.I will test and reply later.

0 Kudos