SD Card Shield

When we began building the first of our SS-50 series of cards, the most common request was for a mass storage option. Those old disk controllers are hard to find on the surplus market and the old disk drives are getting harder to maintain. While we like vintage equipment, sometimes it’s worth using some modern technology to do updates.

Enter our SD Card System.
This is a two board system that provides a very inexpensive, flexible, and long-lasting storage option for our KIM Clone , SS-50 based designs, or almost any third party system.

The main board is our SD Shield. It plugs into an Arduino Mega and provides for insertion of a micro SD card, and also includes a DS3231 based real time clock (RTC). The Arduino does the hard work of providing an interface between the host processor (6502, 6800, 6809, etc) and the SD card and RTC. It connects to the host via a ribbon cable.

The board also contains three LEDs used for status, a RESET switch, a four position DIP switch, a DS3231 RTC, backup battery, and it maintains the Arduino Mega headers so additional shields can be placed on top. Since the source code is available you can add additional drivers for whatever shields you add. Want to add an LCD shield that displays which files are mounted? Just plug in the shield and modify the user interface class in the source code. Only one of the DIP switches has a defined purpose, so the rest are free for you to add your own logic.

The protocol between the host and the SD Card System is completely defined in The Remote Disk Protocol Guide.

In order to use this card on an SS-50 based system, you will also need a parallel card such as ours.



SD Card System 2015
SD Card System 2017
SD Card System 2021
The Remote Disk Protocol Guide August 2015 V0.1
The Remote Disk Protocol Guide April 2017 V1.1

Downloads
Drivers for 6502, 6800 and 6089 Flex, Arduino Mega Firmware, SD Images Flex, older versions also
Firmware 2021
Test program for SD Shield
Clock utilities set time and date from KIM-1
Reproduction and uptodate SD Shield by Eduardo Casino (Github copy)


The schematic above is the only version posted. It is not the latest schematic used by Bob (see below). Eduardo Casino (see the download above) reverse engineered the SD Shield and produced an uptodate version 9.

April 5, 2021 New Version of SD Card Shield

This is another board done entirely with KiCad and rolls in a few changes from the previous boards. It is completely compatible with the rev 8 boards, which were compatible with rev 7, which were compatible with… etc, etc, etc.There is no new revision of Arduino code for this board.

No new features but a few changes:

  • The CR1220 battery has been replaced with a much more common CR2032 to keep the RTC (Real Time Clock) chip alive.  I did extension market research (ie, I emailed all my nieces and nephews) and found they all had 2032 batteries at home, while none of them had 1220s.My family is used to getting odd emails from Uncle Bob.  The local hardware store was surprised  when I asked about CR1220s, so going to a more common battery makes sense.
  • A different micro SD socket. The old one was push-in, pull-out, but this one is pop-in, pop-out.  It also has alignment pins on the bottom making it much easier to get seated exactly in the right spot before soldering. The solder connections are at the back of the socket, not in the front like the old board.  So far every surface mount solder job with the new socket has been perfect the first time, whereas the old sockets needing to be touched-up about 15% of the time.
  • The old 5-pin header for an external RTC board has been removed, allowing the LEDs to be aligned in a row.  With the RTC on-board there was little reason to keep the header.
  • Added a clearly labeled 4-pin area for adding external I2C devices.
  • For those buying the bare board, the LED colors are labeled on the silk screen. BTW, the “bare board” has the DS3231 RTC and the microSD socket already soldered.

The rev 9k1A will eventually be changed to just rev 9, as there is no need to keep KiCad revisions uniquely identified.

March 21, 2018 What’s On the Bench

Sometimes it’s nice to just enhance an existing product, especially when the supply of blank boards starts running low and more need to be ordered.  I’m running low on the SD shields so it was a good time to make some improvements. This is a prototype:

The changes from the Rev 4 boards:

  • A DS3231 RTC and backup battery are now on-board instead of having the plug-in RTC.; Too many of those plug-in boards had batteries that died within a year or two, so I decided to just put the chip directly on the board and have a battery connector.  It takes a very common LR44 battery which can be replaced easily when it fails.
  • DIP switches are clearly labeled as to which is which, and which direction is on and off.
  • A pull-down resistor is temporarily added here to fix a problem where the green and red LEDs don’t work right until the host computer initializes the interface to the SD shield. A pin was left floating and confused the software into thinking the host was sending a byte when it wasn’t.
  • Two I2C pull-up resistors were added but do not seem to be necessary.

There will eventually be a Rev 6 with the new pull-down resistor and maybe the two pull-ups removed, but I’ll use the current Rev 5 boards and manually add the pull-down for now.

The RTC is completely software compatible with the current boards so any version of our Arduino code will work with it.

KIM Clone Motherboard

KIM Clone Motherboard

KIM Clone Motherboard User Manual
KIM Clone Motherboard schematic

KIM Clone I/O board

KIM Clone I/O board

KIM Clone I/O Board Manual

KIM Clone I/O board Rev 2, 1 of 3


KIM Clone I/O board Rev 2, 2 of 3


KIM Clone I/O board Rev 2, 3 of 3

KIM Clone I/O board Rev 3, 1 of 3


KIM Clone I/O board Rev 3, 2 of 3


KIM Clone I/O board Rev 3, 3 of 3

Automated tester

What I Do with a KIM Clone>

The KIM Clone and the 6530 replacement boards both use a 6532 to replace the non-existent 6530-2 and 6530-3 chips that were used on the original KIM-1.  These chips haven’t been made by any reputable source in decades, so everyone ends up buying from unknown sources on the internet, usually floor sweepings from China.  It takes about 10 minutes to thoroughly test a single chip, so I was looking for a fully automated way to do the testing for me.

Given the expansion bus on the KIM Clone, I designed a really simple little board that takes 256 bytes of otherwise unused memory and maps in a known good 68B21 PIA, a 68B21 under test and a 6532 under test.  Add a bit of clever software and all pieces of either the 6832 or 6532 can be tested in a matter of seconds!

This is revision 1 of the board:

It uses one chip to decode the address to see if the address is for this board or not, then another chip to decode which chip on the board is being addressed.  As you can see, a third chip was tacked on once it was obvious I had missed something.  The lowest chip is the known good 68B21.  The empty socket is for a 6821 being tested, and the top socket is a 6532 being tested.  The two test sockets were supposed to be ZIF (Zero Insertion Force) sockets but I didn’t make the holes large enough and was forced to use standard 40 pin IC sockets.  Both the missing chip and the wrong size holes have been fixed on the rev 2 boards.

There is a separate power switch for the board so I can turn it off and swap chips for testing.

The code is very simple and is just over 1K in size.  It tests the RAM and I/O ports fairly well, but the timer section is a bit weak and needs more work.  I’m a software person by profession, so once the hardware is solid I can spend an infinite amount of time putzing around optimizing the software.

Let me talk about adding I/O devices that don’t need much address space.  On the KIM-1, the space from 1400-17FF is grouped into the K0 block but only 17xx are used, leaving 1400-16FF open for use.  To decode that range into four blocks of 256 bytes is easy using a single chip and a few signals from the KIM Clone expansion bus:

Everyone has a 74LS138 in their parts collection, so just connect a few signals from the expansion bus and use one of the three signals from the 138 to decode which block you want to use.  Use the A0-A7 address lines to decode into smaller pieces.

 

Using KIM Clone I/O Pins

Using KIM Clone I/O Pins

Like the original KIM-1, there are 16 I/O lines on the KIM Clone that can be used for your own projects. They are brought to the connector labeled “SD SYSTEM” along the top edge of the board and were meant to plug into one of our SD Card Systems for program storage. However, they are general purpose I/O lines which can be freely used for other things if the SD system is not used.

This is a portion of the schematic showing which pins on the 6532 are connected to which pins on the connector:

Don’t worry about the signal names associated with the various lines, they are the names of those signals when an SD Card System is attached.

As you can see, there are 16 IO lines, 2 ground lines, and 2 lines with +7.5… if you want to draw power from this connector for TTL/CMOS circuits then you need to add your own +5 volt regulator! D2 prevents back-feeding power from the connector back into the KIM Clone.

On the circuit board, pins 1 and 2 are labeled but are covered by the connector, so here is a reference:


All of the odd numbered pins are on the “bottom” row while even numbered pins are on the top. Ie, the top row has pins 2, 4, 6, etc, while the bottom row has 1, 3, 5, etc. Displaying the circuit board traces on the bottom layer of the board you can clearly see the ground and power lines connected to the pins on the far right:

The datasheet for the 6532 RIOT chip is readily available on the internet, but here is an easy one:

http://archive.6502.org/datasheets/mos_6532_riot.pdf

To program the chip you basically need to set the direction of each pin of the I/O port of interest (Port A or Port B), then set the data or read the data. The base address of the chip is 1700 (hex). There are four registers:

Address Use
1700 Data register A
1701 Data direction register A. Setting a bit to 1 makes it an output bit, 0 makes it an input.
1702 Data register B
1703 Data direction register B. Setting a bit to 1 makes it an output bit, 0 makes it an input.

An Example

I needed to test experimental address decoder logic and found it was easier to just plug it into the I/O ports and write some code on the KIM Clone to simulate the addresses and display what the decoder logic did:

Port A simulates address lines A11-A16 and port B has the three decoder outputs (/RAM, /IO, /EEPROM). A small program simulates all possible values of the five address bits, displays the address, reads the decoder inputs and then displays which are active. In about an hour I was able to fix one minor bug in the decoder design and perform a full unit test on how it works. Certainly not a fancy example of using I/O ports, but sometimes it far faster to build a small circuit and use software to test it rather than building a lot of hardware and manually debugging it all.

Building a KIM Clone

After building a few dozen KIM Clone boards, I’ve gotten pretty good at optimizing my time at the bench so as to reduce the amount of debugging necessary if a board does not come up the first time.  If you want to use my hard-earned advice, feel free to follow my suggestions.

But first…

Do not install all the parts before testing!!!

It is worth repeating…

Do not install all the parts before testing!!!

And yet again in case you missed the previous two warnings…

Do not install all the parts before testing!!!

I am an engineer by profession, and we never, ever, just write thousands of lines of code or build an entire product without testing sub-assemblies, so please follow the advice from someone who has built a lot of KIM Clone boards.  One of my many jobs over the years was at a DoD project and they had a motto that is excellent: “Build a little, test a little, learn a lot.”

Parts

The thumb drive included with the bare board has a user manual with a BOM (bill of materials).  Some parts are very generic, like 1/4 watt resistors, while others are very specific, like the 7 segment LEDs.  Unless you are willing to try experiments, I suggest you get the exact components called out.  I have provided the manufacturer’s part number and usually a Digikey part number.  If you swap components it might work, but I can’t offer much help if it doesn’t.

Capacitors are all .1″ (2.54mm) lead spacing.

All resistors are 1/4 watt.

Power

The first steps are to bring up the power section.

  1. Install J1, S1, D1, VR1, C1, LED1, R1, C15, and D2.  VR1 really needs a heatsink, and it’s good to use some heat transfer paste.
  2. Once those components are installed, connect a 7.5-9 volt supply to J1 and turn on the power switch; you should see the power LED light up.  I’d suggest checking power at a few chip locations for +5.  You can do a simple check by measuring the voltage across pins 8 and 16 of IC7, and across pins 8 and 16 of IC10.  You should get +5 at both of these (ground is pin 8, +5 is at pin 16).
  3. Next, add the filter capacitors, as there are a lot of them.  C2, C7, and C5 are 1 uf, while the rest are .1 uf.  Note that these values are not critical, but should be close to what is called out.  If in doubt, going with slightly more capacitance is preferable to slightly less.

Reset/NMI Circuit

  1. Install the IC socket for IC14.
  2. Install 1K resistors at R30 and R31.
  3. Install 47K resistors at R32 and R33.
  4. Install .22 uf capacitors at C5 and C6.
  5. Install S23, the RS (reset) button.  Do not install any other buttons.

Various Analog Parts

  1. Install a .001 uf capacitor at C18.
  2. Install OSC1.  Note that one corner is square while the others are rounded.  The silkscreen indicates where the square corner goes.
  3. Install all the 3.3K resistors (12 of them, all on the left side of the board).
  4. Install the three DIP switches.  The ON position is down (towards the bottom of the board) for SW3.  The other two have ON in the up position.
  5. Install JP2, JP3, and JP4.

Chips

  1. Install all the sockets except for IC9.  We want to run some tests before doing that one.
  2. Install all the ICs.

First Run Test

  1. Now comes the fun part… let’s see if the KIM Clone is alive!
  2. Connect a USB cable between your home computer (PC, Mac, Linux, PDP-8, whatever).  You’ll need a terminal emulator program, then go into the serial port settings, select the new serial port (the KIM Clone), set the parameters to 2400 baud, 8 data bits, 2 stop bits.
  3. Set the three DIP switches as follows: SW1 to OFF (down position), SW3 to ON (up position), and SW3 to ON (down position).
  4. If you have a 6502 processor, install a jumper on JP4.  If you have a 65C02, do not install the jumper.
  5. Plug in the power supply again to the KIM Clone.
  6. Turn on power; the LED should light up.
  7. Press the RS (reset button).
  8. On your terminal emulator, press RETURN… you should get a response indicating the KIM monitor is running.

At this point, you should have a functioning KIM Clone!  I’d recommend starting a memory test and letting it run at least 30 minutes.  So let’s start the memory test by typing an X (all KIM Clone commands are capital letters), then an M, then “2000” and “CFFF”.  Sit back, make sure it completes one pass, then go relax.  It’s time for a beer.

LEDs

Now that the base system is running, it’s time to disconnect from power and the USB and start installing the LEDs.

  1. Install the 130 ohm resistors at R23 through R29.
  2. Install the 1K resistors at R8 to R13.  I’d suggest installing every other one, solder, clip the leads, then go back and install the rest.  This makes it easier to avoid solder bridges on the closely spaced leads.
  3. Install 220 ohm resistors at R14 to R19.
  4. Install Q1 to Q6.  The silkscreen shows the correct orientation for TO-92 packages.
  5. Install only LED2.  Solder one pin while pressing down to make sure the device is level before soldering more pins.  It’s hard to fix a crooked installation once all the pins have been soldered.
  6. Test the basic LED circuit by setting SW2 to the KDB (down/off) position.
  7. Reconnect power, turn on the KIM Clone.
  8. Press RS and LED2 should have some hexadecimal character.
  9. Now solder the other five LEDs following the same procedure, but you do not need to test each one.
  10. When done, turn on the KIM Clone, press RS and verify each of the LEDs has a valid hexadecimal digit.

Keyboard

  1. Install the remaining keyboard switches.  They take some pressure, but should pop in and sit flat on the PC board.  If one isn’t flat, gently pry it out and check for a bent pin.
  2. Solder all the pins.
  3. Turn on power again and press RS.
  4. By default the KIM monitor is in address mode, so type each key from 0 to F four times and verify the four left-most LEDs display the same values at the end.  This is also a good check for the LEDs to be sure all segments of all LEDs are working.

At this point you can actually play a game!  Press 1800 on the keypad, then GO.  Lunar Lander is running.

Expansion

  1. Install the socket for IC9.
  2. Install the SV1 connector.  The notch in the middle of the connector should be facing towards the bottom of the board.
  3. Install IC9 (6532).

USB LEDs

  1. Install 470 ohm resistors at R37 and R38.
  2. Install LED7 and LED8.  There is a plus sign to indicate where the longer lead goes.

Now What?

You are finished!  Go have some fun!

Fix for KIM Clone Single-Step Problem

Fix for KIM Clone Single-Step Problem

Rev 1B and rev 2 boards have a problem where single-step mode does not work. It works for old 6502s but not for newer ones nor 65C02. The solution was very simple: add a .001 uf capacitor across U16 pins 7 and 8. All assembled KIM Clones now have the modification and future revisions of the board will have the capacitor on the motherboard.

KIM Clone I/O Not Receiving Serial Data

KIM Clone I/O Not Receiving Serial Data
While testing the KIM Clone I/O Board I was using a real ASCII terminal and everything was working exactly as it should. After the board was in product a dedicated tool was written to run complete tests of the board and the serial port was no longer receiving data.

As it turns out, it is possible to set the various jumpers on the board so that the DCD line on the 6850 is floating, and it tends to float to a state where it ignores incoming data. My test jig simply loops back pins 2 and 3, leaving DCD unconnected.

The easiest solution is to pull the jumper off JP8, then place it between pins 6 and 7 on JP10. This forces the DCD to ground, which allows the receiver to work as expected.

Depending on your application, whatever is connected to the DB-9 might pull DCD to the active state which also allows the receiver to work properly.

Future revisions of the board will have a pull-down resistor on both DCD and CTS so unconnected inputs will default to the proper levels for normal operation of the ACIA.

post

KIM Clone Rev 5

After almost a year (2019)of on-again, off-again, development we finally have a new revision of the KIM Clone.

It has everything the previous versions have, but with a few improvements people have asked for (or I wanted):

Expansion bus connectors! This was widely requested. Includes most processor signals, address and data buses, along with bank decoding lines. This is intended to plug into either a prototype board (more on this later) or a motherboard (in the works).
More jumpers to enable/disable blocks of RAM from being decoded. K1-K4 each have jumpers, and 8K blocks for the entire memory map have another set of jumpers. This allows blocks to be disabled on-board, then mapped to a user-supplied circuit.
Power on reset. Not a major feature, but I didn’t like having to press RS every time I turned on my KIM-1.
Power connector and the power switch moved to the top edge of the board.

KIM-1 Clone Rev 5 User manual
KIM-1 Clone Rev 5 User manual, other version

KIM Clone Rev 4

The first version that support expansion connectors.

KIM-1 Clone Rev 4 User manual