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

UARTE can only be used with 1 byte buffers?

I want to use UARTE to handle terminal style messages. That is, messages are ended with a newline, I have absolutely no idea how long they will be, and the delay between multiple messages is arbitrary. 

This is trivial to handle with the old UART, and I should be able to simulate that behavior with UARTE by using double buffering of 1 byte buffers. A bit of overhead with needing to handle two events, RXREADY and RXSTARTED, but doable. But I do not see how to do this with longer buffers:

- using STOPRX/STARTRX will disable the receiver for a short moment, so with bad timing I will lose a character

- there is no way to figure out the count of currently transferred bytes without stopping RX: AMOUNT only updates at the end of a transfer, and using the hack to count the RXREADY means dealing with the unknown, small delay of the DMA transfer, and I would sacrifice a TIMER, or use an ISR each char.

Ideally I would love to see this resolved in the hardware. Add an IDLE event that fires after the RX line has been idle for a given number of bit times. A 6 bit counter to program the delay would be nice. A NEWBLOCK task that would cause the DMA to finish the current block, only writing out a single byte if in progress, and immediately start a new block (with the ENDRX/RXSTARTED events)

Related