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?
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!