UART DMA problems。CPU isS32K118

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

UART DMA problems。CPU isS32K118

767 次查看
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?

标签 (1)
0 项奖励
2 回复数

657 次查看
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 项奖励

657 次查看
zhaowei961
Contributor III

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

0 项奖励