It has an optional on board 16x GPIO expander, and uses common cheap add-on modules for the SD and the RTC options. It has an "Arduino heart" using an Atmega32A as EEPROM and "universal" I/O emulator (so a "legacy" EPROM programmer is not needed).
It is a complete development "ecosystem", and using the iLoad boot mode it is possible cross-compile, load and execute on the target an Assembler or C program (using the SDCC compiler) with a single command (like in the Arduino IDE).
Details
* * HARDWARE OVERVIEW * *
The needed ICs for the "base system" are:
Z80 CPU CMOS (Z84C00) 8Mhz or greater
Atmega32A
TC551001-70 (128kB RAM)
74HC00
If you want the 16x GPIO expansion (GPE option) add a MCP23017 too.
The schematic and the BOM are attached in the Files section. The MCU Atmega32A is used as universal I/O subsystem, as Eeprom, and as reset and 4/8MHz clock generator for the Z80 CPU. Inside the Atmega32A it is flashed an Arduino bootloader taken from here, and it is possible to use the Board Manager of the Arduino IDE to "import" it.
Flash the Arduino bootloader at first (with the method you prefer), next you can upload the IOS "sketch" (the I/O Subsystem that interacts with the Z80 bus and "virtualizes" the EEPROM and all the peripherals seen by the Z80 CPU) using Arduino IDE.
You can use the on board ICSP port J3 (also called ISP port) to write the bootloader, but remember to disconnect any other connector when using it. Also both SD and RTC modules (if present) must be removed from the board when the ICSP port is in use.
As clock source for the Z80 CPU it is used the 16MHz Atmega32A oscillator, so the "external 16MHZ osc." bootloader variant must be chosen when flashing the bootloader from the Arduino IDE!.
The 74HC00 is used as RS flipflop to stop the Z80 CPU during I/O operation, giving the needed time to the Atmega32A to interact with the Z80 bus, and as part of the MMU.
The sketch for the IOS (with the needed libraries). Unzip into a folder and open the .ino file (with Arduino IDE). IOS is required for CP/M 2.2, CP/M 3.0 and QP/M 2.71 (the SD module is mandatory).
Currently working on a VT100 terminal with VGA out and PS/2 keyboard with a power supply (for the Z80-MBC2 too). It has a "transparent" USB-TTL adapter connector, so you can upload firmware or load an Intel-Hex file (with iLoad) while the card is inserted. Both the "mixed" power supply situations (USB-TTL adapter not powered from USB but Z80-MBC2 powered and vice-versa) are managed. The video terminal is based on the ChibiTerm (https://hw-by-design.blogspot.com/2018/07/low-cost-vga-terminal-module-project.html).
Because the Mighty Core gives the chance to choice a 20MHz bootloader, I've decided to try to "overclock" the Atmega32A using a 20MHz quartz:
You don't need others HW changes, just use a 20MHz quartz instead of a 16MHz one. The Z80 clock speed will be at 10MHz.
You have to select the "20MHz external" option in the "Toos" menu of Arduino IDE before flashing the 20MHz bootloader:
Of course you need to load the sketch again (using the "20MHz external" option). IOS will display the new clock speed:
Remember that using a 20MHz quartz you are out of the Atmega32a specifications (the Atmega32a is rated at 16MHz max.), so you are in a "grey area" where things "may works"...
With CP/M 3.0 it is possible use the 128KB banked RAM to have a wider user area (TPA) for programs and a more "evoluted" OS.
TWO VERSIONS
Just as example of how it is easy with CP/M 3.0 manage multiple configurations, I've done also a "non-banked" 64KB version. The switch from one version to the other can be done simply running a batch from the console itself.
I've prepared two simple batch files to do that. From drive A: the command:
submit sys64
will set the 64KB "non-banked" version and then reboot the system.
To activate again the 128KB "banked" version give the command (from drive A:):
submit sys128
NEW DISKDEFS FILE
To use cpmtools or cpmtoolsGUI with the virtual disks of the CP/M 3.0 environment, you must update the DISKDEFS definition file (from the SD in the folder <SD>/cpmtools/) and use the "z80mbc2-cpm3"entry for all the 16 disks:
Please note that for the CP/M 3.0 environment all the 16 virtual disks have the same structure and for this there is only one entry for all the CP/M 3.0 virtual disks.
AUTOEXEC
The AUTOEXEC switch for CP/M 3.0 works in a different way from the CP/M 2.2 and QP/M 2.71 implementations.
Now there is a custom utility (AUTOEXEC) that checks the IOS flag and sets the exit code accordingly (using the BDOS function 108). This allow to use the CP/M 3.0 batch conditional execution (see the CP/M 3 Programmer Guide par. 1.6.3) to run any wanted command or program based on the status of the IOS AUTOEXEC flag.
I've prepared an example using an other CP/M 3.0 feature, the "PROFILE.SUB" batch that is automatically executed at cold boot (if it exists). To activate it (in the drive A:) rename the file PROFILE.SUas PROFILE.SUB with the command:
ren profile.sub=profile.su
Now you can see how it works setting the AUTOEXEC flag on or off with the IOS "Select boot mode or system parameters" menu.
With the last IOS revision and the corresponding SD files "pack" there is an interesting alternative to CP/M developed by MICROCode Consulting that supports also file timestamping, and it is 100% CP/M 2.2 "compatible". MICROCode Consulting has released the original installation files and all the documentation in their site with the "restricted usage" condition, that means free for non-commercial use and for personal use only.
To enable timestamping (see upper screenshot) you need to install the optional RTC module. I suggest to read the QP/M documentation for the various commands (see the Downloads section in their site).
AUTOEXEC
The QP/M uses for the batch file the .QSB extension. So the AUTOEXEC file is now renamed AUTOEXEC.QSB. To enable the AUTOEXEC execution after the cold boot change the corresponding state to ON from the usual IOS boot selection menu.
In the drive A: there is an example of AUTOEXEC.QSB file ready to run.
IOS MULTI-BOOT MANAGEMENT
Now the IOS has a new entry (8) in the boot menu to manage the OS multi-boot configuration:
Each OS is associated with a set of virtual disks called "Disk Set", and changing the "Change Disk Set..." entry (8) will switch all the virtual disks of his "environment".
The new IOS is out, and the CP/M 2.2 OS with it, and 16 disks are available (from A: to P:), each 8Mbyte large.
With IOS (not for IOS Lite) the SD module is mandatory to run not only CP/M 2.2 but also for the stand-alone Basic and Forth interpreters. You need a microSD card (FAT16 and FAT32 are both supported) to store the content of the SD zip file, retaining the directory structure.
Pay attention on how the modules are inserted because their positions are fixed and absolutely not swappable (see the upper photo).
To add, extract or delete files inside a virtual disk (virtual disks filenames on SD are "DS0Nxx.DSK", where "xx" is the disk number) it is possible use the cpmtools or cpmtoolsGUI utilities, with the diskdefs file in the \cpmtools directory of the SD zipped file.
I suggest to use cpmtoolsGUI (only for Windows) because is very easy.
Unzip it into a folder and put the diskdefs file in the same folder. Select "z80mbc2-d0" only for disk 0, and "z80mbc2-d1" for the others (disk 1 - 15):
NOTE: use cpmtoolsGUI only to add, extract or delete files inside a virtual disk. Not try to create new virtual disks files with cpmtools or cpmtoolsGUI because further processing is required for a valid virtual disk file.
A cheap and easy way to burn the Arduino bootloader is to use an USBasp programmer that is commonly available:
The USBasp is also capable to give the power to the "target" using the VCC pin, but remember to check that the JP1 jumper is set to provide 5V to the target (as shown in the photo).
Please note that the pinout of the USBasp is a little different from the "standard" ICSP (os ISP) pinout:
In the previous picture it is possible see that pins 4 (TXD) and 6 (RXD) are not at GND as expected by the standard ICSP port, and pin 3 is not NC.
See the following picture showing the standard 10 pin ICSP pinout:
So you must consider this when connecting the USBasp to the 6 pins ICSP port (J3) on the Z80-MBC2 (see the schematic):
To avoid problems I suggest to use as GND pin 10 of the USBasp connector, and connect the other pins (VCC, MISO, MOSI,SCK, RST) accordingly.
An handy way to connect the USBasp to the 6 pin ICSP port (J3) of the Z80-MBC2 could be to use a commonly available "10pin to 6pin" adapter like this:
but you cannot use it "as is" because its internal connections are done for a "standard" ICSP port, and we have seen that the USBasp connector differs from the standard one. The schematic of the adapter shows that isn't compatible "as is" with the UABasp connector:
To use it is a good idea isolate the pins 4, 5 and 6 cutting the trace on the PCB of the adapter that connects those pins together, and then check with a tester. In the following photo are shown the three cuts (thin red lines inside the green "circle") to do:
BURNING THE BOOTLOADER FROM ARDUINO IDE:
To easily burn the bootloader follow these "quick and dirty" steps (tested on a linux Mint OS with Arduino IDE 1.8.5):
STEP 1: Connect the 10 pins connector of the USBasp programmer to the 6 pins ICSP port (J3) of the Z80-MBC2 (using wires or a modified adapter as discussed before);
STEP 2: Verify carefully that any other connector of the Z80-MBC2 is not used, and verify that both the SD and RTC modules (if present) are removed from the board;.
STEP 3: Only at this point connect the USB side of the USBasp programmer to an USB port of your workstation;
STEP 4: Open a "terminal" window on your workstation and go to the directory where there are the Arduino IDE executables, and get the root privileges with the command:
sudo su
then run the Arduino IDE with the command:
./arduino
STEP 5: Because Arduino IDE is running as the root user it is necessary re-install the "core" for the Atmega32. Open the Board Manager as you already did (anyway the guide is here). Note that you must do this step only the first time you execute the Arduino IDE as root;
STEP 6: Now from the Tools menu of Arduino IDE select "Atmega32" as "Board", "16 MHz external" as "Clock", and "USBasp" as "Programmer". Then you can burn the right bootloader (without playing with the FUSE setting) selecting "Burn Bootloader" from the same "Tools" menu.
Sorry, one more: can a 1N5819 be used instead of the 1N5817? When I look here [https://www.vishay.com/docs/88525/1n5817.pdf], I see slightly different parameters, and possibly the most important, slightly different forward voltages...
What a great project! I looked at the BOM, and there are quite a few components I already have. I tried to find (European) replacements for Q1/2 (2N2907), but failed. I guess this transistor is not critical in terms of parameters? Can any PNP transistor with the same pinning be used in this place, or are there specific parameters that play a role? And/or, does anybody know a good (European) replacement?
What I got in my parts bin: BC213, BC516, BC557, BC558, BC560C, ZTX213, ZTX550, ZTXC551
I built a second system. It is up and running just fine with a HM628128ALP-7 SRAM as well. To test the board I booted CP/M and ran MBASIC. I opened the "Examples with Basic" on my PC, copied the USER LED BLINK example and pasted it into Tera Term at the MBASIC prompt. This is a very easy way to get a program into the system. Then I did SAVE "BLINK",A to put the app into the SD Card disk file. RUN executed the app and blinked the LED. All in all, it took about a minute the run the app to test the LED. Very nice!
Let's see if some of you have had the same or a similar issue. So, I do not have a way to upload sketches in windows 7, but I do have a raspberry pi model b. Therefore, I use it to upload hex files to a blank atmega32a. I compile the sketches with the mightycore library, wire, etc. in windows 7, using arduino ide, and then take the hex files to burn them with the raspberry pi to the atmega32a using six wires and the GPIO connections of the raspberry pi. The result I get when I set up the computer to power it on and start the serial monitor of arduino ide, is that the IOS led starts to blink, but at a quite slow rate, and when I open the terminal, nothing happens. Has any of you had a similar problem? I uploaded a hex file that has the bootloader included according with its name, but I do not know if everything has gone really well, apparently avrdude tells me so, or if any IC is damaged. Thanks to all, in advance.
I don't remember which ones come in the configuration of avrdude, because I have not touched anything else appart from the GPIO pins I use. I will have a look at it.
I ended up using a TL866 programmer because I could not get ICSP/USBASP to work. When I went back to basics later, I found that one of the wires in the ribbon cable I was using between the USBASP and the board header was open circuit! I only discovered this later when I could not get serial comms to work using the same cable! It's always the 'little things'!
Thanks for showing me where the problem is mostramos likely to be. I am checking the avrdude.conf file, in the m32 section, and I see some subsections memory lfuse, memory hfuse and memory lock, and below, without a write option, memory signature, memory calibration.
Definitely I have to get more knowledge. I guess these are some default values I can change there or externally, without modifying this. I have seen ways to do It with avrdude. I will have a look at it.
Hi, has anyone managed to send files with Kermit, Xmodem, Qterm or similar via the console interface? I have tried different versions of Kermit (with Terraterm on the PC side) that should have worked - unfortunately without success...
Z80-MBC2 does not support hardware handshaking, but Kermit should also work without it... :-(
Currently there is probably a bug in the z80mbc2 serial handling. An earlier message states that xmodem needs hw handshaking but this is untrue if configured correctly. Xmodem for RC2014 works by default without handshaking using console con: rather than more specific hardware access, I have used that on several flavours of rc2014 computer. I would expect the same version of xmodem to work on z80mbc2. Xmodem is expected to work to the same port that the serial terminal console is using (i.e. the one CON:)
Generic Kermit should work if the system bios supports IOBYTE (it does on rc2014) but I've never tried that on a one serial port system. It is possible that use of Kermit to con: would conflict with use on the same con: for the system console. If Z80MBC2 supported Xmodem and CPM BIOS IOBYTE then I would try Kermit to see how it behaves.
I believe Qterm makes too much detailed access to hw ports which are not virtualised in Z80MBC2 so Qterm cannot work. It may be possible that someone has made a more generic patch for Qterm, but again only worth considering when Xmodem is known to work.
It would really turn Z80MBC2 into an ace system if it supported Xmodem, currently that is blocking me from giving the system a higher star rating.
vt100 card is a great addition. If you're looking at doing another revision, I wonder if you'd consider some additional mounting holes at each corner of the card for horizontal mounting? Then you could mount it in a flat rectangular box.
I've just launched my Z80MBC2 with CPM3. I like it! I had a problem initially in getting the software into the atmega32 via serial or ISP. My serial didn't support DTR. Took me a while to figure out that I need to hold shift while starting upload in Arduino IDE via ISP, otherwise I just get another upload of MightyCore bootloader.
Now I'm looking for a version of XMODEM with generic CPM3 support of CON: so that I can upload and download files within CPM3 via the single serial connection. Does anyone know of an xmodem version that works for this?
Any chance of a Z80MBC3 design with a second serial port ? :) And faster?
I am told that the xmodem from the cpm section on foxhollow.ca (popular with RC2014) works unmodified on cpm3 but I cannot get it to work under z80mbc2 with cpm3. Can anyone else get it to work? I've only tried so far under cpm3.
First of all (@Fabio): MANY, MANY THANKS FOR THIS FANTASTIC PROJECT!
And then:
It looks like XMODEM needs a hardware flow control. (see "tera-term-serial-port.png" at Foxhollow) - ...and unfortunately this is not implemented in this Arduino! :-( In addition, RTS/CTS must be connected to the USB/RS232 converter and SJ2 must be shorted with a solderblob. )
I don't think we need a Z80-MBC3 for that...
An additional serial interface would be great! Would it be possible to use a SC16IS750 (or similar) on the I2C bus??
The right version of Xmodem does not require hardware handshaking, the version on foxhollow can work to con: and not require hardware handshaking. I use it on several flavours of rc2014 inc Bill Shen's ZZ80CF (see Retrobrew under Plasmo)
Very cool, what a great project! Bought a PCB via an auction, now a scavenge hunt for the parts ;-)
I still got two (huge) 8" floppy disk drives, what would be needed to connect those (the 24V power supply has already been taken care of)?
A lot of Z80 info and other retro processors as well as some related projects can also be found on the website of Grant Searle. RC2014 is another website with interesting info on Z80 retro computing.
1. I've copied the content of the SD-S220718-R191018-v1.zip archive to the MicroSD card. This system boots up and I was able to change CP/M 2.2 to QP/M 2.71. But how can I change to CP/M 3.0? I don't know which disk image to choose.
2. Is there any tool like CPMTools for Linux? I don't have a Windows system here.
3. The blue User-LED is not lightning up on my board at any time, even when I press the User-Button. Is this correct?
@1: Enter into the "select boot mode..." menu, press 8 and then press any key (not ESC) repeatedly until you select the wanted OS, then press CR to activate.
@1: OK this was much easier than I've imagined. Thank you, this works! :D @3: Although I've listed the disk image files and seen the USERLED.BAS I haven't tried it till now. I've started it and it tells me the LED is blinking but it isn't. I will solder another one on the board maybe it was broken before I've soldered it. Thanks again!
Just want to share something I’ve found tonight. I had an ESP8266 module in my collection and using esp-link (https://github.com/jeelabs/esp-link) my Z80-MBC2 is on my wireless network and I can play with it from anywhere using telnet - and even remotely reset the board and re flash the Arduino part via a web page. It’s beyond cool! Just connected the ESP8266 instead of the USB serial module.
Interesting concept, had a read on jeelabs and thought I would give it a go. The ESP8266 is only a few dollars from Aliexpress as well - so well affordable !!!
I ordered 5 pcbs and I've received them today. I am looking at the layout guide, and I have a question about the legend which says 10 k 8. What does it mean? What's that? I've read something about SIP. But I do not know what's that. Could anyone help me? Thanks a lot in advance.
You'll find in the Bill of Materials (In Files section) the parts list.
The SIP used is 8 x 10k resistors in a Single Inline Package (SIP) with a common pin for all 8 resistors making 9 pins in total. They are also called a Resistor Array Network.
Thanks a lot. I've read about resistors array later on. I do not have much knowledge... Btw, I have around 1n5819 instead of 1n5817, and 2n3906 instead of 2n2907. Could I use them?
I am pleased to show my first proper Z80 assembler program. It's a memory tester, which might be useful in the homebrew world. It does bank switching so we can test almost all the 128k which the Z80-MBC2 has, except for the little area where the program runs!
Just paste the .hex into iLoad to give it a go, or look at the source.
I changed the avr ios program's serial from 9600 to 38400, compiled and uploaded to the avr, and it seems to run just fine (played startrek), which makes sense since the serial port is handled by the avr cpu. 9600 just feels more retro I think since the terminal draws a lot faster at 38400.
Hi. I have read through this (mostly) and it looks like fun. I live in Ontario Canada and if anyone has a spare PCB I'd appreciate it. I can paypal you for the cost. Thank you. Gabe (nemfield@gmail.com).
OK. Replying to my own comment. I ordered 5 boards. I used China Post. I'm in Canada. when I get them I'll share them for postage costs to others near me. I advice you do NOT use DHL. Here in Canada they always add some silly brokerage fee and hold you hostage unless you pay it. They are a great service, but do not come clean on all charges.
I'm living in Germany and when I'm ordering from outside the EU I'm always trying not to choose DHL because I know I have to pay some extra fees. It's terrible! If you order ar PCBway you can also choose E-Packet. I think this is a little bit faster than China Post and costs only a little bit more. And I've never had any problem with extra costs with this shipping way.
Hello, I have two questions about the used parts where I am not completly sure about.
1. question: The "user LED" should be a 2.7V version or higher but what about the voltage of the other five LEDs? Since nobody else asked this here I'm pretty sure I've overseen some information or simply I'm too stupid. :D
2. question: The two tactile switches used in the schematics are per default closed and interrupt the ground line, right? Or do I have to use a reversed switch version? The more I'm trying to get it the less I'm sure about this.
Sorry, one more: can a 1N5819 be used instead of the 1N5817? When I look here [https://www.vishay.com/docs/88525/1n5817.pdf], I see slightly different parameters, and possibly the most important, slightly different forward voltages...