Testing the 6522 chips

Modding and Technical Issues

Moderator: Moderators

Post Reply
Kakemoms
Vic 20 Nerd
Posts: 740
Joined: Sun Feb 15, 2015 8:45 am

Testing the 6522 chips

Post by Kakemoms »

Has anyone here made a program that tests the 6522 IC's in the Vic-20? How well can they be tested without making a dongle?

The reason I ask is that I have several old 6522. It would be nice to have a way of testing them using the Vic-20 to see how well they behave.
User avatar
mrr19121970
Vic 20 Nerd
Posts: 873
Joined: Tue Jan 19, 2016 9:22 am
Location: Germany
Occupation: IT service manager

Re: Testing the 6522 chips

Post by mrr19121970 »

Run/Stop
W
D
M
8
:
Up Arrow
Inst/Del
4 joystick directions/fire???


Should cover it
Kakemoms
Vic 20 Nerd
Posts: 740
Joined: Sun Feb 15, 2015 8:45 am

Re: Testing the 6522 chips

Post by Kakemoms »

Well, that is not going to test the full functionality, thats quite obvious. So I used some time in order to try to come up with a scheme that may test some, if not all, of the 6522 functionality:

Lets start with the IRQ timers. They are simple counters based on the CLK2 signal and thus count the number of clock cycles in the system from a given "init" time. The raster counter can be used (with some comparable logic) to get single-clock accuracy on how many CLK2 cycles that have actually passed at a give time.
The IRQ timers on the two 6522 can then be compared with respect to the main clock of the system and from that we can deduce that the each IRQ timer counts correctly. Unless the CLK2 itself is fuzzy. But if the CLK2 is not correct that would show up on the monitor, wouldn't it? Well, since the monitor signal and CLK2 both come from the VIA chip, it may not. For now, lets just assume that the system clock is a continuous counter at a given frequency.

Before we can start testing the IRQ, we would have to test other parts of the 6522. There is no way to start the IRQ output on the 6522 if one can't write data to it, so a non-working IRQ may actually be due to problems elsewere. If we can't write data to it for example. Now you may ask yourself if this is interesting at all (e.g. a non-working IRQ would mean that the chip is unusable, wouldn't it?). Well, as chips get older, more and more of them will stop working. At some point in the future it will be very difficult or impossible to get replacements, and at that point it may be interesting to have a partially working 6522 for some tasks in some old systems. Maybe you need the IRQ but would be ok without that lightpen input... or something like that.

So how do we test the data in/out? Event speed dependence will be important. Some chips may be be ok for keyboard but not for faster IO like disk drives. A easy way is to start by writing to the directional register (VIADDRA or VIADDRB). Writing here and reading it again should produce the same value (unlike most of the other registers), so one can start by cycling through different values (write + read + compare) at different speeds. The fastest way would be something like:

Code: Select all

LDX #$ff
loop:
LDA table,X
STA VIADDRA
CMP VIADDRA
BNE error
DEX
BNE loop
//success!

error:
//failed!
If that works, then one can test the IRQ and continue to start testing IO registers.

If we look at the schematics, one 6522 is responsible for serial port input, while the other is responsible for serial output. That is a nice way to test those datalines at different speeds, but it won't test the other lines. Thus, it is obvious that we need a dongle on the userport and joystick port to test the whole VIA1 6522 throughly (the one in UDE8 position). The VIA2 6522 can't be tested at different speeds without a dongle on the keyboard-connector inside the Vic-20.

If anyone else has a better idea (or comments) I would like to know.
Bobbi
Vic 20 Afficionado
Posts: 355
Joined: Thu Oct 13, 2016 11:35 am
Location: Toronto
Occupation: Programmer

Re: Testing the 6522 chips

Post by Bobbi »

It would be interesting to know the failure modes of the 6522. For example, do individual line drivers tend to die or are core logic failures (for example a counter) more common.
User avatar
eslapion
ultimate expander
Posts: 5458
Joined: Fri Jun 23, 2006 7:50 pm
Location: Canada
Occupation: 8bit addict

Re: Testing the 6522 chips

Post by eslapion »

Kakemoms wrote:Has anyone here made a program that tests the 6522 IC's in the Vic-20? How well can they be tested without making a dongle?

The reason I ask is that I have several old 6522. It would be nice to have a way of testing them using the Vic-20 to see how well they behave.
My method is to try them in both sockets (UC2 and UC3) of a 1541 drive, format a floppy at each socket.

The most important one is socket UC2 because almost all lines of the 6522 are used there.

On UC2, PA is used bi-directionally while PB is used in a manner in UC2 and a completely different way in UC3.

If a VIA can operate properly and format a floppy in both sockets then you can be pretty much assured the chip is okay.

If you have an older VIC-1540 or VIC-1541 with long board then the sockets are UAB1 and UCD4.
Be normal.
groepaz
Vic 20 Scientist
Posts: 1180
Joined: Wed Aug 25, 2010 5:30 pm

Re: Testing the 6522 chips

Post by groepaz »

you could also run the test programs from VICE repo on it... however, for a full test you'll need some additional hardware connected to all ports. isnt there something like the c64 "diagnostic" cartridge for the vic20?
I'm just a Software Guy who has no Idea how the Hardware works. Don't listen to me.
Kakemoms
Vic 20 Nerd
Posts: 740
Joined: Sun Feb 15, 2015 8:45 am

Re: Testing the 6522 chips

Post by Kakemoms »

Thanks for good ideas. The floppy-test is a good one, but I only have one (working) so I don't want to open it. I am almost leaning towards making a test-board for the 6522 with some controller.
Last edited by Kakemoms on Sun Dec 18, 2016 1:27 am, edited 1 time in total.
User avatar
eslapion
ultimate expander
Posts: 5458
Joined: Fri Jun 23, 2006 7:50 pm
Location: Canada
Occupation: 8bit addict

Re: Testing the 6522 chips

Post by eslapion »

Kakemoms wrote:Thanks for good ideas. They floppy-test is a good one, but I only have one (working) so I don't want to open it. I am almost leaning towards making a test-board for the 6522 with some controller.
AFAIK, you cannot damage your 1541 testing a potentially faulty 6522.
Be normal.
groepaz
Vic 20 Scientist
Posts: 1180
Joined: Wed Aug 25, 2010 5:30 pm

Re: Testing the 6522 chips

Post by groepaz »

that totally depends on the type of defect of course - if whatever causes the VIA to drive a pin high, that might kill the VIA in the floppy. probably very unlikely though. i still wouldnt connect working devices to a known bad computer :)
I'm just a Software Guy who has no Idea how the Hardware works. Don't listen to me.
User avatar
mrr19121970
Vic 20 Nerd
Posts: 873
Joined: Tue Jan 19, 2016 9:22 am
Location: Germany
Occupation: IT service manager

Re: Testing the 6522 chips

Post by mrr19121970 »

Well both Dave from Tynemouth Software and Ken aka Boulderdash (awol on most forums just now) build and sell the test harness for the Vic20 diagnosis cartridge

http://blog.tynemouthsoftware.co.uk/201 ... -kits.html
Kakemoms
Vic 20 Nerd
Posts: 740
Joined: Sun Feb 15, 2015 8:45 am

Re: Testing the 6522 chips

Post by Kakemoms »

Well, I droodled a little schematic that uses an Arduino Nano to set up HW for a testing platform. Basically I wanted to record all outputs with analog interfaces, so I added some analog multiplexers. Nothing special. I haven't put in all the symbols, capacitors and resistors... but you get the idea. :roll:
Tester6522.png
I will test it once I get the analog multiplexers from UK.
Post Reply