Using serial FIFOs?

05 Sep 2012

Hello,

In some quick testing I’ve done, it appears that when using methods in the Serial class the program waits for each byte to be clocked out before continuing with code execution. For example, if I set the baudrate at 115200 and write 10 putchars in a row, the code takes 10*8*(1/115200) seconds to run.

But from what I understand, the LPC1768 has FIFO buffers on the serial ports that should allow several bytes to be written very quickly in sequence without waiting for each to be clocked out of the port. Then the program could go on to do some other time-sensitive task while the bytes are pushed out automatically.

Does the mbed Serial class not take advantage of these FIFOs? Is there a way to enable them by writing to some configuration register? Might it be possible to use the FIFOs while still taking advantage of the (rather nice) Serial class?

I will continue to look into the issue on my own but any wisdom anyone might have would be very appreciated!

Thanks!

05 Sep 2012

http://mbed.org/cookbook/MODSERIAL that is what you are looking for :)

Granted I don't know exactly how modserial uses FIFO buffers and how it uses ram as buffer, but it is definately the easiest way to get it to work non-blocking.

05 Sep 2012

Erik - wrote:

http://mbed.org/cookbook/MODSERIAL that is what you are looking for :)

Granted I don't know exactly how modserial uses FIFO buffers and how it uses ram as buffer, but it is definately the easiest way to get it to work non-blocking.

That looks great, thank you very much!

12 Sep 2012

Fwiw, MODSERIAL will make full use of the hardware fifo, it's ISR will try to keep the FIFO full from it's own RAM TX buffer.