Go Down

Topic: High or low baudrate when using timed interrupts. (Read 1 time) previous topic - next topic


Ooohh I so dislike speculating from an absence of facts, but still feel I might contribute here, or at least get my wrong ideas rejected.

I have made myself a small serial library that uses active polling and watching millis() to send characters using Serial.print.

My experiments showed Serial.print (and presumably Serial.write) to BLOCK when sending more than one char.

It takes "no" time to send a single character, but you can not send another until that one has pulsed its way out of the serial line, ie I have to wait for second/baudrate before attempting the next character send, or I will block again.

So I simply call my serial output package in the loop() and have a different output routine that simply stacks the characters strings in a buffer (that the active poll routine will output in due time).
This is simple singlethreaded code, no interrupts, no reentrant code nor locking datastructures to worry about :)


Neat idea. How do you determine that the port is ready to accept another byte without blocking?


PaulS: A simple timer (a little slower than 1/baudrate). I may not output at the maximum possible rate, but it is fast enough for me.

Go Up