There’s nothing quite like the experience of picking up a project that you haven’t worked on in a long time: the comfort of the familiar, the frustration of the forgotten, the dark mutterings about how your past self failed to document your work…
For a while now I’ve been feeling the urge to work on my Project:65 breadboard computer. The last time I put serious effort into it was during the 2013 Retrochallenge, when I wrote the beginnings of an SD card “disk” interface. I’ve fired it up a few times since then to putter around in BASIC, but nothing major. It was time to get my hands dirty again.
At first, I thought I’d give the SD card interface some more attention. The P65 still has an Arduino hanging off the side of the breadboard which makes the whole thing kind of awkward. But as I was checking the system out, one of its other limitations jumped out at me, and I decided to focus on the serial port for a while.
Here’s a little background: The serial port on the P65 uses a Maxim MAX3100 UART (Universal Asynchronous Receiver/Transmitter) connected to an FTDI serial-to-USB cable. This is a relatively modern piece of hardware, and the idea is that a microcontroller can talk to it easily using SPI, which is a synchronous serial protocol – unlike RS-232, it uses an explicit CPU-controlled clock, and that means its timing requirements are easier for the CPU to handle.
Project:65 PC ================================================= ================= _____ _____ _____ | | CPU BUS | | SPI | | RS-323 ___________ | | | | | | | | |65c02| |65c22|--CLOCK--| MAX | | FTDI | | CPU |--ADDRESS--| VIA |---XMIT--| 3100|------XMIT-----| Serial | | |----DATA---| |---RECV--| UART|------RECV-----| to USB | | | | | | | | Adapter | |_____| |_____| |_____| |___________| (How retro are we? ASCII DIAGRAM RETRO!)
Yeah, it’s a little involved. But at the time it was fairly easy for a novice to set up. What it wasn’t was fast. I mean, it was able to keep up with my typing, no problem. And when I wanted to download software to it, I had an XMODEM library that could handle flow control and keep everything running smoothly. But if I just wanted to copy a bunch of text down to it – say, the text of a BASIC program – things went badly wrong. You can see an example up at the top of the post – the BASIC interpreter and the software I wrote to interface with the MAX3100 just couldn’t keep up. It’s actually a bit worse than that – I’ve learned over the last few days that there were other subtleties of the 3100 that I was missing, too. But speed was certainly a problem.
Now when I first got the Project:65 computer up and running, I was able to deal with this problem by telling my terminal program on the PC to insert pauses after individual characters and lines. I could live with that, but I didn’t really like it. I briefly considered replacing the MAX3100 with a different UART. I actually have a 16550 UART that I picked up a while back for that purpose – it could interface directly with the CPU, cutting out the VIA and a whole bunch of software cruft. I just don’t seem to be able to find it right now.
Faced with the choice of cleaning my office in search of the missing 16550 or starting on a major software project, I think there was only one logical thing to do:
PROJECT:65 SERIAL PORT REDESIGN =============================== GOAL: 9600bps communication with no per-character or per-line pauses. 19.2k would be even better. PLAN: - Optimize bit-banged 65c22 SPI code. - Add serial port transmit and receive buffers. - Interrupt-based servicing of serial port. - Support hardware flow control to prevent overruns.
Ooh, doesn’t that look official?