Serial Communication for TLC-MBC
This has been a long journey to give TLC-MBC the power of serial communication, with obstacles like poor wiring and faulty chips. At the end of my last post, I was internally debating to pull out the jumpers or not. Well… circumstance kinda forced my hand. My immediate goal was to add the 6551 ACIA, which I did, I hooked it to the first block of the I/O decoding – $8100-$811F. I then wrote a simple program whereby I type at the PC’s keyboard, the character goes down the line to TLC-MBC where it is sent back and appears in the TeraTerm window – or at least that was the plan!!
I then wrote a program that would just continually send a stream of characters from TLC-MBC down the line to TeraTerm, that didn’t work either. It could have been the wiring, or my decoding scheme was at fault, or the chip was faulty, or the connection to the USB to TTL was wrong. At this point the only thing I was confidant of was that the Ram and Rom was working. So, drastic action, I ripped it apart yet again and went with a different layout so that I could easily add the 6522 as well, later. This time around, no jumpers and I wanted to have the chips as accessible as possible, especially the EEPROM, and here is the result.
As you can see (click for larger image) quite a few changes, this bread board is turning into a Frankenstein!!
- Obviously, new layout, conforms to my previous diagram, the EEPROM is easily accessible now as well as the serial and parallel ports and no jumpers (except for the prototyping area which is temporary anyway).
- The Nano has it’s own bread board now mainly because there the ACIA was below it and I didn’t want the Nano’s cable over the ACIA. So I turned it 90 degrees.
- The FTDI/USB converter has it’s own mini bread board so that it can lie horizontally, I didn’t like the idea of it standing vertically on the bread board and the cable coming out of it’s top, too much strain I think.
- The addition of a prototyping bread board for the 6522 (bottom left).
Yeah… I decided to add the 65c22 VIA as it was easier to do it now as opposed to adding the wiring in for it later, even though I don’t like adding two unknowns (6551 & 6522) at the same time. But, as it worked out, the 6522 actually helped in the debugging. So, back to the 6551…
Just as a sanity check I connected Hex Display and ran the memory test from last time just to make sure at least the memory was working – and it did. With that success I reloaded the first ACIA test program and ran it – still not working. If I disconnected the ACIA from the FTDI converter and bridged it’s TxD and RxD characters appeared in the TeraTerm window, so I knew that serial communication worked up to that point. All that was left was the 6551 and my decoding and programming. Or maybe it’s because I’m still using the Nano as a clock source, switching to the 1Mhz oscillator made no difference except I could not read Hex display at that speed.
Time to check the decoding… and I did this by testing the 6522, if I could get some LED’s to light up it would show that my decoding was correct and that the 6522 worked. Twenty minutes later I had 16 LED’s counting up and down in binary. Then I wrote a program so that the Port A LED’s showed the Status Register of the 6551 and the Port B LED’s showed the input/output character as needed. This showed that the input was working fine but on output the Status register was not changing to allow the character to be transmitted – it was stuck and so no serial communication was happening!
Serial Communication At Last!
So I went to the 6502.org forums and found that the 6551 was indeed broken!! The output subroutine needed a delay to give it time to send a character before sending the next one. With that one addition of a delay everything worked as it should have from day one. Plus, it’s running at 1Mhz so now there is no need of Hex Display or the Nano so I have disconnected both.
During the testing I found that the voltage at the 6551 was only 4.55-4.6 Volts, hence the addition of all the 100mF capacitors along the top of the bread board. Adding serial communications to TLC-MBC has been somewhat frustrating as it was not just me that was in error, the 65C51 has problems of it’s own, though it is a good feeling to have got this far.
At this point the hardware is now done, serial communication and the parallel ports work, there will be no more additions for a while. It is the turn of software or rather firmware. TLC-MBC needs a machine code monitor – an operating system of sorts – so that I can do useful stuff with it. Though, after a conversation with Garth, on the forums, I might just try to bit-bang an SPI interface on to the 6522… I also need to get a PCB made for TLC-MBC, a bread board is okay for testing a circuit but it’s not exactly reliable for long term use. To do this I’m learning Kicad so that I can make a larger board than Eagle allows in the free version.