M62-bus Nano Serial Interface Board |
PCB Circuit (click to enlarge) | Nano Serial Interface Board Circuits and Info |
Eagle CAD: 1. Arduino Nano Interface 4" x 4"
Eagle CAD: 1a. Arduino Nano Interface 4" x 6"
Eagle CAD: 2. M62-bus Male Edge Connector
Eagle CAD: 3. PCB Layout 4" x 4" (Second Version)
Eagle CAD: 3. PCB Layout 4" x 6" (Second Version)
First PCB Production Board
PCB with I2C Devices
LA View of Z80 'Write' to Nano
LA View of Z80 'Read' of Nano
Arduino Nano v3 Pinout
(Bill of Materials) |
PLEASE NOTE: I do not sell production boards. If you would like to buy an M62 Z80 system board/parts kit, contact Peter Murray, Peter@39k.ca I simply provide you with information to build your own breadboard computer.
Giving credit where it's due The Serial Interface board was designed by Peter Murray to allow the Z80 to communicate on its 8-bit parallel data bus through a 5v Arduino Nano to your I2C and SPI devices like RTC, SD, weather sensor, etc.
NOTE: 2019-11-20 I'm still testing the first version of the PCB that has returned from fabrication; the 6th item in the adjacent panel is a picture of it. It seems to work well as long as you use the upper I2C pins, SDA and SCL. If you wish to use the lower ones, you'll need to build a solder bridge between the upper and lower SDA pins and another solder bridge for the upper and lower SCL pins. NOTE: 2019-12-02 The first 3 adjacent CAD diagrams are for the second version of the PCB that goes out for fabrication today. Use either design at your own risk.
Overview If you attempt to use the Z80 and either an 8255 PPI/PIO or a UART to communicate with SPI or I2C devices like a Real Time Clock (RTC) or Barometric/Temperature sensor, etc., you're probably going to have to bit-bang the processor to communicate with these modern modules. One alternative to this kind of "pain" is to let a microcontroller like the Arduino Nano do all the "heavy lifting". Instead of the Z80 sending one bit at a time serially, it will send 8 bits in parallel on its Data bus to the Nano. The Nano in turn will send the data using either the I2C or SPI protocol to communicate with the device.
How does the Z80 write to or read from the Nano? Z80 -> Nano: The Z80 issues an OUT instruction to the Nano. This sets the data bus with the data. The addressing circuitry will trigger a latch holding the Z80 in a Wait state while notifying the Nano and giving it time to a) read the data off the bus, b) determine the address it was trying to reach, and c) release the latch allowing the Z80 to resume. Nano <- Z80: the Z80 issues an IN command to the Nano which triggers the latch and notifies the Nano. The microcontroller will read the address and load its data bus with the appropriate response. The latch is released by the Nano so the Z80 can read the data via a '244 buffer.
General Operation During a Z80 write-to-IO-bus operation, '244 IC4 is enabled via the Nano A_RD signal to gate the Z80 D0 to D7 signals onto the Nano bus. During a Z80 read-from-IO-bus operation, '244 IC5 is enabled via the A2Z (Nano to Z80) signal to gate the Nano A_D0 to A_D7 signals onto the Z80 bus. It was initiated via the Z80 RD signal to the Nano. For orderly flow, the WAIT signal to the Z80 is used whenever a Z80 (I/O) OUT or IN instruction for the I/O address range is executed. The Nano was initially interrupted via the A_INT signal. Normal operation is resumed when the Nano sees the A_REL signal.
Operations nitty gritty Use
schematic 'M62-bus_Serial_IF_Bd_01.png',
Arduino sketch
Z80-Nano_SIF.ino, and the ROM Monitor to enter OUT or IN commands to
the Z80.
The SPI and I2C male jumpers: Your Z80 can now talk to SPI- or I2C-based devices. I2C uses jumpers JP4, JP6, JP8 and JP10. SPI uses jumper JP16. If you wish to add 2 more SPI devices, then disable I2C (SDA and SCL) with jumpers JP22 and JP23. That will make jumpers JP18 and JP20 available for SPI for a total of 3 SPI devices.
Termination Resistors: Both SPI and I2C can be finicky, especially when it comes to signal terminations needed for master or slave modes. As such, I have provided optional 4.7K pullups for I2C. The original Adafruit DS1307 RTC I tested with this SIF board had 2.2K pullup resistors. I removed them and used the SIF board 4.7K resistors and it worked fine. Additionally, I have provided optional 10K pullups and 4.7K pulldowns for SPI. You can see them labelled in the upper part of the schematic.
What do I need to program the Arduino Nano 5v? Arduino Code: Nano-Z80_SIF.ino
How do I test the Nano Serial Interface (SIF) board? Upload the sketch to the Nano, then start up the Arduino IDE's Serial Monitor function under Tools. Fire up your Z80's ROM monitor and issue an OUT instruction to address 0x20 with data 0x00. This is assuming you have jumpered the SIF for I/O address 0x20. You can see that in the adjacent screenshot, Z80 Write Nano. Then try an IN instruction of address 0x23. You can see that in the adjacent screenshot, Z80 Read Nano.
The Logic Analyzer (LA) view of writes and reads With a Z80 write to the Nano, there is no reason to use the A2Z gate. That's why we see it high in the adjacent "Write" screenshot. With a Z80 read from the Nano, the A2Z gate is enabled immediately. That's what we see in the adjacent "Read" screenshot.
I see the schematics. Where is the Bill of Materials parts list? The BOM is at the bottom of the adjacent panel.
How big is the Serial Interface board and what will the printed circuit board look like? The PCB measures 100mm x 100mm (4" x 4") or 100mm x 150mm (4" x 6"). Click the adjacent thumbnail to see a possible parts layout.
Now that I've got the SIF board working, where do I go from here? Adapt your fave real-time clock (RTC) board like the DS1307 or the DS1340 using the to the Nano sketch above and the Arduino Library RTC drivers. Then write some Z80 code to read the Registers created in the Nano sketch. We will be doing this at a later date when we design, build and test a board containing various I2C and/or SPI devices.
Note: M62 Bus is copyrighted by Peter Murray of Murray Electronics, http://www.39k.ca |
NEXT PAGE: M62-bus Nano SIF with RTC => |
Tags: Z80 SBC, Z80-to-Nano I2C Serial Interface