Shop OBEX P1 Docs P2 Docs Learn Events
5V and the Propeller — Parallax Forums

5V and the Propeller

cbmeekscbmeeks Posts: 634
edited 2015-05-09 07:40 in Propeller 1
I'm sure this has been asked many times but how are you guys typically connecting 5V devices directly to the prop?

I'm mostly concerned with the Z80. In the past, I have used BSS138 level shifters between the devices and that seems to be OK but I've never used them for anything high speed.

My design is going to require the propeller be tied directly to the address and data bus of the Z80.

Thanks for any tips.
«1

Comments

  • localrogerlocalroger Posts: 3,451
    edited 2015-05-06 10:32
    The simplest thing if it works is to use a series 3.3K resistor on each line to limit the current the 5V line can push through the clamping diodes on the Propeller. Most 5V systems will accept 3.3V as logic 1.

    If that doesn't work there are level converter circuits and (mostly SMD) chips to do the conversion, but that gets somewhat complex with a bidirectional bus like a data bus.
  • cbmeekscbmeeks Posts: 634
    edited 2015-05-06 10:37
    So it would be a 3.3k resistor just inline between the bi-directional pins? Or would the connection be a little more complicated than that?

    Oh, I know this is simple Ohm's law but I'm having a difficult time know what to plug in where. Any tips for this newbie is much appreciated. :-D

    Thanks
  • kwinnkwinn Posts: 8,697
    edited 2015-05-06 12:18
    A 3.3K resistor may work on bi-directional pins, although if you want to write data from the propeller to the data bus a '245 or level translator may be needed. Depends on the data bus loading.
  • JonnyMacJonnyMac Posts: 8,912
    edited 2015-05-06 12:43
    Oh, I know this is simple Ohm's law but I'm having a difficult time know what to plug in where. Any tips for this newbie is much appreciated.

    Inside each pin are diodes; one connected to ground, the other connected to 3.3v. If a voltage goes under -0.3v or orver 3.6v one of these diodes will conduct -- you only need to worry about the one connected to 3.3v.

    R = E / I

    If you look in the Propeller data sheet you'll find the current spec for these diodes at 500uA (0.5mA). Now it becomes easy:

    (5.0 - 3.6) / 0.0005 = 2800 (2.8K).

    You'll see the 3.3K suggestion because this is the next-highest common resistor value.
  • David CarrierDavid Carrier Posts: 294
    edited 2015-05-06 13:06
    When connecting a 5-volt signal to an I/O pin in the Propeller microcontroller, we recommend a 3.9K or higher current limiting resistor, to keep the operating current of the ESD protection diodes at half of the absolute maximum current.

    Also, keep in mind that when the Propeller microcontroller is powered off, It should not have any low impedance power supplied to any I/O pin. If a 5-volt signal may be present when the Propeller microcontroller is powered off, us a 10K or higher current-limiting resistor.

    — David Carrier
    Parallax Inc.
  • cbmeekscbmeeks Posts: 634
    edited 2015-05-06 14:02
    kwinn wrote: »
    A 3.3K resistor may work on bi-directional pins, although if you want to write data from the propeller to the data bus a '245 or level translator may be needed. Depends on the data bus loading.

    Yeah, I believe my design would need to be bi-directional. But I admit, I am really considering using the ZiCog. I just don't know how hard that would be to get going with the BIOS code I would need to use.


    When connecting a 5-volt signal to an I/O pin in the Propeller microcontroller, we recommend a 3.9K or higher current limiting resistor, to keep the operating current of the ESD protection diodes at half of the absolute maximum current.

    Also, keep in mind that when the Propeller microcontroller is powered off, It should not have any low impedance power supplied to any I/O pin. If a 5-volt signal may be present when the Propeller microcontroller is powered off, us a 10K or higher current-limiting resistor.

    — David Carrier
    Parallax Inc.

    I was looking at the Propeddle design and it appears that's what he did. I believe he used a 10k resistor network for the pin connections. However, I don't think he had as many direct pin-to-pin connections as I am thinking of.
  • Beau SchwabeBeau Schwabe Posts: 6,545
    edited 2015-05-06 17:19
    Relying on the diodes on the I/O pins through any resistor is not a good design practice. Yes it may work, but so does pedaling a bike in the wrong gear. Essentially your injecting 'noise' into the substrate and power/ground rails.

    Just use a level shifter and call it a day.

    attachment.php?attachmentid=114084&d=1430957816
    681 x 408 - 5K
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2015-05-06 18:57
    Relying on the diodes on the I/O pins through any resistor is not a good design practice. Yes it may work, but so does pedaling a bike in the wrong gear. Essentially your injecting 'noise' into the substrate and power/ground rails.

    Just use a level shifter and call it a day.

    attachment.php?attachmentid=114084&d=1430957816

    Howya goin Beau!

    I do believe you have the correct circuit but you neglected to set the resistor values as you are asking 11ma sink current from the input. The pullup is necessary but can be a high value (100k) IMO, the base resistor could be around 10k say, and the collector resistor should be selected to match the rise time desired but if we use a value of around 10k we end up with less then 1ma sink current from the input and of course, zero source current with a rise time of <10ns with a estimated combined 20nF input capacitance.

    There's a common misconception that one must use rather low value pullup resistors with the Prop and it is common to see the "recommended minimum value" of 3k3 (IIRC) taken out of context and used. That's why I ran a simulation to confirm that and changing the input capacitance to a very unlikely value of 100pf shows a rise time of only around 60ns measured at 50% of Vdd. What are your thoughts?

    BTW, I still use series current limit resistors to receive 5V signals but the values I use are much higher than what we see in many reference circuits, while 10k is common I even use 100k as well and up to 1M for higher voltages etc.

    BTW.2, yep, how many people I've seen huffin n puffin up a hill in too high a gear while others are seen over flat ground furiously pedalling "on the spot" in too low a gear :):);)
  • DomanikDomanik Posts: 233
    edited 2015-05-06 19:42
    kwinn wrote: »
    A 3.3K resistor may work on bi-directional pins, although if you want to write data from the propeller to the data bus a '245 or level translator may be needed. Depends on the data bus loading.
    With all of the resistor values suggested, 5V bus loading needs to be considered. Check the Z80 datasheet for IiH/IiL. Even a small input source/sink current of 1 ma will cause a 3.3K to have a 3.3V drop - meaning a Prop out of 3.3V will settle towards 1.5V on the input of the 5V part. If the 5V part has input currents of 50ua then the drop is reduced to 0.165V.
  • Beau SchwabeBeau Schwabe Posts: 6,545
    edited 2015-05-06 19:45
    Peter,

    Doing well, thanks for asking ! :-) ... Very busy at my new job which is good thing!

    Some would say why not just use a diode/resistor combo ... that in some cases might work, but it suffers being able to go down to the ground rail (or supply rail in an inverted configuration)

    Using the transistor solution, the Transistor is "OFF" when the Emitter junction is more positive ( by about 350 mV ) than the Base junction. The transistor solution in my original post will pull the voltage down to about 12mV if the input is taken to ground... in THIS post (slightly improved), the transistor solution will pull the voltage down to about 3mV if the input is taken to ground.

    The graphs at the bottom:
    Left side is the circuit using a transistor
    Right side is the circuit using a diode.

    attachment.php?attachmentid=114085&d=1430966499
    973 x 821 - 3K
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2015-05-06 20:55
    A tremendous amount of debate, thought, and discussion went into which value resistor would be best, and conservatively the 3.9K ohm was well justified. I'd go with that or higher if you desire a one resistor solution.

    People on these forums have all sorts of personal preferences that vary widely from way too low at 1K to a bit high at 10K ohms. I doubt if 3.3K would fail you, and many claim 10K works well. Simply stick with the 3.9K or higher just in case.

    I wasn't previously aware that a 10K resistor might be wisest if the Propeller is shut down while the 5VDC devices remain on.

    The level shifter with the 2n3904 is handy. Previously, I have only seen these done with the 2n7000 MOSfet.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2015-05-06 21:35
    A tremendous amount of debate, thought, and discussion went into which value resistor would be best, and conservatively the 3.9K ohm was well justified. I'd go with that or higher if you desire a one resistor solution.

    People on these forums have all sorts of personal preferences that vary widely from way too low at 1K to a bit high at 10K ohms. I doubt if 3.3K would fail you, and many claim 10K works well. Simply stick with the 3.9K or higher just in case.

    I wasn't previously aware that a 10K resistor might be wisest if the Propeller is shut down while the 5VDC devices remain on.

    The level shifter with the 2n3904 is handy. Previously, I have only seen these done with the 2n7000 MOSfet.

    Loopy, do your own research and don't just decide which is "better" simply because of personal preferences and then give "advice" to the group saying "Simply stick with....", because that is misleading.

    You may note that I have simulated and tested and built circuits with much higher values and in the past have even given evidence that low values have side effects. This is done scientifically rather than by what others say and also note that I referred to the "recommended minimum value" being taken out of context, which it so often is. Like maximum values (esp absolute max) in datasheets you cannot expect to work at these values without side effects. The 3.9k or less will result in more current flowing causing the Vdd supply to be pushed above 3.3V especially during times of low current consumption such as during reset and programming etc. This voltage can even reach 4V easily and there are side effects depending upon the circut. Guess what happens when you have multiple inputs arranged this way!

    But defenders of low values of series resistance say that it affects "rise time" but even with 10k input and a large 20nf combined pin capacitance the Prop can still handle signals in the MHz range. Certainly the high-impedance CMOS inputs themselves don't require drive current at any time so then if it were not for the rise time one could use resistors in the megaohm range most of the time and which I do use at times. Calculations, simulations, and testing do not mislead or exhibit personal preference, facts are facts.

    Perhaps others with some knowledge in this area of electronics would also like to provide some input on this matter.
  • edited 2015-05-06 22:33
    AN010 Low-cost Bidirectional Mixed-voltage Interfacing gives information on current limiting resistor values. It recommends a resistor value of at least 4.6k as the preferred value. I've been using 4.7k with good results.

    Go to the Parallax main page and search for AN010.

    Sandy
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2015-05-06 22:45
    AN010 Low-cost Bidirectional Mixed-voltage Interfacing gives information on current limiting resistor values. It recommends a resistor value of at least 4.6k as the preferred value. I've been using 4.7k with good results.

    Go to the Parallax main page and search for AN010.

    Sandy

    Hi Sandy, just because it has an APPNOTE designation doesn't make it all encompassing or definitive. Beau himself may well have written this document!

    The "at least 4.6k" is not the "preferred value", it is simply saying "this is the limit", nothing else. as you can also see from the appnote that it refers to 25V "RS-232" signals (more like 6V though) using 50k resistors, but once again, the minimum value. Minimum and maximum values should never be translated "recommended" or "preferred", they simply state facts which you must take into account with at least some knowledge of electronics. Those with this knowledge and who actually put it to use would not be "recommending" these values.
  • Brian FairchildBrian Fairchild Posts: 549
    edited 2015-05-06 23:03
    Why not run the Z80 at 3v3?
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2015-05-07 00:16
    Why not run the Z80 at 3v3?

    There's no "Z80" chip that runs at 3.3V (that I know of) although there are variants and packages other than DIP40. There's also the problem of the EEPROM and other chips. Why anyone would want to use a Prop just to interface to the address and data bus of a Z80 hardware system is beyond me though :)
  • Brian FairchildBrian Fairchild Posts: 549
    edited 2015-05-07 03:17
  • Heater.Heater. Posts: 21,230
    edited 2015-05-07 04:11
    Wow, I wonder how many of those monsters they are selling.
  • cbmeekscbmeeks Posts: 634
    edited 2015-05-07 05:19
    There's no "Z80" chip that runs at 3.3V (that I know of) although there are variants and packages other than DIP40. There's also the problem of the EEPROM and other chips. Why anyone would want to use a Prop just to interface to the address and data bus of a Z80 hardware system is beyond me though :)

    I looked into those variants and, from what I could tell, none of them will run 100% Z80 code.

    I am building a retro console/computer similar to the Propeddle. However, my goal is to use a real Z80 (retro coolness) but also use the prop to emulate the TMS9918 and various sound chips like the AY-3-8910 and SN76489. This console will hopefully run ColecoVision games.

    That's why.

    Now, I have several of these:

    https://www.sparkfun.com/products/12009

    What I thought I might do is check out the schematic of those (seem pretty simple) and design something similar for the two-way communication of my 3.3v components and 5v components.

    I still have to study the datasheets more, however, to see how feasible that is.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2015-05-07 05:21
    Heater. wrote: »
    Wow, I wonder how many of those monsters they are selling.

    Those are Z180s which are derived from the 80's when Hitachi enhanced the Z80 as a microcontroller (but no internal memory). It's a shrink DIP so it's not as big as the old 68000 or TMS9900 chips.
  • cbmeekscbmeeks Posts: 634
    edited 2015-05-07 06:21


    Uhhh...no. But I'm gonna!

    Thanks!
  • kwinnkwinn Posts: 8,697
    edited 2015-05-07 06:50
    @cbmeeks

    I would suggest that you take a look at other Propeller/Z80 hybrid projects to see how they did it. Google "propeller z80" and you will get a list of them. I was looking for a way to replace a very old industrial Z80 board several years ago and found a lot of ideas for interfacing a Prop and Z80 at the time.
  • DomanikDomanik Posts: 233
    edited 2015-05-07 11:12
    Recipe for a Fast Bi-Directional Level Translator...

    …allows the Propeller and Z80 to safely connect their IO busses and level translate. Makes 2 channels.
    Ingredients:
    ..1 - Dual common cathode Schottky diode in a SOT23 package, SDM40E20LC.
    ..2 - 200pf caps (140pf – 250pf okay).
    ..2 - 3.9k resistors (500 – 10k ok, but 3.9k is a good compromise to make the cap value less of an issue).

    This circuit:
    1) Runs at 0.1Hz to 30MHz in bidirectional mode without a direction control pin.
    2) Applies to an IO bus with +3V on one side and +5V on the other.
    3) Virtually no prop delay in either direction. (a tiny amount in picoseconds due to RC).
    4) Schottky diode protects the Prop IO pin up to 400ma continuous or 2A peak.
    5) PS protection if +3V turns off. As the Prop +3V supply goes to zero the diode clamps current through the 3.9K. Result = 290mv max on the Prop IO pin when +3V is zero and +5V is still on.
    6) 200pf cap peaks leading/trailing edges to compensate for parasitics in PropIO, PCB traces, Cjo of diode. As the frequency increases above 5MHz the bypass cap needs to more closely match the circuit parasitic capacitances. The typical Cjo of the diode (Diodes, Inc. SDM40E20LC) is 120pf, Prop IO ~ 8pf, traces/pads/leads ~15pf if going surface mount. So the 200pf should be closer to 140pf. An alternative is to reduce the resistor to 1k or 220 ohms. This is safe since a new diode provides protection instead of the internal Prop diode.

    I’ve simulated this particular circuit in both directions. Both halves have good levels and clean, fast transitions through respective input thresholds.
    Without a description of the Z80 input parameters from the datasheet it won’t be precise on the Z80 side; at least not until the input capacitance, VIL/VIH and input currents are taken into account. Can you provide a link to the Z80 datasheet you plan to use?
    -
    -
    attachment.php?attachmentid=114089
    1022 x 425 - 31K
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2015-05-07 21:15
    Domanik wrote: »
    Recipe for a Fast Bi-Directional Level Translator...

    …allows the Propeller and Z80 to safely connect their IO busses and level translate. Makes 2 channels.
    Ingredients:
    ..1 - Dual common cathode Schottky diode in a SOT23 package, SDM40E20LC.
    ..2 - 200pf caps (140pf – 250pf okay).
    ..2 - 3.9k resistors (500 – 10k ok, but 3.9k is a good compromise to make the cap value less of an issue).

    This circuit:
    1) Runs at 0.1Hz to 30MHz in bidirectional mode without a direction control pin.
    2) Applies to an IO bus with +3V on one side and +5V on the other.
    3) Virtually no prop delay in either direction. (a tiny amount in picoseconds due to RC).
    4) Schottky diode protects the Prop IO pin up to 400ma continuous or 2A peak.
    5) PS protection if +3V turns off. As the Prop +3V supply goes to zero the diode clamps current through the 3.9K. Result = 290mv max on the Prop IO pin when +3V is zero and +5V is still on.
    6) 200pf cap peaks leading/trailing edges to compensate for parasitics in PropIO, PCB traces, Cjo of diode. As the frequency increases above 5MHz the bypass cap needs to more closely match the circuit parasitic capacitances. The typical Cjo of the diode (Diodes, Inc. SDM40E20LC) is 120pf, Prop IO ~ 8pf, traces/pads/leads ~15pf if going surface mount. So the 200pf should be closer to 140pf. An alternative is to reduce the resistor to 1k or 220 ohms. This is safe since a new diode provides protection instead of the internal Prop diode.

    I’ve simulated this particular circuit in both directions. Both halves have good levels and clean, fast transitions through respective input thresholds.
    Without a description of the Z80 input parameters from the datasheet it won’t be precise on the Z80 side; at least not until the input capacitance, VIL/VIH and input currents are taken into account. Can you provide a link to the Z80 datasheet you plan to use?
    -
    -

    The trouble with simulations is that they are too perfect and you have to compensate them accordingly. For instance, the "3V" supply (not 3.3V) will simulate as if it were source and sink in that it can sink current which linear regulators do not do. In this case those capacitive spikes will appear on the "3V" line which if it were the 3.3V supply in practice then that can be causing problems. Of course you could clamp it directly to ground except low voltage zeners are slow and have "soft knees" in that they will leak current near the threshold. I find that LEDs in the forward direction make very good low voltage zeners with two red leds in series having a very sharp knee of 3.2V in this circuit. You can even use a green led with a red led to have a clamp voltage of 3.4V. A single blue led can also be used if it's forward voltage drop is 3.4V or so but certainly the voltage of red, green, and yellow leds is very consistent and you can easily tell what color they are simply by reading the voltage from your meter on the diode setting.

    The other problem (which might not be a problem) is that this does not take care of the Vih for any chips that might have a Vih of 0.7Vdd although it seems the standard Z80 and memory are TTL compatible with a Vih of 2V. So this does not translate a 3.3V signal to a 5V signal like a proper level translator otherwise considering certain aspects this circuit should work fine.
  • Brian FairchildBrian Fairchild Posts: 549
    edited 2015-05-07 23:03
    If the OP is going to use an original Z80 then they need to watch Vil and Vih for the clock inout. It doesn't have TTL compatible levels.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2015-05-07 23:26
    If the OP is going to use an original Z80 then they need to watch Vil and Vih for the clock inout. It doesn't have TTL compatible levels.

    You're right but fortunately that's one that doesn't need to be bidirectional so a simple 74HCT gate will drive that pin nicely. I like using the 74HCT86 single exor gates in sot23 packages as you can set them for buffer or invert although I do have those "programmable" gates too.
  • kwinnkwinn Posts: 8,697
    edited 2015-05-08 04:30
    Those are Z180s which are derived from the 80's when Hitachi enhanced the Z80 as a microcontroller (but no internal memory). It's a shrink DIP so it's not as big as the old 68000 or TMS9900 chips.

    IIRC the pin spacing was 2mm and it was the standard 0.6" width. Very close to the same size as the 40 pin dips. I think I may even have one or two packed away somewhere.
  • cavelambcavelamb Posts: 720
    edited 2015-05-08 05:07
    Another thread to peruse...
    http://forums.parallax.com/archive/index.php/t-148944.html

    and, the ultimate Z80-Propeller project...

    http://searle.hostei.com/grant/cpm/
  • Heater.Heater. Posts: 21,230
    edited 2015-05-08 06:11
    Seems over complicated. Just use CP/M in a match box: http://hackaday.com/2009/12/27/zilog-in-a-matchbox/
Sign In or Register to comment.