Shop OBEX P1 Docs P2 Docs Learn Events
Having trouble with 5v to 3.3v conversion — Parallax Forums

Having trouble with 5v to 3.3v conversion

Sorry, it's been a while since I've been around. Long story short, I've been designing a SBC based around the 65C02. Originally it was going to be the Z80 but I decided to switch back to what I know best...the 65C02. The design is almost complete minus the Propeller.

Second, I'm sorry for bringing this topic up yet again. I know it's been asked ad nauseam. Also, my apologies on the long post!

But the reason I ask yet again is that I actually HAVE read most if not all of the previous posts on this subject but there are so many conflicting opinions. Even on non-Parallax forums I've read different ideas.

Anyway, here is my basic design....my SBC will use the Propeller for CPU clock, VGA and PS/2 keyboard. The CPU will access the Propeller like any other I/O device.
The basic mapping will be:
CPU Data Bus    <<-->>    Propeller (BI-Directional)
CPU Clock       <<----    Propeller (Single Direction)
CPU RDY         <<----    Propeller (Single Direction)
CPU /NMI        <<----    Propeller (Single Direction)
CPU R/W         ---->>    Propeller (Single Direction)
... (other pins omitted)

Only the Data Bus will be bi-directional.

Now, here is what I understand to be true. Since I am using a CMOS part (65C02) that is running at 5V, it can differentiate a HIGH signal at the Propeller's 3V3 levels. So a logic HIGH on the Propeller is enough to trigger a logic HIGH on the CPU. For these connections, I can go directly to the CPU with nothing in between.

For the CPU (or other 74 logic device) pins where the pin is outputting a 5V logic HIGH and the Propeller expects an input, I need to current limit that voltage. In this scenario, I've read that a simple resistor is all I need. But the values vary wildly. Everything from 2.9K to 1M.

For the bi-directional, I've read to just use a level shifter.

So, having said all of that, I can summarize with the following information and questions.

• My maximum speed of my SBC will be 1-4MHz. The Propeller will inject wait-states from time to time when needed.
• Since the Propeller will be CLOCKING the CPU, I don't imagine it would ever be powered off while the CPU is running.


1) For the CPU to Propeller, can I just use a resistor in series and call it good? What value of resistor could handle up to 4MHz?

2) For the Propeller to CPU, the CPU pins are input only and as long as I remember to set the Propeller as OUTPUT, I should be safe with a direct connection. No?

3) Bi-directional pins...level converter IC (which one?), a resistor ladder of sorts, a 2N3904?

Thanks again for any help you can provide!

Comments

  • kwinnkwinn Posts: 8,697
    CPU Data Bus <<-->> Propeller (BI-Directional)
    For this I would suggest a bi-directional level converter. Using only a 10K resistor would protect the propeller pins from the 5V output of the 65C02, but I am not sure the propeller outputs would be able to drive the 65C02 inputs reliably. You could always put the pads for the level shifter on the board and try it with 10K resistors first.

    CPU Clock <<---- Propeller (Single Direction)
    CPU RDY <<---- Propeller (Single Direction)
    CPU /NMI <<---- Propeller (Single Direction)
    Use a 220 to 470 ohm resistor to protect the propeller pins in case of a short or wiring error.

    CPU R/W ---->> Propeller (Single Direction)
    Use a 10K resistor.
  • kwinnkwinn Posts: 8,697
    BTW, have you checked the data sheet for the 65C02 to see if it would run on 3.3V? That would make level translators unnecessary, although I would still suggest 220-470 ohm resistors to protect pins from potential shorts.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    Supply voltage specified at 1.71 V to 5.25 V
  • Yes, I should have mentioned that.

    I know the 65C02 can run at 3.3V but because I am using some legacy chips, and I want a certain speed for my SRAM, I have to run at 5V.

    Thanks
  • kwinnkwinn Posts: 8,697
    edited 2017-01-28 04:30
    cbmeeks wrote: »
    Yes, I should have mentioned that.

    I know the 65C02 can run at 3.3V but because I am using some legacy chips, and I want a certain speed for my SRAM, I have to run at 5V.

    Thanks

    If you posted a block diagram with the legacy chips included you may get some more targeted help. With what is posted so far we can only offer general advice.

    Edit: Have you looked at some of the other 6502/Propeller projects out there?
  • AribaAriba Posts: 2,690
    A resistor works also bidirectional, so why is a Transistor or IC needed?

    For 4 MHz frequencies you should use low resistor values. To not stress the protection diodes you can just add a second resistor to build a voltage divider.

    The following circuit can be used for the Data-Bus and the R/W signal, if the 65C02 reliable sees a high with 3.3V at the input:


    Andy
    376 x 166 - 3K
  • cbmeekscbmeeks Posts: 634
    edited 2017-01-30 15:55
    @Ariba

    Maybe I'm misunderstanding, but, how would that work for bi-directional?

    Please correct my math, but here is what I understand:

    For 65C02 ---> Propeller:
    Vout = (2.2 / (1.2 + 2.2)) * 5 = 3.235
    

    3.24 volts to the Propeller is more than high enough to register a HIGH.

    But, going the other way, would it not calculate:
    Vout = (2.2 / (1.2 + 2.2)) * 3.3 = 2.1351
    

    I don't think 2.14 volts is high enough for the 65C02 to register a high. From what I see in the datasheet, the Vih is set at VDD * 0.7 = 3.5V worse case.

    I'm going to play around with different resistor values. But for 65C02 to Propeller, I really like the idea of the voltage divider.

    Thanks
  • Heater.Heater. Posts: 21,230
    edited 2017-01-30 16:32
    If the Propeller output had zero output impedance then the voltage across the 2.2K resistor would be the 3.3 volts of the Propeller pin.

    Assuming the input impedance of the 6502 is high then no voltage is dropped across the 1.2k. As there will be no current flowing though it. So the 6502 sees 3.3v.

    Of course the output impedance of the Prop is not zero and the input impedance of the 6502 is not infinite. But close enough not to worry practically. Given the resistor values chosen.

  • AribaAriba Posts: 2,690
    As Heater says: The 2.2k resistor is just a load for the Prop output, there is not voltage divider involved in the Prop -> 65C02 direction.
    The output impedance of a Prop pin is about 30 Ohm, so the 65C02 sees ~3.25 V. If the 65C02 does not have Schmitttrigger inputs then the threshold is normally at 1/2 Vcc for CMOS = ~2.5V.

    If you want observe the worstcase of 0.3*Vcc for Low and 0.7*Vcc for High then you can add an additional 4.7k resistor from 65C02 pin to 5V for the Databus.

    Andy
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2017-01-31 04:59
    Ariba wrote: »
    As Heater says: The 2.2k resistor is just a load for the Prop output, there is not voltage divider involved in the Prop -> 65C02 direction.
    The output impedance of a Prop pin is about 30 Ohm, so the 65C02 sees ~3.25 V. If the 65C02 does not have Schmitttrigger inputs then the threshold is normally at 1/2 Vcc for CMOS = ~2.5V.

    If you want observe the worstcase of 0.3*Vcc for Low and 0.7*Vcc for High then you can add an additional 4.7k resistor from 65C02 pin to 5V for the Databus.

    Andy

    Standard CMOS Vih(min) is 0.7xVdd, not 0.5 as the Prop is not standard. So you would really need 3.5V or more but sometimes what I've done is dropped the 5V supply to 4.75 or boosted the 3.3V supply to 3.6V. If you do both then you have plenty of margin with the simple resistor divider.

    The pinout is
    CPU Data Bus    <<-->>    Propeller (BI-Directional)
    CPU Clock       <<----    Propeller (Single Direction)
    CPU RDY         <<----    Propeller (Single Direction)
    CPU /NMI        <<----    Propeller (Single Direction)
    CPU R/W         ---->>    Propeller (Single Direction)
    
    I would just use 74HCTxx logic for 3.3V to 5V to the CPU, a simple current limit resistor (no divider) for the R/W, and 74HCT245 for the data bus with current limit resistors on the Prop side. Once again, no dividers necessary. 74HCT Vih is TTL compatible at 2V or more.
Sign In or Register to comment.