Sorry about the headline. When I get excited, my German heritage sneaks out. But godammit, it’s justifed.
Okay, so the first attempt at creating PCBs for the Zolatron 64 6502-based homebrew computer was not an unalloyed success. I never got as far as testing the backplane, serial board and VIA board because of a monumental screw-up on the main processor board. Actually, there were two… no, in fact there were three, but only two that I knew about when I revamped the KiCad files and ordered the A.2 version of the board.
I cheaped out when I placed that order and went for the lowest-cost postage option. I knew there was going to be a long wait for the boards to ship from China. To pass the time, I played around with the schematics and, to my horror, realised they were based on the wrong EEPROM chip. I’d originally designed the Zolatron to use an 8KB EEPROM. I’d since decided to switch up to a 32KB EEPROM, of which I’m using half. I made the change on the breadboard version, but as this was at a time when I was nowhere near ready to order boards, I never reflected that change in the schematics.
It wasn’t a huge error, as it turns out. The 8KB and 32KB EEPROMS have almost identical pinouts, the main difference being that you need to run address lines A13 and A14 to the 32KB version. I hadn’t done this on the PCB. But hell, that’s why nature invented bodge wires.
When the boards finally turned up, I soldered on the IC sockets and quickly ran wires from the A13 and A14 pins on the RAM to the equivalent pins on the EEPROM. And all was good.
Finally, I could power up the machine.
At first, nothing worked. I was expecting to see some text on the LCD screen plugged into the VIA board and similar text sent via serial to my workbench computer. I got neither.
Until, that is, I took out the serial board.
One of the advantages of a backplane design is that you can remove entire sections of the machine when hunting down bugs. And so it was that, when I pulled the serial board, the LCD screen sprang into life with the expected message.
Yay! Now three out of four boards are working. But what’s up with the serial?
A capacitor too far
First, I had a bad case of make-it-up-itis, which is the opposite to RTFM. The serial board has its own crystal, which attaches to the XTAL1 and XTAL0 pins on the 6551 ACIA. Now, I’m accustomed to bunging crystals on my circuits. I’ve made many microcontroller-based boards. And in every case, each of the crystal’s two pins has been connected to ground via a capacitor – typically 22pF. So that’s what I did here.
As the serial board wasn’t working, the first thing you naturally do is poke at each signal with the oscilloscope. When I tested the XTAL pins I got a signal that wasn’t much more than a whole mess of noise. Clearly I’d done something wrong.
And so it was back to the datasheets. And, indeed, every single one of them (as well as various pages on the interwebs) talked about having a 22-33pF cap from the XTAL1 line to ground. Not a single one mentioned having a second cap on the other leg of the crystal. Uh-oh.
So I cut off the second cap and instantly achieved a nice clock signal. And now the computer wasn’t hanging up when the VIA board was also plugged in. Progress.
I also made a couple of bodges to fix odd things I’d done in the KiCad schematic. First, the 6551 has two chip enable pins – one active high the other active low. In the schematic, I’d decided to connect the active high one to A13. Why? No-one knows. I cut a trace and soldered on a resistor to pull this line permanently high.
Second, I’d forgotten that I needed to pull the /CTS line low. So on went another bodge wire.
Even better, the serial board was now outputting text as expected, which was happily turning up in my terminal. Job done? Not quite, because serial is a two-way street, and mine had a sign saying ‘no entry’.
In other words, it could send text but not receive it. Typing stuff in resulted in a whole lot of nothing.
Back to probing with the scope. The text was certainly being sent by the terminal. The RX line on the serial board was at 5V at idle, which is normal, and the signals coming through were pulling this down to 0V. So we had a good signal coming in.
Poking around the other signals, my suspicion fell on the /IRQ output. This should normally be high. When the 6551 receives data, it pulls the /IRQ low to tell the 6502 that data has been received.
The signal was high alright (albeit a tad noisy). But when I sent data across the serial connection, the /IRQ dipped only as far as, roughly 3.3V – and then remained there. It never made it down to 0V and therefore never trigged the interrupt routine in the ROM code. I think the 6551 was continuing to pull this as low as it could while being fought by something else pulling it high.
I’d included a pullup resistor on the /IRQ line on the main processor board. I thought I’d used a 10KΩ resistor, but in fact I’d used the somewhat stronger 3.3KΩ.
The 65C22 VIA chip on the VIA board is also connected to the /IRQ line. I tried removing the VIA board, but at that point the serial board didn’t work at all. I eventually figured out that that was because my ROM code looks for a signal from the LCD screen, and basically goes into an eternal loop if it’s not present. So that didn’t tell me much.
I like to try working through problems myself, but there are always going to be times when you run out of ideas. So it was time to hop over to the 6502.org forum, where the wisdom of the ages is never far away. Users Garth Wilson and Dr Jefyll were quick to provide useful advice, such as checking the voltage at the ground pin of the 6551 (which was fine, by the way). Garth pointed me to a part of his invaluable 6502 interrupts primer, which eventually led me to a solution.
In that primer, he mentions the difference between the 65C22S and 65C22N versions of the VIA chip. The latter has an ‘open drain’ /IRQ output. That means the signal is connected to ground when active, but essentially floats when inactive. The ‘S’ version of the chip, however, is more driven. Its /IRQ output uses a ‘totem pole’. That’s a phrase I’d seen around a fair bit but never thought to investigate until now.
With a totem pole output, there are two transistors, one mounted directly above the other (giving them the appearance of a totem pole in the schematic). The signal pin is connected at the point where the two transistors meet. One transistor pulls the signal to ground, the other positively pulls it high. No floating.
It would seem the 6551’s poor little legs were struggling to overcome both the 65C22S’s totem pole output and my pullup resistor. I tried simply removing the latter, with no joy. So I replaced it (with a 4.7KΩ resistor because … whimsy), and swapped the 65C22S with a Rockwell R6522.
At which point everything worked. Yee-hah!
The Zolatron 64 currently resides in a metal frame (mostly MakerBeam, some Meccano). One day it’ll have a fancy case of its own.
These were experimental versions of the boards. I now have the confidence to go on and develop the next iterations. I’ll probably do another spin of the serial board, with the bodges incorporated. But that’ll be it for the 6551 ACIA. The next serial project is going to be based around the NXP SC28L92 which provides two serial ports. I already have a board mostly designed for that.
I’m thinking about a dual VIA board, with the PLCC version of the 65C22.
As for the main processor board, I already have the next iteration of that. I got so fed up waiting for the A.2 board to arrive (and was starting to think it wouldn’t) that I designed and ordered the A.3 version, with the address lines fixed. Because I didn’t cheap out on carriage this time, it actually arrived the day after the A.2 board!
And I have an enhanced version of the backplane prepared – this time a 4-layer board.
Now to write some code…