Electronics > Beginners
Best way to drive a 5V TTL line with a 3v3 GPIO?
<< < (5/6) > >>
nick_d:
Yes, you can use the remaining 74LVC4245 pins for this, provided they're going in the right direction -- if you have spares in the 3.3V->5V direction, then absolutely you can use them to drive the /RESET and other pins.

However, I checked the datasheet for the device you specified, and there is a significant simplification that has been missed so far, see here:
https://au.mouser.com/Search/Refine.aspx?Keyword=Z84C0008&FS=True&Tb=datasheets
This device has HCT inputs, see page 34 "DC CHARACTERISTICS (Z84C00/CMOS Z80 CPU)", a low level input is up to 0.8V and a high level input is 2.0V or more. The reason why the device has HCT inputs is because it's designed as an almost drop-in replacement for the earlier NMOS Z80.

So the buffering in the 3.3V -> 5V direction is completely unnecessary, provided you're willing to live with a small extra current draw as has been discussed for the 74HCT00. Although I didn't dig deeply for any delta Icc, you can take it that all characteristics will be similar to an HCT gate.

You're right, there's no pull-up resistor on /RESET, I thought you were saying there was one, I hadn't checked this. And the /RESET is not Schmitt. As far as I can see it also doesn't require open-collector drive. So, direct drive all 5V inputs from 3.3V outputs, including /RESET. This eliminates the transceiver in the 3.3V->5V direction. Although this may seem offensive, and will cost a slight power draw, it is MUCH simpler.

Now as to the 5V->3.3V conversion. One simple approach is a 1k resistor, but I do not really recommend that. Like I said earlier, it will make it difficult to power off the 3.3V device since you'll have potentially quite a lot of 1k resistors trying to power it up through the protection diodes of its inputs. The ideal way is with an octal buffer powered from 3.3V, which has 5V-tolerant inputs. What you want is a 74AHC541. See here:
https://assets.nexperia.com/documents/data-sheet/74AHC_AHCT541.pdf
Referring to page 5, it says that Vcc can be up to 5.5V, Vi can be up to 5.5V (indepently of Vcc) and Vo can be up to Vcc. Perfect!

This is a cool project, I am learning a lot from doing this research :) By the way, I am a Z80 guy, I have plenty of vintage Z80 chips and Z80 peripherals that I bought from Ebay to tinker with. I haven't done much with them but I did a lot with Z180s commercially. Recently I bought some 3.3V Z8L180s that will go up to 20 MHz (if I recall correctly), and I was thinking of making a 3.3V Z180 system driving a graphic LCD.

Credit to whoever wrote this page: http://forum.fritzing.org/t/74x541-octal-tristate-buffer-level-translator/5141

cheers, Nick
Cervisia:

--- Quote from: nockieboy on December 18, 2018, 09:07:43 am ---I'm not sure I can read the implications as well as Nick has done?
--- End quote ---

We were talking about theoretical limits. In practice, HCT will work fine (because it was designed for such voltage levels).

When you're driving an HCT input directly with 3.3 V, the current will be approximately zero. Even if you get a chip with marginal parameters and run it at extreme temperatures, the current will be harmless, and probably not noticeable when measuring the entire circuit.
nockieboy:

--- Quote from: nick_d on December 18, 2018, 10:05:47 am ---As far as I can see it also doesn't require open-collector drive. So, direct drive all 5V inputs from 3.3V outputs, including /RESET. This eliminates the transceiver in the 3.3V->5V direction. Although this may seem offensive, and will cost a slight power draw, it is MUCH simpler.

--- End quote ---

More than happy to live with the extra current draw - the device is powered from USB or external power supply, so I don't have to worry about maximising the life of a battery supply (just yet).

The only thing I can see being a possible sticking point is that the ESP32 can also be used to provide the system clock to the Z80 and its peripherals.  It uses two PWM GPIOs, one for the main system clock (which can be varied under software control) and the other for specific peripherals.  I have a hard time deciphering some of the technical speak and charts in datasheets, but I'm guessing that the ESP32 won't be able to produce a suitable clock signal at 3.3v for the Z80?  This will still need to go through some form of level translator? 

I guess I could use a TXB0104 just for the clock outputs, as I'm using one of those for the SPI signal, but that leads me on to another thought - if the ESP32 can drive the Z80 at 3.3v acceptably, do I need to bother with voltage translations for the two I/O extenders? I've got two MCP23S17s, powered at 5V as they interface directly with the data, control and address buses of the Z80, so they will be expecting 5V SPI signals...


--- Quote from: nick_d on December 18, 2018, 10:05:47 am ---Now as to the 5V->3.3V conversion. [...] The ideal way is with an octal buffer powered from 3.3V, which has 5V-tolerant inputs. What you want is a 74AHC541. See here:
https://assets.nexperia.com/documents/data-sheet/74AHC_AHCT541.pdf
Referring to page 5, it says that Vcc can be up to 5.5V, Vi can be up to 5.5V (indepently of Vcc) and Vo can be up to Vcc. Perfect!
--- End quote ---

Okay, cool. Does it have to be AHCT though?  Would HCT suffice as I might actually have one or two HCT541's in my box of tricks?  The Z80 is held WAITing while the ESP32 does its stuff, so what's a few nanoseconds between friends?


--- Quote from: nick_d on December 18, 2018, 10:05:47 am ---This is a cool project, I am learning a lot from doing this research :)
--- End quote ---

Haha, thanks! I've been working on the whole thing for about two years now, on and off.  I'd get a website/blog set up if I thought anyone would be interested, detailing my journey from complete and utter electronics luddite with a burning interest in 80's computers (when I started with my first computer) to where I am now (an electronics idiot), but everyone else seems to have beaten me to it.  Just about everything I now know about electronics and 8-bit computer design is thanks primarily to this forum and some fantastically helpful people here (and Grant Searle's website, which kicked the whole thing off for me).

Currently I have a working Z80-based computer that has a custom-written monitor ROM (learning Z80 assembly 30-40 years late, but it's fun!), runs CP/M 2.2 and 3.0 from CompactFlash, takes up to 4MB of memory, plays authentic 80's chiptunes via the AY-8910 PSG and with plans to IoT-enable it (with a web-based console) via the ESP32 and eventually develop a graphics card for it so I can run it as a completely standalone system.

Have a look here:

https://youtu.be/YjoUeCCG7Pc 

It's a small video I did back in the summer on a 3D model of the computer and simulation I put together to test it all out.  Currently I only have the CPU, memory and serial cards in proper PCB form, the CF card is interfaced via a breadboard and the rest doesn't exist yet (though it did originally, all on one beast of a breadboard, but it was so unreliable I had to move to PCB-production as the prototype died one day and refused to work again!)


--- Quote from: nick_d on December 18, 2018, 10:05:47 am ---By the way, I am a Z80 guy, I have plenty of vintage Z80 chips and Z80 peripherals that I bought from Ebay to tinker with. I haven't done much with them but I did a lot with Z180s commercially. Recently I bought some 3.3V Z8L180s that will go up to 20 MHz (if I recall correctly), and I was thinking of making a 3.3V Z180 system driving a graphic LCD.
--- End quote ---

Well, maybe this will motivate you again?  ;D
Cervisia:

--- Quote from: nockieboy on December 18, 2018, 11:15:10 am ---Does it have to be AHCT though?  Would HCT suffice as I might actually have one or two HCT541's in my box of tricks?
--- End quote ---

This works only if the device has overvoltage-tolerant inputs (see page 18 of NXP's Logic Selection Guide: https://www.digikey.com/Site/Global/Layouts/DownloadPdf.ashx?pdfUrl=755DA3330E4E422EAEF6B9FF5092A9CB).
Only AHCT has them.
With HCT, you would need to add a current-limiting resistor (see the bottom of page 23), which would prevent you from using fast signals.
nockieboy:

--- Quote from: Cervisia on December 18, 2018, 12:56:39 pm ---
--- Quote from: nockieboy on December 18, 2018, 11:15:10 am ---Does it have to be AHCT though?  Would HCT suffice as I might actually have one or two HCT541's in my box of tricks?
--- End quote ---

This works only if the device has overvoltage-tolerant inputs (see page 18 of NXP's Logic Selection Guide: https://www.digikey.com/Site/Global/Layouts/DownloadPdf.ashx?pdfUrl=755DA3330E4E422EAEF6B9FF5092A9CB).
Only AHCT has them.
With HCT, you would need to add a current-limiting resistor (see the bottom of page 23), which would prevent you from using fast signals.

--- End quote ---

Ah, thanks for that Cervisia - was hoping I could use existing parts but AHCT541's don't seem too expensive, will add them to my BoM.  :-+
Navigation
Message Index
Next page
Previous page
There was an error while thanking
Thanking...

Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod