Dear NXP Staff,
I am using LPC 54114 for software development. I try to modified the Example "usart_dma_transfer" to read in UART data array through UART_Rx pin,the data is stored in 40 bytes Rx buffer and all the 40 bytes data in the Rx buffer will sent out through UART Tx pin. (The length of data receive is shorter than 40 bytes.)
In my data Rx test (Please see attached pic.), the first data array is well received.
For second array, the data is accumulate after the first array.
After third array received, part of data is shift to next 40 bytes Rx Buffer.
My question is that , how can I clear all data in Rx Buffer after each data read and move the data pointer to the first byte of the data array, so that all new incoming data is located at the first byte of the Rx buffer?
Please advise if there are any command/instruction can do so.
My testing code is also attached for your reference.
Thanks,
Eric
Hi Eric,
I'd recommend to use circular buffer. Circular buffer - Wikipedia
Regards
Marek
Hi Marek,
I tried to use the circular buffer, But when I read the data I found some data is not ready in the RX buffer, only first half of data is ready. I have to delay sometime and the 2nd half of data is ready in the buffer . Is there any method or status flag to read and show the 2nd half of data is ready in the buffer?
(Please see the detail in the attached picture)
Regards,
Eric
Hello Eric,
I see you use DMA transfer, how about use DMA interrupt or flag,
after DMA finish transfer for tow data, use UART TX to send.