After struggling to get the 6551 ACIA to work at all, I was then disappointed by the unreliable transmission (thanks to the WDC "tx bug" which also exists in the Rockwell version).
So, I decided to try the 6850 ACIA from Motorola instead. From both a hardware and a software point of view it appears to be an older simpler version of the already very familiar 6551 architecture: less registers (one address line), less options.
The SolutionAfter spending way too much time on this subject the short answer is that I can highly recommend skipping the buggy 6551 and just getting yourself a 6850. I got mine from JameCo for about $8.
I use a 256 byte read buffer that is filled by responding to an interrupt on each character received (just like I was doing for the 6551). For now, I poll the "can I transmit yet" flag before sending each character (this could be done using a buffer and the same interrupt but I haven't bothered with that).
I'm using a 1.8432 mHz can oscillator to generate a clock for the ACIA and unlike the 6551 it has less options when it comes to dividing the clock for slower baud rates: /1, /16 and /64. With this oscillator, /16 results in 115200 baud and /64 results in 28800. Those are pretty much your choices. I chose 28800 - no need to be greedy.
My setup for PuTTY for the terminal on Windows is the same as with my Uno ACIA simulator (except for switching the baud rate up to 28800).
The CircuitFinding reliable looking designs that use the 6551 is easy compared to finding those that use the 6580. Grant Searle's design was a bit much (handshaking lines) so I did a variant on that but without the handshaking.
I noticed that Ben Eater wires one of the 1uF capacitors on the MAX232, the one on the VS+ pin (pin 2), to ground rather than to 5V+. Many of the other designs including Grant Searle's, Hans Otten's and Grant Wilson's all wire the same capacitor to 5V+ instead. This sent me on a wild goose chase to understand why and the short answer is : it doesn't matter. The older spec sheets say you have to hook it to +5V for tantalum and polarized (electrolytic) capacitors. In modern designs we use neat little MLCC 1uF capacitors and they can be wired either way (ground or +V5 from pin 2 on the MAX232).
Another thing to be aware of is that almost all the pinouts for the 6850 that I could find online (image search, datasheets, etc) don't show CS2 as active low like it is correctly shown in this schematic (the little "inverse" bubble left of the CS2 pin):
What's the Schottky diode on the IRQ line about? A simple way of or-ing the IRQs from multiple IO chips for the 6502 (an idea I first saw in Ben Eater's design).
PDF of schematic is in the project attachments.
The BuildStill waiting for my motherboard PCB to arrive so still in stripboard land.
Tried and true testing method of:
- does the magic blue smoke appear when you power up?
- does the supply voltage drop significantly when you power up?
- does it get warm to the touch quite quickly?
Great, no serious hardware errors detected... carry on..
In all seriousness, I do check out the power tracks with a continuity tester before plugging in, both for shorts and to make sure the power lines to each component are good.
Once again I highly recommend splurging on at least an entry level decent oscilliscope like the Siglent SDS1000X-E. Shown above is the incoming signal from my laptop for a space character (0x20). The yellow is the RS232 signal (scale 10V per cell on the scope). The purple is the TTL signal after coming through the MAX232 (scale 5V per cell on the scope).
I tested this part of the circuit before inserting the M6850 chip and before plugging the board into my computer. Very handy.
See the "0x20" (space character) in blue bars at the bottom of the screen? This scope can also decode other serial signals (like I2C for example). Makes it very easy to see when you are winning .. or not.
The CodeMy firmware has gotten quite complex (timer, LCD, keyboard, serial, etc.) so I won't attach the code this time. I'll just include the important snippets here.
There are only two register addresses but they support three registers:
Control
- write only register at the first addressStatus
- read only register at the first addressData
- read / write register at the second address
Yes, my addresses look odd : I have my IO mapped to the zero page. Yours will probably be regular 16 bit port addresses.
Pretty simple initialization. Most of us will use the above options. If not, seek out the datasheet...
That's the IRQ part:
- two bytes on the zero page for read and write pointers
- 256 bytes somewhere in RAM for a read buffer
- an interrupt service routine (ISR) hooked to the IRQ vector
What the hell are "bbr7" and "bbs0"? If you have a WDC version of the 6502, like most of us do, you need to learn about the extra WDC 65C02S instructions : very compact, very handy. This is an excellent reference.
The code above may look a bit abbreviated because I chopped out the noise from my PS/2 driver's ISR.
You could greatly simplify the code if you avoided the whole interrupt and read buffer thing and just poll the RDRF
bit in the Status
register instead:
Yup, I'm sold : for reliable throughput of large chunks of text (think, pasting code via RS232), I'm convinced the MC6850 is by far the better option to get working easily.
As usual, if you get stuck on your mission to get an ACIA working with your 6502, please feel free to reach out to me in the comment section below.
Comments
Please log in or sign up to comment.