Introduction: An Easy to Build Real Homemade Computer: Z80-MBC2!
If you are curious about how a computer works and interacts with "external things", nowadays there are a lot of boards ready to play like Arduino or Raspberry and many others. But this boards have all the same "limit"... they hide the inner part because they use a MCU (Micro Controller Unit) or a SOC (System On Chip) so you can't touch the CPU, I/O, the internal bus and all these stuff that are what makes a computer work.
There is an other option using some older part as 8bit CPUs (the so called "retrocomputing"). They are simple to understand and you can find a lot of documentation and books for free, and allow to build real computers with all the needed function blocks (CPU, I/O, RAM, ROM/EPROM, etc...).
But generally they use hard to find parts, and require outdated instruments like an EPROM programmer and eraser or a GAL programmer, and simpler ones have very limited features.
So I've mixed old and "new" parts to make an unique design that doesn't need any legacy EPROM programmer or fancy ICs, using easy to find components. The Atmega32A MCU acts as an I/O subsystem, "emulating" the EPROM and all the I/O components. More, using an Arduino bootloader, It can be easily programmed with the well known Arduino IDE.
The needed ICs are:
- Z80 CPU CMOS (Z84C00) 8Mhz or greater
- TC551001-70 (128KB RAM)
If you want the 16x GPIO expansion (GPE option) add a MCP23017 too.
The Z80-MBC2 has a multi-boot capability and can run CP/M 2.2, QP/M 2.71 and CP/M 3 (128KB banked memory supported), so you can use a very large amount of SW with it (e.g. you can easily find Basic, C, Assembler, Pascal, Fortran, Cobol compilers, and some of these are already provided in the virtual disks on the SD).
Hard Disks are emulated using a microSD FAT16 or FAT32 formatted (a 1GB microSD is enough), so it is easy exchange the files with your PC (16 HDs for every OS are supported) using cpmtoolsGUI .
Of course you need a terminal to interact with the Z80-MBC2, and a common USB-serial adapter together with a terminal emulation SW will be a cheap and simple choice.
Step 1: Components and PCB
First thing is find all the components to build the board. I've prepared a file (A040618 BOM v2.ods) with all the needed components that you can easily find. Of course a basic skill is required, and it is supposed that you are able to find components "around"...
About the PCB I've prepared an "easy link" to order a small batch (5 pcs. min.) of PCB here.
Step 2: Modules You Need Too...
You need also to buy (if you haven't) some common cheap modules (see photos):
- An USB-Serial adapter;
- A microSD module;
- A DS3231 RTC module (optional);
- An USBasp programmer (to flash the Arduino bootloader into the Atmega32a);
- An AVR 10pin to 6pin adapter (optional).
Step 3: Build the Board
To build the board follow the Assembly Guide (A040618 PCB Layout Guide.zip) with the position of the components on the PCB (with both the parts references and the values). Also the Schematic (A040618 - SCH.pdf) will be handy.
Start to solder the thinnest components like resistors and diodes, then the ceramic capacitors and so on. The connectors and the electrolytic capacitors will be the last ones.
Step 4: Install the Arduino IDE and "MightyCore"
To load the Arduino "sketch" into the Atmega32a, you need to install the Arduino IDE and the "MightyCore" from here using the Arduino IDE "Board Manager".
In this way the support for the Atmega32a will be added to the Arduino IDE, and you will be able to select the Atmega32a as target device (see photo).
Remember to select the other options as in the photo.
Step 5: Flash the Bootloader
To make the Z80-MBC2 operative you need to flash the Arduino bootloader into the Atmega32a.
This will enable you to compile and load the Sketch into the Atmega32a using the Arduino IDE.
There are many ways to flash the bootloader. The way I suggest is to use a cheap USBasp programmer and burn the bootloader using Arduino IDE.
To connect the USBasp to the ICSP connector of the Z80-MBC2 you can use a common 10pin-6pin adapter (see the photo).
Remember to disconnect any other connector when using the ICSP. Also both SD and RTC modules (if present) must be removed from the board when the ICSP port is in use.
More info on this step can be found here.
Step 6: Load the "sketch"
Now is time to load the sketch into the Atmega32a using the Arduino IDE. For that you need to connect the USB-serial adapter (see photo) to the SERIAL port (J2) of the Z80-MBC2.
You must connect the GND, +5V/VCC, DTR, TXD, RXD pins of the USB-serial adapter and the SERIAL port of the Z80-MBC2.
Now unzip the sketch zip file "S220718-R190918_IOS-Z80-MBC2.zip" into a folder, compile it and load it with the Arduino IDE..
Step 7: Add the SD and the RTC
Now unzip the SD zip file "SD-S220718-R191018-v1.zip" into a FAT16 or FAT32 formatted microSD (a 1GB microSD is more than enough).
Disconnect the USB-serial adpter from the PC, and add to the Z80-MBC2 the SD module (with the microSD inside) and the RTC module (if you have it).
Pay attention to install the modules exactly as shown in the photo, because they aren't "swappable" in their positions, and permanent damages may occur if you exchange them!
Now you are ready to run the Z80-MBC2 using the USB-serial adapter and a terminal emulator!
Step 8: How Enter in the "Select Boot..." Menu
To enter in the "Select boot mode or system parameters" you must press the RESET key (SW2), release it and press immediately the USER key (SW1) and keep it pressed until the IOS led starts to blink.
An other way is to press both keys, release the RESET key holding the USER key down until the IOS led starts to blink, or you see the menu on the screen.
Step 9: More Info...
You may find more info and technical details about the Z80-MBC2 here.
Participated in the
Electronics Tips & Tricks Challenge