Z80 Project Mark 2: More Dodgy Mods
Last updated: 06 Oct 2009 - 15:18
So, I got some lights flashing over two weeks ago and then went quiet, "what's been going on?" you may well ask. Once I got the lights flashing, I wrote another demo that does a chase across the row of LEDs, this would show up if any of the tracks on the data bus were shorted as each led is lit individually and is driven by a single bus line. Once I'd done that I started work on the serial port code for the PIC's onboard serial port. The basic send and interrupt on receive code is working so it echoes each character it receives back at the moment. However to test the code in the PIC I needed a nice serial-terminal application so decided to write one with PyGTK, threading and python-serial. I've got that working fairly well now, once I've developed it a bit more I will probably release it somewhere.
However, I hit something of a problem while studying data sheets. It explains why no one has tried this whole running DMA while the Z80 is in reset idea before. Basically while the
Z80 Project Mark 2: Flashing lights progress
Last updated: 20 Sep 2009 - 17:38
I have made some progress on the Z80 project. Another mod, some software and learned some new lessons about PIC programming on Linux.
Another Mod I realised the other day that my plan to start testing peripherals with the PIC before inserting the Z80 would not work. My design has bus buffering to ensure the mash up of TTL and CMOS components all get valid signals. However the decision about what chip is driving the bus is made based on the status of the BUSACK line from the Z80. This means that without the Z80 fitted, or with it held in RESET the two sets of bus drivers (one from the Z80 and one from the PIC) could be in conflict as their enable line states are undefined. To deal with this problem I've added a 10K pull down resistor under the Z80, this will make sure that if the Z80 isn't driving the pin (because it's not fitted or it's in reset) the PIC has control of the data bus.
Software The first bit of software I wrote was a trivial
Z80 Homebrew Progress
Last updated: 02 Sep 2009 - 22:26
I've made some progress on the Mark 2 project and started the Mark 3!! First the Mark 2, I've built the system that I detailed in the articles on the Mark 2. There are a few odd bugs that I spotted as I tidied the circuit diagrams to add to the articles, these will need minor re-wiring of a bit of the glue logic. I kept the system on two bits of strip-board with the CPU and the PIC on the top layer with a bit of glue logic, the rest of the system (I/O decode, memory and peripherals are all on a lower layer, interfaced with 4 ten-way pin headers and receptacles. (Pics will follow soon). The pin-outs of the connectors can be seen in the circuit diagrams.
I've done electrical testing on the system so far. All of the power pins have the right voltages on them, including the +/-10V outputs on the MAX232 chip. The clock output on the 74HC4060 chip that provides the clock for the UART is stable and at the correct frequency. The PIC also registers with the correct part number when c
Nathan's Z80 Project Mark 2: CPU
Last updated: 26 Aug 2009 - 23:06
The CPU in this system is a Z80 of course. There isn't much to this section in way of technical content, just a few explanations of what pins I've ignored and why really. I'm not using the RFSH pin as I'm using static RAM, I can't think of a reason to use this in a modern system, and can think of lots of reasons not to, DRAM is just too much like hard work if you ask me. I've not connected anything to halt as I didn't really have room on the board in the end, it is often handy to put an LED on here (although it should be driven with a transistor as this pin can't sink/source much current). I've not used the non-mask-able interrupt so that's tied high to stop it going off by accident, the M1 line is not used in this simple system, so is left un-connected.
There are two interrupt sources in the system, the clock and the UART, so the interrupt signals are combined with a simple AND gate, (remember if you want a trigger on either one OR another active low signal you must AND them, l
Nathan's Z80 Project Mark 2: CPU Supervisor
Last updated: 24 Aug 2009 - 22:43
A large amount of the usual faff found in Z80 systems has been avoided in my design by including a PIC next to the Z80. This PIC replaces the reset timing circuit, the clock generation circuit for the Z80 and the need for ROM and associated decode logic to select the ROM chip. In addition it provides mass storage (via an SD card interface) and a useful in-circuit emulator for debugging.
All this is achieved by giving the PIC ultimate control over the Z80 by controlling the reset and clock lines, as well as the DMA control lines. The PIC can then control the system while the Z80 is in reset or DMA mode. Since PICs can turn their pins from input to output, several pins function both as input and output depending on what the PIC is doing (e.g. RD, WR, WAIT etc.) Others have been added specifically for debugging or booting (e.g. MREQ, IORQ, and address pins). To be able to drive the whole 16bit address bus the PIC uses a latch for the high 8bits. The lower 8 are driven directly b
Nathan's Z80 Project Mark 2: Debug Ports
Last updated: 24 Aug 2009 - 20:19
One thing I've learned about Z80 systems is that they are quite hard to debug, at least compared to modern micro-controller based things that you can always get to flash an LED at you or dump data through a serial port. To help with the inevitable debugging that this system is going to require I built in a couple of debug features. One is that I connected more control lines that were absolutely necessary to the PIC. These extra control lines coupled with its design requirement to be able to take over the whole data and address bus mean that it can run as an in-circuit emulator, with access to all the RAM and IO devices in the system. To make this access useful to me, I added a 4 pin port compatible with the Parallax PropPlug, a simple USB to TTL serial adapter. Basically it's like any serial to USB adapter but with only the receive and transmit lines, and without all the annoying RS232 signal level issues. So the plan is to write a basic debug mode for the PIC that accepts comman
Nathan's Z80 Project Mark 2: Real Time Clock
Last updated: 20 Aug 2009 - 22:41
The only additional feature I actually included in this project was the Real Time Clock (RTC) chip. I had got hold of this chip a couple of years back and was planning on using it in the Z80 Project (Mark 1). It was the last one Farnell had in stock and was then discontinued by them, I believed at the time that they were generally going out of production but I found this evening that they are still an "active" product according to Texas Instruments. There seems to be stock available from Digi-Key.
The chip provides a real time clock (i.e. counts seconds, minutes, hours etc.) as well as a number of additional functions with its built in CPU supervisor. There is a watchdog timer as well as brown-out detection and NVSRAM control. I'm only using it as a clock and counter though. There are only three components to fit to make it work which is one of the great advantages of this elderly technology, the chip itself which shares m
Nathan's Z80 Project Mark 2: UART
Last updated: 20 Aug 2009 - 19:44
I chose to keep the peripheral count low on this system, this was for several reasons;
- Less to debug
- Less to build (so faster, very important to stop me adding "features"!)
- Provides a better system for experimenting (more IO address free)
The basic requirement was for some sort of output display and some sort of alpha-numeric input. So the simplest solution I could think of was a UART, attached to something with a screen and keyboard running a serial terminal. I looked at using the PIC already in the system as a UART as well, but decided that it would be better used as a fast DMA controller with all its pins allocated to that. I had a 6402 UART chip of a similar vintage to the Z80 CPU lying around so that became the core of the UART peripheral.
There are three peripheral chips in the UART system, a 74HC4060 clock/divider chip, a MAX232 RS232 level shifter and a 74LS541, an 8 bit tri-state buffer. The clock/divider chip provides an independent clock source for the U
Nathan's Z80 Project Mark 2: Memory
Last updated: 17 Aug 2009 - 23:23
The memory part of my Mark 2 system is extremely simple. There are two 32K SRAM chips (actually FRAM because I had them lying around, but there isn't any significant difference in this application). These are selected with the logical OR of the MREQ signal and A15 (or inverse of A15 for the upper chip). Because the boot code for the Z80 is held by the PIC and the PIC can control the whole address bus while it holds the Z80 in reset the boot code is written to normal RAM after power-on. This provides the advantage of less decode logic, and no ROM chip, as well as allowing the whole of the memory space to be used by whatever application is running as there are no "unwriteable" regions.
Nathan's Z80 Project Mark 2: Overview
Last updated: 17 Aug 2009 - 19:50
I've actually started building this Z80 project already, so this one might get to do something more than just a debug pattern on some LEDs. The design for this is fairly minimal and is based around two main factors; stuff I've done or planned before (so understand to a certain degree) and parts I have lying around. As such the components might be a bit odd, and possibly unavailable (sorry).