This project took a lot longer to work out than I expected, but then I didn’t really expect to blog about it so much either. I suppose I found this a useful way to work out the logic of the problems and solutions for myself.
Nevertheless, at this point I’m pretty happy about the state it’s in. I’m trying to get all the pieces moved into the P:65’s firmware tonight, and get some programs like EHBasic updated before heading out for the holiday weekend.
To briefly summarize what I’ve accomplished over the last couple of weeks:
- Reduced the instruction count for the SPI communication routines that talk to the MAX3100.
- Added read and write buffers for serial data.
- Set up reliable interrupt processing to support high-speed (9600 bps!) serial communication.
- Added support for CTS/RTS handshaking.
Naturally, all of this has been added to the main Project:65 page.
Before starting this little project, I had to add delays between characters when sending files to the P:65 computer, and that is no longer the case. Before declaring everything finished, I did want to see just how fast I could push the communications. I mean, it’s never going to be really fast – with the software SPI implementation I have to send 16 bits just to read or write a single byte.
For the first jump, I changed the initialization code to run the MAX3100 at 19.2 k instead of the 9600 bps I’ve been using for most of the testing. It worked perfectly! So I crossed my fingers and tried 38.4 kbps…
Oh, look at that! You could put this logic analyzer trace in the dictionary next to the phrase “just barely”, but it worked! In the bottom half of the display, you can see the almost constant stream of SPI traffic required to handle the incoming data. And if you look at the topmost line – IRQ – you can’t make out the individual interrupts clearly anymore. Interrupt servicing is taking up almost all of the available CPU cycles. The actual program running on the P:65 computer is getting so few cycles that it can only send bytes out at a fraction of the rate they’re coming in. Even when RTS goes high and the PC stops sending data over the serial port, the program can’t send data out at full speed.
Nevertheless, all of the interrupt processing and handshaking is working like a charm here, and the program is able to read and echo back a large file with absolutely no missing or incorrect characters. That’s what I’d call a success.
I think on that note it’s time to call this little project complete, which is a good thing. I’ve got many other projects calling my attention. Hopefully I’ll be able to find something more visual (that’s not too abysmal) to blog about in the near future.
I want to sign off with a final ironic image. When I was starting this serial port revamp, I considered replacing the MAX3100 UART with a 16550. I mentioned at the time that I had a 16550, but I couldn’t find it. Well:
There. Sitting in a box. On a shelf. In plain sight. Of course.