Commodore 64 Diagnostic harness

I’m a geek, you’re a geek, we’re all geeks.

And Geeks often build their own geeky tools.

One of the most powerful hardware debugging tool for a non fully functional commodore 64 is the C-64 Diagnostic Assembly Kit (CBM 326070-01) – this software is powerful because it pokes at hardware using a test harness.

Today’s article will discuss how to come up with a hardware test harness solution for that Diagnostic cartridge.


Click here for more articles on the Commodore 64

Jump to sections of this article:
 Gather components
 Understanding and coming up with schematics
 Design decisions
 Parts placement
 Assembly
 How to use the harness
 Conclusion
 Aftertoughts

As mentionned earlier, there are multiple flavors of the harness that are compatible with many versions of the diagnostic cartridge. Noteworthy is the one from Peter Schepers at University of Waterloo and the one by Sven Petersen at Sven’s tech site. More precisely the Keyboard PCB rev1 and the user port PCB rev 2 from Sven’s GIT. They offer detailed schematics which are very helpful when making this project.

Build your own?

While everything is available online for getting suitable PCBs, sometimes it is simply more convenient (or more fun) to pull the schematics and work with what’s available, which is what is proposed here.

Some hobbyist may come up with rather imaginative solutions, such as the homebuilt harness seen on Tynemouth Software’s blog, or the one made by Travis Durf on hobbytronics blog:

Essential components for building one harness

When coming up with a DIY version of the test harness, one of the main issue is to source something to interface with the motherboard’s edge connectors.

While compatible connectors are still in-production and available, soldering something to said connectors is easier said then done without a specifically designed circuit board. Spacing isn’t exactly the most usual, and the top row shouldn’t be touching the bottom row, which could happen if using perfboards. Particularly for the User port part of the harness.

There are kits sold online that has either pre-built or unsoldered custom PCBs. There are also shared projects that offers PCB solutions for most of the standard test harnesses. Usually these require multiple different PCBs to cover every aspects of testing – up to five different boards; except this ingenious solution from Davis where one single PCB can be populated differently for the different usages.

This is interesting because the minimal number that can be ordered at most PCB manufacturer is five; so having five different use on a single PCB just make sense for such project.

Davis’ five-in-one C64 harness PCB

Alternatively, one could just get versatile boards that can be used for many projects and build from it.

Perforated boards with edge connectors would become useful for many upcoming projects interfacing to the C64 user port. This exist and is available as a shared project – This specific one was developped by the C64 Istanbul group and Turkish-speaking Commodore forum Commodore.gen.tr (CGTR).

The same PCB could be reused for the Datasette port, being that the actual connector is to be soldered to it and it has more pins than required; but there is a Datasette port breakout board made by Giorgio SukkoPera, also available as shared project; which can also be used for other upcoming projects. As previously said, the minimum order for most PCB manufacturer is five…

A great advantage of having a board specially designed for a specific port is the silkscreening identification of the pins which facilitates montage.

Spare parts bin

Before rushing to the electronics store – online or physical – to get all that’s needed, the spare parts bin may be a great source of components.

Resistors, capacitors, LEDs, connectors, wires, perfboards… might be available already. Even other speciality components, depending on previous projects…

When ordering, geeks get spares

It is always a gread idea for geeks to stock-up when ordering parts. It distributes shipping charges over more components and help keeping parts on-hands, for future projects. For instance, while purchasing logic chips for building a commodore 64, there is a need to get two quad bilateral switches (IC 4066b) – which are the only type of IC required for the construction of Sven’s REV1 test harness besides diodes, resistors and leds. It can be cheaper to order a 10-pack than two individual chips, and the end result is spare components ready for the next project. Right now: the test harness circuitry.

Reusing available parts

Instead of building with bran new everything, one may want to salvage old components from the scrap bin and use that in DIY projects. In today’s project, a long floppy drive ribbon cable (which has 34 pins) will cover the required two game control ports (9+9=18 pins) plus the REV1 keyboard connector (10 pins) and the datasette port (6 pins) – it is long ennough to reach the control ports and connecting it to the board can be done using simple pin-headers.

The DB9 connectors can also be salvaged, their housings too.

The keyboard 20-pin connector.

Connectors, connectors, connectors

Something to think about is how things are going to be held together and interconnected.

Good connectors on both sides of a cable is important, so it may be a good idea to invest in solid ones if nothing is available in the spares bin. There’s nothing worst than having a montage that fails because of a flimsy connection. It is very aggravating.

For the harness, the main cable will be an in-stock 34-pin ribbon cable. The game ports will de-facto be DB9 connectors as this is what connects to the the Commodore. Idem for the edge connectors, there’s no flexibility there.

But for connecting the various dongles circuits together, the connector type is open to selection.

Acquiring speciality connectors can be useful – Molex KK-254 works good for this project. They hold in place rather well, while not needing excessive force to disconnect. More importantly, their design prevent them from being inserted backwards.

These Molex connectors were de-facto standard to connect computer LEDs to motherboards of early PCs, before the Dupont connectors became the norm. The issue with the Dupont connectors: they aren’t keyed and can connect backwards. On the other hand, JST connectors are keyed to prevent inversion, but are somewhat harder to take off the board and less suitable for something that will be connected and disconnected at every use. That being said, most any connectors could do the job and is only a matter of preference and availability. Connector kits can be bought from several electronics stores, physical or online, and aren’t overly pricey.

Important is to get something that can be crimped at the other side of the pre-existing floppy cable, that comes in a suffisently wide connector to work with the number of connections needed – 10 for the keyboard dongle, as shown below. Or at least a pair of fives.

Understanding the schematics

The first step in self-building anything is planning.

Gathering information, and making a plan or schematics with it, and go from there.

The planing phase is as important as the work itself. The idea here is to fail fast – find issues before they become a problem to solve. Designing and planing are often overseen but are essential parts of a successful projects. It is much easier to change connections on paper than on a soldered and assembled board…

There are multiple different variants of the C64 diagnostic harness. Understanding what’s what and making sense of it will go a long way. Aditionally, it facilitates the task of altering concepts and ideas from other projects and create a new vision of the same thing.

Here is a combined view of both the Peter Schepers and Sven Peterson variants. Resistor values varies between them – they do not have to be super precise.

Complete harness schematics combined from Peter Schepers’ and Sven’s tech site variants.
Chip subsections have been identified as per Sven’s schematics to help cross references.

The main difference between the original Peter Schepers variant and the Sven REV 1+ is the addition of one supplemental quad bilateral switch IC to handle the keyboard switching on/off – in order to prevent false positive control port validations. In Sven’s schematics they are drawn as single switch blocks, while Peter Schepers shows them as complete IC – in reality the individual bilateral switches can be used interchangeably as long as the control/switch combination match.

In the Peter Schepers variant there was five switches being used, which then required two ICs of four – three units were left unused. They should have been grounded for safe measure.

Sven adds five bilateral switches to the circuitry of the keyboard dongle for PAs 0 to 4 and PBs 0 to 4 in order to work around the original design flaw that could cause false positives.

Now, the new bilateral switches needs to be ON when the WRITE signal is low, so some sort of WRITE inverter was needed, Sven designed this using one of the extra bilateral switch, some resistors, and the VCC/GND.

While there is plenty of bilateral switches in three 4066 ICs, it may be preferrable to separate the additional ones from the legacy ones – putting legacy on the main board, and the added ones on the keyboard dongle. This could make implementation easier and also reduce the size of connector needed between the two boards (from 10 to 1). However, this would also require a larger board for the keyboard dongle.

So design decisions will need to be made.

There exist a version of the harness that has none of those bilateral switches. They have no interconnections between the various dongles to enable/disable any of the in-depth tests. They rely on the keyboard making the (erroneous) loopback between the CIA pins for the game port to pass its test. Technically, the game port aren’t really being tested by these lighter dongle… only the corresponding CIA pins are, and the game port dongles are only testing paddles.

The current design isn’t like that.

Note that Sven also takes care of an SX64 variant that doesn’t have a datasette, this extra circuitry can be omitted for non-luggable Commodores.

Design decisions

The first design decision was done because of available hardware – reusing a floppy flat cable will impact the whole design.

It was also decided to ust the firstmost pins for one DB9 game connector, and the lastmost pins for the other. Reasonning is that this makes correct spacing between the two DB9 connectors to be able to connect them to the computer when all is assembled, without squashing the ribbon cable.

The ribbon cable also having multiple floppy drive connectors, it was decided to leave the central (useless) connector in as a way to reinforce the harness; the only long connections are to the game ports so the inner-most pins will be cut just before that second connector to be used for the keyboard and datasette port.

Main harness cable system to reuse flat-cable from old computer floppy drive

Something notable is that the Datassette port, while having a full six contacts, only really needs to connect the one WRITE signal to the main circuitery. The other connections are for resistors and loopbacks, which may be positionned on the dongle itself, or the main board. The connector to the Datasette dongle doesn’t require to be full 6 pins. That means there is a little flexibility on the 34-pin flat cable arrangement that can be put to use.

Initial intention for flat-cable pin placement can be changed to ease the assembly.

Initial arrangement – note misaligned game ports

Placement

Design decision involving where everything will be placed is important, particularly when hand-soldering a perforated board montage.

Therefore, tests are to be made prior to soldering the first component. There’s nothing worst than realizing halfway trough a montage that it won’t work or there’s no room to do as planned.

Main board and user port

Aligning the pins. Being that the bilateral switches attach one component to it’s counterpart, it may be a wise idea to align the pair on a same side of the 34-pin connector. For the game ports to remain at both ends of the cable, this means sacrificing one wire in favor of proper alignment.

With pin #34 gone, both 9-pin game connectors are aligned with same-side same-pin for easier perfboard assembly.

Re-alignment of the main harness cable to easy implementation
The game port connectors now use an even number of wires (10 – with one unused wire)

Also, to avoid having too many pins arranged together, the Datasette WRITE signal will be brought up twice on the 34-pin connector – one for each side. This makes that only the Keyboard connectors aren’t side-matched on the main board – but chip placement can alleviate this somewhat. See next section.

The two other wires brought from the Datasette port to the main board will be SENSE and READ, simply because they require to be connected together, but no actual components. Reducing the number of junctions on the tiny Datasette breakout board is useful, while not adding more components on the main circuit. [note: this may not have been the best idea; see aftertoughts below]

Corrected arrangement for easier perfboard mounting

Connecting all of the connector pins on a perfboard will be messy – but both the upside and underside can be used to populate wires.

Overall, using perfboard software like DIY layout creator can assist in making placement decision: The goal of this exercise is to find placement flaws before commiting to anything – no need to begin soldering on a board until a proper placement that makes sense is proven.

The visuals on the software is always more messy than the final result, but it does help finding where the issues will be and help imagining a way to solve it before turning on the iron. If placing a virtual wire is complex, making the physical connection may be a little too much.

Perfboard layout planning.
Chip subsections have been identified as per Sven’s schematics even if chips aren’t the same.

Keyboard port

The keyboard dongle PCB would be much easier. There are a few jumpers, the two connectors, and one LED with it’s resistor. Proper placement of the connector would even make soldering easier. It is possible to split the 10-wire cable in two 5-wire cables, one being PB and one being PA; they could even be swapped for one another without issue as the schematics calls for pairing same-number PAs and PBs, and the bilateral switches literally just linkes them together. Putting As in lieu of Bs wouldn’t be any issues.

The dongle-to-motherboard connector placement was optimized to fit on a 250466 C64 motherboard; the board is overlapping of the motherboard with pins 1(gnd) and 2 (no connect) being closer to the front of the computer.

[note: the initial connector was not high enough to clear the shielding on a C64C 250466 and a second connector was soldered to the first one. See aftertoughts below]

Layout planning for keyboard dongle

Datasette port

The Datasette port with its breakout board, is somewhat different to plan. Some of the components will be soldered freestyle from one another following the circuit. The SENSE-READ zero ohm resister (read wire) will be ommited in favor of getting it on the main board to free some components on the dongle. [note: again, see aftertoughts below]

The SENSE indicator LED and it’s circuitry will also be omitted for simplicity sake on such a small board, with only the MOTOR indicator implemented. The LEDs are not mandatory for testing anyway.

Simplified schematics of the parts being implemented on the Datasette Dongle.
The READ, WRITE, SENSE will become flat connector pins 11-12-13-14

Serial port

The IEC serial connector dongle is the easiest, needing no connection to the other dongles, and have only 2 loopback connections. The complicated part is to not be confused with pin placement, the connector is simetrical, but the simmetrical pins don’t have the same function.

Serial dongle – beware of placement for ATTENTION and CLOCK loopback

Assembly

Once the design is done, and the traps have [mostly – see aftertoughts below] been identified and addressed, assembly should be rather straight forward.

Here’s most of what’s needed.

Building the cable

There are two other dongle connectors on the harness cable, plus the game port connectors. Cable assembly is often overviewed but is a big part of successful projects.

Being that we are using a floppy drive flat ribbon connector, an issue is to separate them from one another. The original cable wasn’t intended for the purpose of this project. It had connectors for two floppies so there’s an extraneous floppy disk connector in the middle that will remain unused. The game ports being farthest will be at the end.

The game ports don’t really have dongles, just the 9-pin connectors to wire to the cable, no other components all the controlling ICs are installed on the mainboard. To have a more appropriate game port spacing, it was decided to use the 10-firstmost and 10-lastmost wires of the cable. The extra unused wires from that section of the cable can be kept for rigidity.

The wires going to the two other dongles will be taken from the first section of the cable, as the required distance is much shorter on these. Theferore, there will be a split at the unused floppy connector. In order to not have something too flimsy, the game port wires will be held at their original distance with duct tape. What’s a geek project without duct tape??

The lenght of the two other dongle cables will be adjusted for their distance from the main board, the cassette port connector being shorter. Note that the keyboard isn’t at the same location on every C64 motherboard, so the keyboard dongle still need to be somewhat long.

Once everything assembled, it may be wise to use a multimeter in continuity test to ensure all is ok – this will be repeated with every steps of the project.

Keyboard dongle

There are 10 connections between the keyboard dongle and the main board – PB(0-4) and PA(0-4). As long as the PA/PB pair with the same number are aligned, the circuitry is good. Therefore, this could be made with a pair of 5-pins connector. The connectors could be swapped without issues.

For this dongle, the main connector happens to be a reused 20-pin connector. The No-Connect (key) has been filled with a pin that is soldered in place.

A power LED is present on this dongle with it’s resistor. Soldering every connections is pretty straight forward following the layout designed above. There is about 13 interconnections to add to the perfboard, the two connectors, plus the optionnal LED and its resistor.

The dongle didn’t fit the C64C when initially testing placement, because of the 64C shield being in the way. A spacer was added so it can clear the metal shield in the computer. [more on that in the aftertoughts section below]

Datasette dongle

The cassette dongle is the closest daughter-board of the harness; the cable can be much shorter and was cut appropriately.

The edge connector is soldered to the breakout board with the underside facing up to keep correct labeled pinout. The specific PCB was designed with that in mind and had appropriate silk-screen on both sides for both scenarios.

It is possible on this instance only because the datasette port has the upside and downside repeating their functionality – this isn’t the norm for edge connectors.

Aditionally, the PCB was designed with the 6 connectors repeated in through hole fashion, plus an additionnal row of VCC/GND connection, making it possible to easily add components; which could also be placed directly on what used to be the edge connector area. The resistors are installed in this fashion. The LED (plus it’s resistor, hidden in heat shrink) can be connected between the MOTOR and GROUND connections. It all fits nicely.

Note that the 3-pin connector isn’t aligned with the 4-wires used at the main board; the wires are arranged properly at this connector.

User port & main board

The user port dongle would be only a few loopbacks, but it made sense to build most of the circuitry there being that the breakout/prototyping board available as shared project are big enough.

Therefore, it is the heart of the harness, and does interconnections between dongles. [note this isn’t a requirement; see aftertoughts below]

The user port dongle section itself is rather small and simple. Then power (VCC/GND) is taken from there to the main interconnect circuitry and the quad bilateral switches ICs.

To minimize cables, the capacitors are being placed under their IC, between the turnpin “sockets” made from turnpin headers.

The first steps were to place every connectors, then build the user port dongle, followed by the power for the ICs, the game port circuitry, and the IC interconnections. After each steps a multimeter test for shorts ensures everything is following schematics and no shorts are created.

Serial IEC connector dongle

This connector was simple to assemble, only 2 wires to add. Tested for continuity with a multimeter. The biggest issue was to ensure the proper side was chosen, as discussed above.

Something useful is to use the back of the connector – where there would usually be a cable going out – to add a pull-string cable.

Using the harness

The completed harness needs to be connected to the various ports of the Commodore. To access the keyboard port, the computer needs to be openned, as the keyboard port is actually inside the Commodore 64 and the dongle replaces the actual keyboard. The top-half of the computer (with the power LED) is removed.

The harness is to be used with the diagnostic cartridge that was discussed previously.

The diagnostic software willl test the various elements one after the other, plus audio from the SID chip. Anything that is deemed bad will be flagged BAD, and the software will perform the test again, counting up; anything declared BAD once will remain BAD – it is possible to setup the diagnostic for a long-duration test and see if anything goes wrong with prolonged use.

It is important to RTFM – as when a chip is reported BAD; it may be a bad chip, or something around it. Understanding what is being tested and how it is being tested will help acting on a reportedly BAD component.

For instance, PLA being reported BAD may be an issue with a ROM chip. U1 being reported BAD may be an issue with the joystick port circuitry or a logic chip. Swapping a reported BAD chip with a known good one is always a good idea. However, this may require unsoldering chips from the motherboard. If the CIA chips are socketed and one is reported bad, it may be wise to swap them and see if the issue follows the chip.

Conclusion

Overall this harness didn’t take all too long to build and was instrumental in debugging a partially defective CIA chip. It is an essential tool to maintain or repair any Commodore 64.

Understanding the inner workings of the machine helps, and understanding the tests too.

Afterthoughts

The harness as illustrated here worked on the first try thanks to regular validation of circuit implementation. It helped diagnose a commodore 64 on its first run.

But a few things on the harness could have been built differently…

  • The keyboard dongle connector originally planned was too low profile to clear the shield present on the C64C; adding a spacer to the initial design solved this but wasn’t originally planned. Alternatively, an angled connector would have worked. This was an oversight.
  • There are only a few lines between the user port and the main circuitry. The user port dongle is rather standalone and only supply power to the main board. It would be doable to put the main board separate from the user port, wiring the loopbacks directly to the user port connector, sans PCB. This is a design and implementation choice.
  • The main board does not have a power LED, which is problematic when testing without the keyboard dongle as there is no longer any power indication when the casing is removed. A likely upgrade would be to add a LED, as it only requires a few components. Another possible upgrade would be a 5V voltmeter to monitor the power line.
  • The Datasette port dongle isn’t standalone in its current form. Of course, it needs to be attached to the rest of the harness as it supply signals to control the state of the keyboard and control ports, but testing with only this component is not currently doable as it is missing one loopback. While testing the computer, at some point tests weren’t about keyboard and control port, but removing the cable wasn’t possible.
    • To bring autonomy back to the datasette dongle, the missing loopback could to be installed as a double – or as a replacement – to the one on the main board – this is another likely upgrade.

Keep on geeking.

Related articles

Commodore 64 diagnostic tools (wereallgeeks)
Peter Schepers wiring harness (uwaterloo)
C64 diagnostic harness (Sven’s tech site)
Sven’s diagnostic harness (GitHub)
Tynemouth Software’s DIY Harness (Tynemouth Software blog)
Travis Durf’s DIY harness (hobbytronics)
Davis’ 5-in-one harness PCB (PCBway)
C64 user port edge connector breadboard (PCBway)
Datasette breakout board (PCBway)
Build a C64 in 2023 (wereallgeeks)
DIY Layout Creator (GitHub)
C64 diagnostic manual (zimmers.net)