Hi! I'm making a gamepad for an Amiga CD32. The way the origial gamepad works allows one pin of the joystick port to be used as input or output on the Amiga CD32. The pin in question is either configured as FIRE1 (input) or CLOCK (output) on the Amiga.
So in order to emulate the circuit I need to configure a pin on the Arduino as input or output depending on a latch signal.
My question is, is it safe to connect an output of the Arduino to a possible output of the Amiga CD32 or is this a big no no? What happens if both sides are configured as output and drives the signal low and high at the same time? Maybe I have to add some outer circuitry for this.
Thanks for any insight in advance!
You could use a transistor to pull the CD32 pin low and then not drive it high so your Arduino pin is not driving it low directy, and just have a weak pullup resistor to pull it high to not bother the other device pulling it low.
Thanks for the help but I'm not sure that I follow. I'm not sure that I explained the problem properly. Here is the original gamepad schematic:
In my case I have connected P5 and P6 directly to digital pins of the Arduino. P5 is the latch signal from the CD32 (for the shift register) and the pin I connected that signal to is always configured as an input. P6 from the CD32 is either configured as output or input. When it is an output it sends the clock for the shift register, when configured as input it detects fire button presses.
I can separate the fire button output to a different pin instead of changing the pin that reads the clock to output, but I'm not sure how to do it so it's safe for both the CD32 and the Arduino.
What happens if both sides are configured as output and drives the signal low and high at the same time?
You fry one or both of your outputs.
Maybe I have to add some outer circuitry for this.
Yes.
CrossRoads told you exactly what to do.
Just stick a 470-Ohm resistor between your Arduino pin and the rest of the world. Keep the pin mode as INPUT unless you're sure it's supposed to be OUTPUT, and if there are any brief periods where both the Arduino and the CD32 are asserting different logic levels on the line, your resistor passes ~10mA and nobody gets hurt. Digital inputs have very high impedances, so a few hundred ohms of external resistance like this is unlikely to cause any problems (the current is so low anyway that very little voltage is dropped). Where trouble might strike is in higher-speed situations where the capacitance of the input gates becomes significant. I very much doubt that this is one of those situations!
When the direction is wholly managed by hardware, such as when mating microprocessors with memory devices, this sort of safety net is rarely used. When the direction is software-controlled, however, I'll almost always do this, as I'm not a big fan of building circuits that can be destroyed by faulty programming. Easy to drop the resistors later if the timing turns out to be reliable.
Grumpy_Mike:
Yes.
CrossRoads told you exactly what to do.
Thanks, he probably did but I didn't really understand :), my electronic skills are not the best, I'm stronger in programming. Do any of you know of an example I could look at?
jaholmes:
Just stick a 470-Ohm resistor between your Arduino pin and the rest of the world. Keep the pin mode as INPUT unless you're sure it's supposed to be OUTPUT, and if there are any brief periods where both the Arduino and the CD32 are asserting different logic levels on the line, your resistor passes ~10mA and nobody gets hurt. Digital inputs have very high impedances, so a few hundred ohms of external resistance like this is unlikely to cause any problems (the current is so low anyway that very little voltage is dropped). Where trouble might strike is in higher-speed situations where the capacitance of the input gates becomes significant. I very much doubt that this is one of those situations!
When the direction is wholly managed by hardware, such as when mating microprocessors with memory devices, this sort of safety net is rarely used. When the direction is software-controlled, however, I'll almost always do this, as I'm not a big fan of building circuits that can be destroyed by faulty programming. Easy to drop the resistors later if the timing turns out to be reliable.
Thanks! The solution I use must be guaranteed not to destroy any outputs. The time between the clock pulses are about 10 microseconds and the pulse itself around 4 microseconds, so not fast I guess.
Thanks, he probably did but I didn't really understand
Then you should have asked about what you did not understand. If you read the how to use this forum sticky post it tells you what to do when you receive an answer.
I consider the "stick a seriese resistor in" a bit of a sticking plaster solution if you are going to do it then it needs to be about 1K. Even then it makes the circuit much more prone to picking up noise and acting erroneously. It is bad engineering practice and your circuit should be designed so that the hazard situation will not cause damage.
Grumpy_Mike:
Then you should have asked about what you did not understand. If you read the how to use this forum sticky post it tells you what to do when you receive an answer.
Ok thanks, I wasn't trying to be rude or anything, since I didn't understand I thought it was good to give a better description of the circuit and problem. I appreciate all the help I get!
Grumpy_Mike:
your circuit should be designed so that the hazard situation will not cause damage.
That's exactly what I need to do, if the solution by CrossRoads is the way to go I need to understand it fully.
CrossRoads:
You could use a transistor to pull the CD32 pin low and then not drive it high so your Arduino pin is not driving it low directy, and just have a weak pullup resistor to pull it high to not bother the other device pulling it low.
Thanks again for this, can you clarify how to connect this and what transistor to use? I don't know much about transistors I'm afraid, this is a draft for a schematic but I don't know how to connect and maybe I even used a wrong transistor: