High throughput serial architecture

Hello All,

My project is reading two serial devices (LIDARs) which produce 9 bytes at 100Hz. It has to read the data 24/7 without fail.

My question regards the most robust program structure to do this. I'm thinking to generate an interrupt on every new byte being read into the UART buffers, then use something like... ISR_SerialnAvailable{ while (SerialN.available){ buffer[n] = SerialN.read; n++; if(n>=10){ n=0; 9BytesAvailableInSerialN = TRUE; } } } // end of ISR to move them into a global buffer (buffer[n] above) to be processed in the main loop.

I'm sure this is standard teaching in CompSci, but have little formal training save one Fortran course years ago, so all comments and links would be appreciated. Thank You.

Am I correct to think that your question is NOT about the lidar devices and IS about some other device that is receiving data from the lidar devices.

If so it would be a great help to know what the receiving device is and how it is connected to the lidar devices.

Arduinos already use interrupts to pick up serial data - why reinvent the wheel?

What baud rate is the data being sent at?

Also please always post a complete program.

Have a look at the examples in Serial Input Basics - simple reliable non-blocking ways to receive data. There is also a parse example to illustrate how to extract numbers from the received text.


9BytesAvailableInSerialNGood luck with that declaration.

2x 900 bytes a second is ~20 k bits per second, plus you need to send it somewhere...

So far that’s a doddle for a 16MHz arduino. Should be no problem pumping four or more ports with this data throughput.