Serial FIFO and Serial.attach

27 May 2010

Hello,

Is there a way to only generate an interrupt (via the Serial.attach interface) when the receive buffer is at a certain count or after a timeout (maybe not now but as a future enhancement to the Serial class?) ?  I have read that there is a 16 byte hardware FIFO buffer that could be taken advantage of.

Serial.attach appears to call the function when there is 1 character in the buffer and this is overwhelming my app.

I have a readable loop in my "interrupt handler" that is gathering bytes and pushing them into a temporary buffer until there are none left (my serial input is 9600 baud) and sometimes there are 2 bytes in there but most of the time there is only 1 byte.  This just seems inefficient to me.

I am looking at Richard Sewell's SerialBufferdDemo which looks good but it just attaches using Serial.attach and would experience the same interrupt rate.

 

Thanks

27 May 2010

We'll take a look...