Communication isn’t easy. It’s easier with computers than with women, but even with computers, the datasheets can be ambiguous.

Getting RTS / CTS flow control working was a bit of a challenge and I had to try a few things before I finally got something that worked.

The problem I had was that the CPU couldn’t keep up a long continuous stretch of text. If I’m going to use puTTY to just send over an intel hex file, I need it to keep up. All attempts to get it to stop communication by deasserting RTS weren’t fast enough and the internal FIFO in the UART (8 bytes) overflows. This will probably always be a potential problem.

The scheme I finally had to settle on is to keep RTS deasserted (suppressed) except when in getchar and when the receive ring buffer is empty. Immediately upon getting data, the RTS is deasserted. Hopefully an overflow won’t happen. It does in 115200 baud, though. And this is after my digikey order arrived and I replaced the 2MHz oscillator with a 4MHz oscillator.

Anyway, I can put a pile of stuff on the clipboard, paste it into puTTY, and watch it echo completely and correctly and long as I don’t overflow my buffer I use to call gets.

So a question comes up–what if I wanted to use 115200 baud? I could use a couple of pins on my remaining under-utilized CPLD and combine the IRQ from the UART with the RTS output of the UART. A sort of “assign nRTSout = nRTSin | ~nIRQ;” which would deassert RTS when the interrupt is activated. Of course, the interrupt is open collector wired AND, so the timer tick would also interfere. Though since it’s all on the same CPLD, the IRQ from the UART could come to it and then they could combine in the CPLD and an output of the CPLD could drive the INT pin of the Z-80.

But that’s something to think about for v2.0.

Anyway, now it’s time to start cleaning up the code and making it presentable. Then I can can say that I have ticked off the UART driver sufficiently to start working on the other stuff which is going to enhance my productivity–printf, flash programming, and bank switching. I also got a few other parts that I’ll install gradually over the next few days.

But it’s 11:30pm so time to call it a night…..