Tool/software: Code Composer Studio
Hi,
How to setup DMA with UART for variable data length. if any sample code please share it.
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software: Code Composer Studio
Hi,
How to setup DMA with UART for variable data length. if any sample code please share it.
Hi,
There isn't a way to setup a UART DMA transfer with the UART_read/write() APIs to handle variable length transfers automatically. You will need to add some logic in your application code in order to handle variable length transfers.
The most elegant option would be to add a simple fixed-size header packet before every variable length of data that describes the length that the CC3200 should expect. Thus, you'd do a UART_read() for the fixed size header first, then do another UART_read() with the actual length of the data right after that.
Alternatively, you can setup a transfer that is very large in size, with a timeout. Then, you can receive back from UART_read the total amount of actual data that was received, although there will be a delay proportional to the length of the timeout you choose.
Let me know if you have need more clarification or have further questions.
Regards,
Michael