Thursday, November 24, 2016

Building a 68000 Single Board Computer - Schematic Entry and Design Changes


Features

The TS2 computer described in Microprocessor Systems Design 68000 Hardware, Software, and Interfacing is a single board computer that is capable of operating on its own (with an external serial terminal). It has the following major features:

  • 8 MHz 68000 microprocessor.
  • Power on and pushbutton reset. LED indicating halt or reset condition.
  • Uses commonly available TTL chips for glue logic (no programmable PALs, GALs, FPGAs, etc.)
  • 32 KB of static RAM.
  • 32 KB of EPROM.
  • Full address decoding for peripherals.
  • Switches and circuitry for single stepping one instruction at a time.
  • Two serial ports to support a terminal and modem/host computer.
  • Interrupt encoding and acknowledge circuitry for 8 levels of interrupts.
  • Buffered signals running to a backplane connector for expansion.
  • On board monitor software that supports downloading, running, and debugging programs.
  • All circuitry on a single board (extended double Eurocard 233.4mm x 220mm/9.2in x 8.7in).

CAD Software

The goal of phase 1 of the project was to create a stable schematic, hopefully free of errors. The schematics in the book were almost complete, but omitted some details like bypass capacitors and it was not always clear what gates were parts of the same package. Some circuitry was duplicated across pages to make it clearer to understand.

I decided to enter a schematic into a modern CAD program so I could review it, print it out, and hopefully take advantage of some design rules checking to identify errors like unconnected signals.

For CAD software I ended up using KiCad, a cross platform and Open Source electronics design automation suite. Some of my requirements were that it would be free, run on Linux, and support basic schematic capture. Overall I found it quite usable. It has a number of quirks, but in my experience all CAD software has usability issues and quite a learning curve and you just have to get used to it. A side benefit was I learned a lot about KiCad, a skill I can reuse on other projects.

Schematic Entry

Entering the schematic, I mostly followed the pages that were in the text book. There were some minor errors and unknowns to figure out. Because many signals get buffered, it was not always clear if signals like AS* were the raw ones on the CPU or the versions coming from buffers. I tried to figure this out as well as possible. I may find errors when I get to testing it.

There were a few errors in pin numbers and some chips were not marked for their type, but I was able to puzzle it out. Since I made some changes to the design, my design is a little different in terms of the parts and their identifiers.

The values of pullup resistors were not all listed. 4.7K seems to be suitable (and is what the Motorola ECB used) so I used this value everywhere.

Some parts are duplicated across pages in the book (like the RESET LED, for example), which helped readers of the book but needed to be corrected in the CAD schematic.

I almost overlooked the fact that there are actually 4 RAM chips and 4 ROM chips! The text shows the circuitry for half of the RAM and ROM, and only in the text does it mention that the circuit is duplicated again using other chip selects.

The original circuit used an 8 MHz clock but provided a divider so the board could run at slower speeds (e.g. 4, 2, 1 MHz) if desired. I didn't see a good reason not to run it at 8 MHz once it got past the breadboard stage. If needed I might plug in a 1 MHz clock oscillator chip in place of 8 MHz for testing purposes.

Circuit Changes

I made a number of changes to simply it and remove features I did not expect to use.

I plan to use EEPROM chips (which are electrically eraseable) rather than EPROMs, which need to be erased under ultravilet light. This will save time when reprogramming them. They are pin compatible with the 2764 EPROMs in the original design.

I didn't implement backplane signals and associated buffering, as I don't expect to expand the board with peripheral cards.

Without any peripherals, there is no need for interrupt encoding and acknowledge circuitry. This could always be added later if needed. One could run two IRQ signals to the two 6850 UARTs, but the monitor software as written does not use interrupts.

I simplified the RS-232 interface, omitting the line drivers and receivers since I plan to directly connect the 6850 UARTs to TTL level FTDI USB to serial convertors. This also allowed removing the requirement for +12 and -12 volt power supplies. I also omitted the strange circuit that can mirror one serial port to the other in a transparent mode as I don't see a need for it.

Design Files

The schematic entry took a while, mostly because I was using KiCad for the first time. I was able to use its rule checker to catch a lot of errors.

The current files are on github here, which also includes the software as it develops. The KiCad files are here where v1 is the original circuit from the book (possibly with some errors) and v2 is the modified design that I am building.

If you don't have KiCad, there is a PDF version of the schematic there but it may not always be entirely up to date as it needs to be manually generated from the design files.

For anyone interested, keep in mind that the circuit (as of this writing) has never been built and tested yet. I will update the design as the project progresses.

Building a 68000 Single Board Computer - High Level Plan




After spending some time studying the schematic and accompanying text in the book, I came up with this overall project plan:

Phase 1:

  1. Enter the schematic into a CAD program, make some changes to simplify it, and check it carefully for errors.
  2. From the schematic, generate a parts list or BOM (bill of materials).
  3. Do a rough layout of the ICs for a wirewrapped prototype to estimate the board size needed.
  4. Find sources for and obtain the majority of the parts needed.

Phase 2:

  1. Breadboard a minimal circuit to get the CPU to run in freerun mode.
  2. Test the power on reset circuit.
  3. Test the pushbutton reset circuit.

Phase 3:

  1. Start building the circuit on a protoboard with wirewrap sockets.
  2. Get the CPU running from ROM (with a test program like a simple loop that will run without any RAM) and minimal chips.
  3. Check ROM, address decoding, DTACK and BERR timing.
  4. Test the single step circuit.

Phase 4:

  1. Add RAM, verify RAM is working with some simple test code.

Phase 5:

  1. Add baud rate generator, serial UARTs, and RS-232 ports.
  2. Program ROMs and get the existing monitor program working.

Phase 6:

  1. Fully test board including all features of the monitor program.
  2. Possibly add more circuitry that was omitted, like interrupt encoding and acknowledge.
  3. Maybe try some other software like Motorola's TUTOR monitor from the ECB board or a BASIC interpreter.
  4. Install in case, maybe add power supply or a 5V regulator.


The thinking is to just make one wirewrapped prototype. I have no plans for a printed circuit board, although that might be a fun project to learn more about PCB layout and might make it easier for others to duplicate the board. The intention is to make all of the design information (both hardware and software) freely available.

Building a 68000 Single Board Computer - Introduction

I recently started a new hardware project that I plan to document here as it progresses.

I've built several retro-computers from kits that use the 6502 and 8080 processors, including the Briel Replica 1Altair 8800, and Superboard III. While most of my work on these systems was with software, for the Replica 1 I did a little hardware design and built a 16K RAM/ROM memory board as well as a 65816 CPU adaptor. In the back of my mind I eventually wanted to do a more ambitious hardware design project.



Another classic CPU is the 68000. Years ago I worked with some 68000-based systems, but mostly programmed them in high-level languages. I always felt it had a very elegant architecture, with the later CPUs in the 68xxx series possibly being the pinnacle of CISC design, before RISC architectures took over.


I bought an excellent book on the 68000: Microprocessor Systems Design 68000 Hardware, Software, and Interfacing by Alan Clements. This is one of the best books on the 68000 in my opinion, covering both software and hardware in some detail.

The book describes a 68000 single board computer called the TS2. It was used for training at the University of Teesside where the author taught. It was similar to, and mostly software compatible with, the Motorola 68000 Educational Computer Board.

I realized that there was enough detail in the book, including schematics and theory of operation, that the board design could be replicated. Unlike some designs in textbooks, this one had actually been built and tested. The book also included on CD-ROM the code for a monitor program for the board so I would not need to write one from scratch.

I felt that designing a 68000 based single board computer from scratch myself was too risky a project, but using an existing design would have a good chance of success. I did see a number of challenges:

  1. While the design was known to work, there were likely some errors or omissions in the schematics in the book as they were hand-drawn and didn't come directly from a CAD system. My copy of the book was the third edition so I thought it likely that there were not too many errors in it.
  2. There was no board layout or even pictures of the assembled board. so I would need to figure out a suitable layout myself. I have not been able to find a picture of a Teesside TS2 anywhere on the Internet.
  3. I would need to determine if I could use the monitor program software on the CD, possibly finding a cross-assembler to build it, and program it in to EPROMs.
  4. I would need to find all of the required parts, many of which are no longer being manufactured.

These challenges all looked surmountable, and even if it got stalled or failed, the project would be a good learning experience, so I decided to go ahead with it.

Monday, March 16, 2015

Superboard /// Enclosure

The original Superboard II was sold as a populated circuit board with no case or power supply. I owned one, and made a case out of wood and some plastic that I had handy that worked as a cover. The Challenger 1P was essentially a Superboard II in a metal case.

Case for the OSI Challenger 1P

For my Superboard ///, I wanted something better than just the board. A sheet metal case could be made, given suitable tools like a bending brake, but I don't have one.

As a simple solution, I made a plastic cover to protect the non-keyboard area of the board from dust and dropping things on it that might damage or short circuit it.



I cut a piece of 3 mm Lexan to 11 by 3-15/16 inches, and mounted it with 3/4 inch nylon standoffs using the holes in the circuit board.



I was fortunate to find suitable Lexan in an 11 x 14 inch sheet so I only had to make one cut. Less expensive Plexiglas could be used too, though not be quite as durable.

Inexpensive sets of nylon standoffs and screws of various sizes are offered by sellers on eBay. I got mine from one of these sources.



Earlier I had attached some adhesive rubber feet to the bottom of the board so it is stable on a table or bench.

While not as nice as a full case, this is at least an improvement over just the circuit board.

Sunday, March 15, 2015

KIM-1 MIcrocomputer

I recently acquired an original KIM-1 microcomputer. This is quite an interesting and historically important machine, being one of the first affordable microcomputers.

This particular machine also has an interesting history. I've covered it in a YouTube video, and intend to create some more videos in the series.

For the last couple of weeks I have been entering a and running the programs from The First Book of KIM-1. I've put buildable source code as well as binary download files on my github account.




Monday, February 9, 2015

Low-Cost Pixie Transceiver Kit

The Pixie transceiver is a simple QRP amateur radio transmitter design. I earlier blogged about and made a YouTube video covering QRPME.com's version of this design, the Lil Squall.

I recently picked up one of the inexpensive Pixie kits that are sold on eBay. This one was only US$6.80 with free shipping, so I thought I would take a chance and buy one.


After a few weeks waiting for shipping, it arrived. The kit includes a nice silk-screened and solder masked PCB and all parts and connectors including a 7.026 MHz crystal and a 2 Watt 47 ohm resistor for use as a dummy load.


It needs headphones, a code key or keyer, and antenna and power source. It runs on 9-12 VDC and puts out about 600mW of RF power.

It went together in less than an hour and worked when I powered it up. It uses one IC, two transistors, and fixed inductors (no toroids to wind). The parts are all through-hole. The board is a little tight with some parts mounted vertically. It came with two sheets of instructions - basically a parts lists and a schematic - which was adequate to figure out how to put it together for someone with some experience with electronics.

On transmit I measured 240 mW at 9VDC and slightly less than 600mW of RF power at 12VDC into a 50 ohm dummy load.


The transmit frequency is fixed by the crystal, but the receive frequency can be adjusted slightly using a potentiometer. You could use different crystals but the circuit is only intended for the 40 meter band with the parts supplied.

As is typical with this design, this is not an easy rig to make contacts with due to the lower power and fixed frequency. The receiver is also not very sensitive and can suffer from AM broadcast band station overloading. A preamplifier, like this Ameco unit, can help a lot.


The one I bought was listed on eBay as "HAM RADIO 40M CW Shortwave Transmitter Receiver 7.023-7.026MHz QRP Pixie Kit DIY".

All in all, a fun little kit for the price.



Sunday, February 1, 2015

Superboard /// Theory of Operation

Here are some notes on design and theory of operation of the Superboard ///. This was gleaned from looking at the circuit and I may have got some details wrong. Refer to the schematic diagram that is included on the CD.

All parts on the board are through-hole, making it easy to assemble. All ICs are socketed, and the board is silk-screened with component designations and values. Vince Briel says that the blue solder mask used is a tribute to the blue color scheme that Ohio Scientific used in their line of computers. About half of the board is taken up by the 53 keyboard keys.


Power comes in as +5V via the USB port through the USB to serial FTDI board. Vince Briel recommends a 1000 mA or more USB power supply but the USB 2 standard calls for 500 mA from a host (computer) and the board typically takes about 115 mA, in my measurements. Note that the power switch comes after the USB to serial board, so the serial board is always on and takes some power. The power LED is after the power switch.

The original Superboard took a lot more power and was specified as needing a 5 volt 3 amp power supply. Power consumption depended a lot on the amount of RAM, e.g. whether 4K or 8K was installed. I remember on mine that a lot of the chips on the board ran quite hot, especially the 2114 RAM chips. On the Superboard ///, the only chip that gets warm at all is the 6850, which is the only non-CMOS chip on the board.

An LM3940 voltage regulator IC converts the 5V from the USB port to 3.3V. All circuitry runs on 3.3V except for the 6850 ACIA.

The USB to serial board is a low cost off the shelf FTDI board. These can be ordered from various suppliers from China and the SKU on the package matched one from http://www.banggood.com. There are some units on the market which have fake FTDI chips; this seems to be a legitimate one. It also just happens to have a blue solder mask that nicely matches the main board. It looks like Vince replaced the original right angle header on the board with a straight one, as it appears to have been hand soldered.



The DTR line of the USB to serial board goes via a cap to a transistor switch to the RESET line of the Propeller switch. This allows the Propeller to be reset from the serial port as part of the protocol for in-circuit programming. Arduino boards use a similar scheme. On Linux systems you may find that when you open the serial port it toggles DTR and resets the system, which is annoying. You can disable this using this command:

  stty -F /dev/ttyUSB0 -hup -clocal raw

The Parallax Propeller chip is an interesting device that contains eight 32-bit processors which can run independently and communicate via shared memory. It has hardware on-board to assist with generating video signals in software. a serial port, and can load a program from an external serial ROM on powerup.

The Propeller CPU does some of the emulation, most notably generation of composite video in one of two video modes, and emulation of the ROM and video RAM for the 6502. It runs at 5 MHz. On reset it loads its firmware from the serial EEPROM, a 24LC256 32Kx8 serial EEPROM. This is a standard feature of the Propeller. With the Propeller development tools (which are free) you can reprogram either the Propeller or the EEPROM via the serial port from a host computer. All of the source files for the firmware are included on the Superboard /// CD.

Vince Briel, with help from Jac Goudsmit, wrote the firmware for the Propeller chip which is included on the CD. They had to use some creativity to implement the emulation in real-time and within the available pin contraints on the Propeller CPU chip. I have not looked closely at the code. It is written in the BASIC-like SPIN programming language as well as some assembly language.

The video by default is monochrome with 25 lines by 25 characters. If you hold down the BREAK key on powerup, it uses a 32x32 video mode that some models of OSI computers also supported. However, BASIC always only uses 24x24 characters for display. The Superboard /// supports the same character set font as the Superboard II, offering 255 characters including a number that could be used for games and graphics.

The BREAK key on the key board goes to an input of the Propeller so simulate reset operation. The software requires holding it down for 3 seconds to avoid accidentally hitting it. Contrary to what the manual says, on reset you do not lose any program in memory. A BASIC warm start ("W" from the boot menu) will preserve any BASIC program in memory. The random screen on powerup is simulated in software to act like the original Superboard (interestingly, the one I owned had a powerup reset circuit and did not do this, it also had a 3 second delay on the BREAK key). At the upper left of the "random screen" is the firmware version number (currently 0.06).

The serial port transmit and receive lines go to the Propeller chip. Another Propeller i/o pin directly generates the composite video output (in software). Other Propeller i/o pins control some of the address lines and the data lines for the 6502, as well as some control signals such as R/W, RESET, and CLOCK. The 1 MHz clock for the 6502 is completely generated by the Propeller in software.

The 6502 is a Western Design Center 65C02. It is clocked at 1 MHz for compatibility with the Superboard II but can run at higher speeds (mine is a 14 MHz part). It runs at 3.3V. Between the Propeller chip, glue logic, RAM, etc. it runs in a standard fashion even though some hardware like the ROM is emulated by the Propeller. Incidentally, the 65C02 has some additional instructions over the original 6502 that can be quite useful. It is backwards compatible, with the new instructions using what were invalid/unused opcode on the original 6502. It is also much lower power than the original 6502.

The RAM uses a real RAM chip rather than being emulated. It is an AS6C1008, which is a 128K x 8 chip but only 32K is used as this was the maximum that the Superboard II supported.

The 6850 ACIA provides the serial interface. This is the same chip that was used on the original Superboard II, ensuring software compatibility. It is made by Motorola and was the standard UART at the time for the 6800 series of CPUs. It is interesting that Ohio Scientific did not use the more powerful 6551 ACIA that was made by Motorola for the 6502 series (it may not have been available at the time, or possibly it was more expensive). The 6850 is the only chip that runs on +5V, and is no longer manufactured, so new old stock chips have to be obtained. Mine has a date code of 8507 (the seventh week of 1985). It runs at 9600 baud, unlike the 300 baud of the original Superboard. On the Superboard II is was usually used for the cassette tape interface. Since the baud clock is being generated by the Propeller chip, you could change it in the Propeller firmware, although there is no hardware handshaking and the 6502 when running BASIC cannot keep up to 9600 bps and needs delays added to avoid data loss.

The keyboard circuit is similar to the original Superboard II. The key switches are arranged in rows and columns. A register can select one of 8 rows of keys and drive it low. The register is then read back to detect which, if any, keys in each column of that row are pressed. The software scans each row in turn to detect key presses. This is a simple design but has some side effects, most notably that there is no latching or typeahead of keys pressed, you can only tell if a key is pressed at the time it is scanned. It does mean that you can detect if multiple keys are pressed simultaneously, and independently detect the left and right shift keys. The BREAK key is not part of the keyboard scanning circuit.



 SHIFT LOCK is a latching key and is typically on to enable uppercase characters only as BASIC did not recognize lowercase characters in keywords or commands. The keyboard circuit uses a few discrete TTL chips for the read and write registers and for address decoding. The keyboard row and column signals are also brought out to a 16-pin DIP connector (not included) on the board so that you could connect an external keyboard, if desired. The original Superboard II did not have this connector.

The keys are high quality units made by Cherry, and the key caps are custom and made by WASD Keyboards. The latching SHIFT LOCK key is no longer manufactured, so when the supply runs out Vince will have to ship small slide switches instead (there is a place on the board to install one).

More address decoding is done by a 7HC138 decoder, and some of the signals go back to the Propeller CPU to help it identify when certain blocks of addresses are selected so that ROM and video memory can be emulated. This reduces the number of signals that need to go to the Propeller CPU.

A 40-pin expansion connector brings most of the important signals out so that in theory peripherals devices could be added. It is similar to the expansion connector on the original Superboard II, but uses a different connector since it is not electrically compatible with the Superboard II, using 3.3V rather than 5V levels. It would be an interesting project to interface the Superboard /// with one of the original Ohio Scientific floppy disk controllers so that it could run the disk operating system.

The original Superboard II has a cassette tape interface that ran at 300 baud and followed the Kansas City Standard for storing data on audio tapes. This circuitry is not included on the Superboard ///, as the higher speed serial port is a more convenient way to transfer files. There is a 10-pin connector that brings out the relevant signals so you could implement a tape interface if you desired.

That's pretty much it. There's not a lot of circuitry on the board, especially compared to the original Superboard II, which has to do things like generating the video using discrete logic, and used more than 70 ICs. You could even simplify the design by replacing the 6 TTL chips with a PAL, for example, but that would take away some of the retro design.



By the way, the name Superboard ///, is clearly derived from wanting to be the logical successor of the Superboard II, and calling it /// is a nod to the (infamous) Apple /// computer which was the successor to the Apple II.