This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Buffering UART data

I know this has been asked a couple of times, but I haven't been able to find a straight forward answer.

I have a GPS module that spits out data via UART (no flow control). I would like to have the data stored into a buffer until I am ready to ready read it. The buffer might still be empty, partially filled, or full when I read it. Doesn't matter, I just want to read whatever is there whenever I want. If the buffer gets filled, it's fine if the data gets dropped. I plan to make the buffer big enough that that shouldn't happen, but if it does, doesn't matter.

If it makes a difference, I am running the nRF52840 in a mesh network (Mesh SDK 4.1.0 / SDK 16.0.0). Working off the light switch example.

I've read about using app_uart.c, app_uart_fifo.c, the serial library, etc and am just not sure what to use to accomplish this.

Then there is UART vs UARTE. If I understand what I read correctly, UARTE with EasyDMA can directly put the data in a buffer, but I can't go read it until the buffer is full and not before?

Thanks.

Related