MODSERIAL bug, not blocking on transmit

26 Apr 2011

I'm having problems with MODSERIAL not blocking properly on transmit. When my program outputs a lot of data with printf and putc, the output buffer fills and then characters start being dropped.

Since I don't need buffering on output, I've tried using a 0 length transmit buffer so that only the hardware FIFO is used, but this also drops characters when the FIFO is full. At least in this case, I've found the bug. In MACROS.h, the declaration

#define MODSERIAL_THR_HAS_SPACE (int)_LSR&MODSERIAL_LSR_THRE

should be

#define MODSERIAL_THR_HAS_SPACE ((int)_LSR&MODSERIAL_LSR_THRE)

otherwise the test in PUTC.cpp

while (! MODSERIAL_THR_HAS_SPACE) ; // Wait for space in the TX FIFO.

fails to work as intended because both the not and cast operators have higher precedence than bitwise-and.

26 Apr 2011

Thanks for the feedback. Fixed in v1.20.