Friday, 29 July 2016

6502 Diagnostics Tester

I've been building a few more of the 6502 Diagnostics boards to run the PET diagnostics firmware.
It's a fairly simple build, but the microcontroller package is quite small and can be difficult to solder.
Before putting one of these anywhere near a PET, I want to make sure that all the pins are connected, and there are no shorts etc.
Most of the times I use a microcontroller, I would use the internal RC oscillator, or more often a crystal or ceramic resonator. In this case, the microcontroller is driven from the system clock, so it needs an external 1MHz clock fed to one of the pins. Once the configuration fuses are set to use an external clock, it is no longer possible to program it without that external clock being present. In order to program and test the boards, I need a clock and some way to monitor the pins. When testing the first ones, I used a signal generator and logic analyser, but that's not really practical to setup each time I built a batch.
I can't use the built in clock generator, so it needs an external clock. I looked at a few options, using a similar style to the PET, using a crystal and a couple of logic gates to form an oscillator, but I would need to add some more to divide that down to 1MHz. I also considered just using a 555 times, but that wouldn't be fast enough, I think a few hundred KHz is the limit there.
I then had a look around at self contained 4 pin crystal oscillator modules, I had a few, but they were all too high frequency. After looking at various options that were too fast, or too slow, and all involved a few too many parts, I went for an easier option.
This is an ATtiny45, a small cheap (<£1) 8 pin microcontroller. This has an internal RC oscillator and can be set to feed this to one of the output pins. The RC oscillator is 8MHz, but it can be set to divide by 8 internally, giving 1MHz. Perfect. In the end, I didn't actually write any code for this microcontroller. It was all done with the fuses. Set it to RC oscillator, divide by 8, clock out on PB4. For those playing along at home, this was all it took:
avrdude -v -pattiny45 -cusbtiny -e
        -U lfuse:w:0x22:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m
With the clock sorted, I needed to add some way to test the output, lets face it, it was always going to be flashing LEDs. I had some 20 way LED bar modules I use for the IEEE-488 diagnostics board, so I used a couple of those. Nice and simple one LED per pin, LED on if the pin is high.
That fitted neatly on a small prototyping board, but there wasn't space for the usual SIL resistor arrays, I also didn't have enough of those at hand, so I went for adding those resistors on the back, using 1206 surface mount resistors soldered to a common ground wire.
That all worked out very neatly. The microcontroller is hidden under the socket, only three pins are connected, 0V, 5V and PB4 which is clock out that goes straight to the clock in pin of the IC socket.
There are two 0V and one 5V connection on the 6502 socket, these are wired so they will always be lit. The clock output will always show as half brightness as it is a 50% duty cycle square wave. It's a buffered output from the microcontroller, so is more than capable of driving an LED. Time for some testing.
I added various test patterns to the software to check for missing connections, shorted pins etc. Here it spotted two shorted pins on another board, you can just see the two faint LEDs on together. in the middle of the bottom row.
With all that verified and the normal firmware loaded, time to test the newly built 6502 diagnostics model on a real PET.
Working nicely (once I set the DIP switches correctly).
A useful bit of test kit for when I build these boards, and it should be useful for the future USB serial driven versions as well.

If you would like one of the 6502 diagnostics boards (not the LED tester board!) with PET diagnostics software, you can order one below.

PET Diagnostics
 
 

If you want to support this blog, you can donate via Patreon or Paypal, or buy something from my store.