Electronic – Z80 Simple Computer Troubleshooting: IORQ pin not going low

cputroubleshootingz80

I'm following the instructions at http://www.reocities.com/SiliconValley/2072/z80proj1.htm to build a "proof of concept" Z80-based computer. I have wired everything on my breadboard, and programmed the EEPROM with the following program (first instruction is at address 0):

LD A,#FF
OUT (#02),A
OUT (#03),A
LD A,#01
OUT (#00),A
JP #000A

This program should just turn on an LED wired to the I/O chip (a 6522 VIA) by setting a port output pin high; however, nothing is happening. I verified that the program in the EEPROM is the one posted here, and that I used the correct opcode values. I have a 1 Hz clock signal, and can "see" activity on the Z80 address and data pins with my logic tester. I also double-checked the wiring, but still nothing.

Working backwards, I noticed the I/O output pin connected to the LED never changes to high. I also noticed that the phase-2 clock on the I/O chip is always low (i.e. it doesn't oscillate); this explains the LED not lighting, since the I/O chip only reads on the rising edge. Per the instructions, I have connected this clock to the IORQ pin of the Z80 through an inverter; however, in my project, the IORQ pin is always high. From the Z80 datasheet, this pin should go low when a port is addressed, but this isn't happening. So I'm stuck, and not sure how to proceed from here.

Am I correct in thinking the IORQ pin should go low during OUT instruction? If so, what steps should I take to figure out why this isn't happening? Other theories on what may be wrong are also welcome.

Thanks in advance!

Best Answer

Yes, the /IORQ pin should go low when an OUT instruction is executed. The fact that yours isn't suggests that the program is crashing or not running at all.

There could be many reasons for this malfunction, such as a wiring error, faulty chip etc. I would start by checking to see if the CPU can work by itself. To do that I would:-

  1. Remove the VIA and EEPROM. Check all wiring for shorts etc, and make sure the power supply and bypass capacitors are connected to the correct pins.
  2. Tie all 8 data lines to ground via resistors (~1k each), to create a NOP instruction.
  3. Power up the circuit and check that all input signals are correct (/INT, /NMI, /BUSRQ, /WAIT, /RESET should all be high)
  4. Reset the CPU, then let it run and check for activity on /M1, /RFSH, /MREQ and /RD.

Assuming that test passes, change the opcode to OUT(#D3),A by raising all data lines to +5V except D5, D3 and D2. Then restart the CPU and look for activity on /IORQ and /WR.

If that doesn't work then the CPU is probably faulty (or a fake!).

If those tests pass then remove the resistors and put the EEPROM back in. You should get similar results. If you get activity on /M1, /MREQ and /RD (indicating that instructions are being read and executed) but nothing on /IORQ, check that the data and address lines are matched up between the CPU and ROM, and that the ROM is putting the correct data onto the bus.

If that works, then there must be problem in the VIA or its wiring.