Pages: [1]   Go Down
Author Topic: Arduino Uno + Z80 CPU, probably weird electrical problems, need help  (Read 1902 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

First of all, hi everyone, first post here.

I'm trying to run a Z80 CPU together with Arduino and here is my current layout:





The program loaded into Arduino simply sends 1 Hz CLK via pin 13. The whole thing is powered from a 9V battery.
As soon as I press down and hold the little switch, the thing starts working, NOPs (opCode is zero - all data lanes are GNDed) are being executed and PC increases (you can tell thanks to the AO led).
The problem is, when I remove the marked resistor from the layout (and thus the green LED stays disconnected), the CPU is not working, which is weird, because there is no logical dependence between this part of the layout and the CPU.
Another thing is, with or without this resistor, the CPU get pretty warm/hot within 2 mins - should these old babies even get warm?
Unfortunately, my electrical knowledge is pretty low  and maybe there are some electrical problems with my layout, so maybe one of you could tell me what's the problem and how to solve it. Thanks in advance.

PS. If this is wrong category, please move this topic.
« Last Edit: June 05, 2011, 06:51:15 am by Mafos » Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 201
Posts: 8647
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm confused about your reset circuit.  It looks like the button will connect the Reset line to +5 but since the Reset is an active-low signal that makes no sense.  Typically you would have Reset tied high with a pull-up resistor and use the button to connect it to ground to force a reset.

Looks like that resistor might have been acting (through the LED) as a pull-up on your Reset pin?  If you let the pin float the processor might be resetting.

If the Z80 is a CMOS chip then all logic inputs must be pulled UP or DOWN.  Floating inputs can cause two complimentary transistors to turn on at the same time and thus cause a short circuit between power and ground.  That would cause the heating you noticed.
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm confused about your reset circuit.  It looks like the button will connect the Reset line to +5 but since the Reset is an active-low signal that makes no sense.  Typically you would have Reset tied high with a pull-up resistor and use the button to connect it to ground to force a reset.

Looks like that resistor might have been acting (through the LED) as a pull-up on your Reset pin?  If you let the pin float the processor might be resetting.

If the Z80 is a CMOS chip then all logic inputs must be pulled UP or DOWN.  Floating inputs can cause two complimentary transistors to turn on at the same time and thus cause a short circuit between power and ground.  That would cause the heating you noticed.

Well, reset is active when the button is not pressed. In order to disable reset, I need to press down and hold the button, I know it's weird, but this is how it works now smiley-wink But this clears up your confusion?

By inputs, you mean all 40 pins or just the pins that "take data in"? If the second option, then all inputs are connected. Here's the Z80 pin scheme:



And the CPU itself is either NMOS or CMOS, I'm not sure here.
So, what would be the next step? smiley
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 201
Posts: 8647
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If you want the processor held in reset unless you are pushing the button I think you should provide a pull-down resistor on the Reset line.  If you want the button to do a Reset you should provide a pull-up resistor on the Reset line and have the button ground the line.

I'm wondering if the data pins are being used for output, perhaps during the refresh cycles.  With the data lines tied to ground the processor will have to work hard if any of the pins are supposed to have a 1 output.  The example I saw of a Z80 tester use 420 Ohm resistors between the data pins and ground.  That might reduce the heating problem.

Only he inputs need to be tied high or low so it sounds like you are all set there.
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm wondering if the data pins are being used for output, perhaps during the refresh cycles.  With the data lines tied to ground the processor will have to work hard if any of the pins are supposed to have a 1 output.  

Data bus is grounded (for now), thus the only available instruction is 0x0000 - NOP. This is just a single instruction-fetch-and-execution cycle, so no data is written to the data bus. During the refresh cycle, content of register R is written to the address bus.

If you want the button to do a Reset you should provide a pull-up resistor on the Reset line and have the button ground the line.

Yeah, this would be nice. So following your description, I put 2 x 10k resistors parallel between RST and the switch, and then connected the switch to the GND. Well, this doesn't work smiley , so please tell me what connection should be used here?
« Last Edit: June 05, 2011, 12:26:52 pm by Mafos » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I did some more test - I measured the voltage on all inputs and data/address bus with both configs. The results seem to be OK - LOW signals are at about 0.02V and HIGH at 4.98 V. The only weird value is the HIGH output of address bus - it's only 2.78 V. Is this value OK?

Another interesting thing: if I completly detach RST wire, power up the whole thing, then wait about 10 clocks and then connect _RST_ direct to 5V, the thing works without problems. I don't get it.
« Last Edit: June 05, 2011, 04:36:14 pm by Mafos » Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 201
Posts: 8647
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If you want the button to do a Reset you should provide a pull-up resistor on the Reset line and have the button ground the line.
Yeah, this would be nice. So following your description, I put 2 x 10k resistors parallel between RST and the switch, and then connected the switch to the GND. Well, this doesn't work smiley , so please tell me what connection should be used here?

Pull-up resistors connect between the signal pin (RST) and VCC (+5v).
Connect the button between the signal pin (RST) and Ground.

The example for a Z80 tester I found vie Google mentioned that the RST line had to be held LOW for at least four clock cycles to assure a proper reset.  They said the processor got into all sorts of strange states on a short reset.
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok, I changed the location of the resistors and now reset works like it should, and the whole layout works now. To avoid creating new topic, I'll ask here:

I want to read and write data to the databus using arduino. On the arduino side there are 2 separate connections for read and write, thus there are 3 connections per data lane. To avoid waisting I/O ports, I use 74595 and 54597 shift registers. This is how i want to solve it. Is it going to work?

Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 201
Posts: 8647
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, if the output shift register as tri-state outputs you just have to de-select the chip to keep it from driving the data bus.
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Pages: [1]   Go Up
Jump to: