Hi everyone,
I'm looking for suggestions on the best way to periodically sample a UART data stream. I'm connecting to a UART device (car ECU) that outputs a continuous stream of data strings at 9600bps. The data strings are under 8 bytes and contain a start marker and the number of bytes to follow, so it's easy to separate them out. The strings will contain information such as rpm and speed.
My question is, what's the best way to have the UART continuously receive the data stream so the most recent string is available when I need it, while at the same time keeping it's interrupts and cpu needs to a minimum? When I get ready to use a string I'd rather have data waiting than have to clear the receive buffer and wait for a new string to arrive.
My preferred method would be to allow the UART receive FIFO buffer to overflow, but I'm not sure what happens in this situation. Does the UART stop receiving or does the older data get shifted out of the buffer as new data arrives? If it's the later, I can just read the rx buffer and I'm good. If the UART stops receiving, I think I would need to setup an interrupt to copy the rx buffer to an array and clear it so it can continue to recieve.
Thoughts? Suggestions?
Thanks