A question about logic level shifting, 74LVC74, and 74HC(T) vs 74AHC(T) - Page 1
Forum section: electronics / projects

author: MartyMacGyver
author_rank: Regular Contributor
timestamp: March 12, 2015, 04:35:23 pm
content: When connecting various 3.3V things (e.g., RPi, sensors) to and from various 5V things (e.g., Arduino, sensors), the following seems to be reasonable from what I've read:5V logic -> 3.3V logic, use 74LVC245 (this seems to be the most widely used way)3.3V logic -> 5V logic, use 74(A)HC(T)245. This is where I'm stumped. To TTL or not to TTL? What about AHC(T) vs HC(T)... any practical difference? I'm ordering parts and I have a choice of any of these (in DIP form), and the prices are the same or less for the A-type chips... was thinking of stocking up on a few each of the 74AHC245 and 74AHCT245 chips but if HC(T) is somehow better I would like to know because at some point it'll matter.Bonus: is the 74AHCT125 just effectively a 74AHCT245 with only half the lines? The titles of the data sheets are throwing me off.Note: Have tried TXB0108 devices for things. Not terribly effective and they are extra sensitive to... everything. Open the fridge? It acts up. Earth rotates on its axis? Don't expect it to work right.

author: wraper
author_rank: Unknown
timestamp: March 12, 2015, 04:53:35 pm
content: Quote from: MartyMacGyver on March 12, 2015, 04:35:23 pmYou shouldn't use AHC and HC for 3.3V input while IC is powered from 5V, they are wrong part for that. Only AHCT and HCT, there is no difference unless you care about speed, AHC(T) is significantly faster. Faster is not necessarily better as noise immunity against fast transients is lower too. Also faster IC will create faster transients on power rail too.

author: cosmicray
author_rank: Frequent Contributor
timestamp: March 12, 2015, 05:01:13 pm
content: Pololu makes an interesting logic shifter board. It is based on an Infineon BSD840N (although they do not identify it as such) Dual N-channel MOSFET and a few resistors.The product description here will give you an idea of what it can dohttps://www.pololu.com/product/2595

author: MartyMacGyver
author_rank: Regular Contributor
timestamp: March 12, 2015, 05:51:20 pm
content: Quote from: wraper on March 12, 2015, 04:53:35 pmWhat if the 5V thing is not a TTL device though? (As I understand it the "T" devices don't drive CMOS loads as well.) As for AHC, I thought perhaps it's just an evolution of HC, but if there are drawbacks then I may forego the "A" parts. If I had to pick one '245 part that would cover the vast majority of situations, which would it be?Quote from: cosmicray on March 12, 2015, 05:01:13 pmThat looks similar to one I already have:https://www.adafruit.com/products/757It'd be nice if there was something like the TXB0108 but without the (problematic) direction auto-sensing feature (instead having a manual DIR option). Each side would have its own rail and that'd be that.

author: MartyMacGyver
author_rank: Regular Contributor
timestamp: March 12, 2015, 05:56:44 pm
content: I may be operating under one wrong assumption - that "T" - is it about the inputs or the outputs (or both?) I thought the "T" devices output to TTL more effectively...

author: MartyMacGyver
author_rank: Regular Contributor
timestamp: March 12, 2015, 06:06:02 pm
content: To add to the mix, I stumbled on an external thread on this topic that mentioned the ACT series... perhaps the 74ACT245 would be the best general solution for most common use cases (3.3V -> 5V)? (Edit: along with some 74HCT245's, just in case.... that said, is there any reason I'd both with non "T" versions for this?)

author: wraper
author_rank: Unknown
timestamp: March 12, 2015, 07:55:23 pm
content: Quote from: MartyMacGyver on March 12, 2015, 05:56:44 pmT is for TTL compatible inputs, outputs are the same. That means that they have lower input voltage threshold level. If you use HC or AHC part, they might not detect 3.3V logic 1 at all in worst case. Also as 3.3V (remember that actual voltage on the 3.3V logic IC output can be slightly lower) is on the threshold borderline, that makes noise immunity just awful as slightest spike can make a transition between 0 and 1.READ DATASHEETS, that will remove a lot of not so smart questions and is more accurate than asking some stranger.

author: wraper
author_rank: Unknown
timestamp: March 12, 2015, 08:02:08 pm
content: Quote from: MartyMacGyver on March 12, 2015, 06:06:02 pmACT are very fast series. Go with HCT unless you need very high frequency or can get them cheaper for some reason.

author: cosmicray
author_rank: Frequent Contributor
timestamp: March 12, 2015, 09:22:27 pm
content: Quote from: MartyMacGyver on March 12, 2015, 05:51:20 pmIt's basically the same circuit, other than Adafruit are using 4x discreet FETs and Pololu are using 2x FET array chips. Both designs reference the NXP app note (http://www.nxp.com/documents/application_note/AN10441.pdf) which may give you some hints. The adafruit board has a ground connection, while the pololu board omits it. Ground is only important in the context of the devices on both sides of the level shifter, not the shifter itself.The original NXP app note design was for an I2C level shifter, which by definition is bi-directional.What kind of speed are your sensors going to be clocking ?

author: MartyMacGyver
author_rank: Regular Contributor
timestamp: March 12, 2015, 10:04:18 pm
content: Quote from: wraper on March 12, 2015, 07:55:23 pmI did read the datasheets, but I clearly didn't read them well enough (I had found some caveats about using TTL with some things so I wasn't sure if I should reconsider it). I was looking for opinions as much as anything else (since preference plays a part).Quote from: cosmicray on March 12, 2015, 09:22:27 pmThe speeds could end up being in the MHz range for some things - I would rather buy with headroom to spare so it looks like the ACT might be worth getting after all. The chips are cheap enough and I'm only buying a few anyway (and I'm happy to spend a bit more to get something that will cause fewer overall headaches in projects), but I might get some AHCT as well for the toolkit.Edit: Actually, I'll focus on getting AHC(T) '245s... I will get a few AC(T) as well to try out, but their propensity for adding noise to the system is apparently worse than I thought. Not seeing any real reason to get non-"A" parts for this.One question though: when would I ever want to use the non-TTL ones? Just for buffering like-to-like voltage levels?

author: moffy
author_rank: Super Contributor
timestamp: March 12, 2015, 11:37:26 pm
content: Going from 3.3v -> 5v I would be tempted to use just a 74HC14, 74AHC14 etc as it will successfully trigger from a 3.3v CMOS digital signal.

author: wraper
author_rank: Unknown
timestamp: March 13, 2015, 12:25:54 am
content: Quote from: moffy on March 12, 2015, 11:37:26 pmYeah, successfully, most of the times... Decrease 3.3V by few hundreds mV and it will stop to work, especially at wider temperature range or if unlucky with particular IC exemplar. Why do you think xxT series were created? TTL actually puts out more voltage than 3.3V.For few MHz HC(T) series are fine. Most of the ACT series ICs work up to 100 MHz or even more.

author: kjs
author_rank: Regular Contributor
timestamp: March 13, 2015, 01:11:23 am
content: If you only need it for a single line the M74LVC1GT50 is the best choice in both directions. For 5V to 3.3V supply is 3.3V and in the other direction it's 5V. The MC74VHC50 is a good choice for up to 6 lines and used the same way. Always 7V tolerant at the inputs.Naturally there are also real level translators if you want to keep all the noise margins. One example is the TXB0108 for 8-bits which can shift in both directions and from-to all logic levels. If it acts up in your design something else is wrong. We use them on a regular basis and they work well. In a commercial design you most likely have to conserve the noise margins......you don't want to use the TTL ICs for anything which doesn't have the TTL levels. The noise margin is a LOT lower and the required drive currents higher.

author: wraper
author_rank: Unknown
timestamp: March 13, 2015, 02:04:57 am
content: Quote from: kjs on March 13, 2015, 01:11:23 amTTL ICs were not discussed here at all, therefore talking about drive currents is irrelevant to this situation.

author: wraper
author_rank: Unknown
timestamp: March 13, 2015, 02:13:54 am
content: Quote from: kjs on March 13, 2015, 01:11:23 amWrong part number. LVC series will work fine for 5V->3.3V but I don't see how this would be proper choice for 3.3V->5V as they will have too high input voltage threshold for 3.3V if powered from 5V. For example, datasheet for 74LVC1G125. If powered from 5V, high input voltage level must be no less than 0.7 Vcc = 0.7 * 5 = 3.5V what obviously is more than 3.3V even if we don't consider any safe margin needed. Therefore stable operation cannot be guaranteed for 3.3V -> 5V operation.

author: langwadt
author_rank: Super Contributor
timestamp: March 13, 2015, 02:37:59 am
content: Quote from: wraper on March 13, 2015, 12:25:54 amyes the T signifies the lower 2.4V threshold so it will work reliably with 3.3V logic and 5V supplyjust be sure to check the data sheet, some T version can use several mA when the inputsare close to the thresholds

author: suicidaleggroll
author_rank: Super Contributor
timestamp: March 13, 2015, 02:52:45 am
content: I'm not sure I'm following the conversation correctly, but what is the issue here, exactly? Some people seem to be throwing out 5.0v-powered buffers as if they'll work in a 3.3v to 5.0v level translation application. Obviously that's going to be full of problems, buffers aren't intended for level translation, and trying to force them into that role is going to be pushing VIH/VOL thresholds to their limits. Why wouldn't you just use a dedicated level translation IC, eg: SN74LVC1T45? Feed 3.3v in on one side, 5.0v on the other side, drive the direction pin, and you're done. Is there something I'm missing here?

author: MartyMacGyver
author_rank: Regular Contributor
timestamp: March 13, 2015, 05:46:55 am
content: Quote from: suicidaleggroll on March 13, 2015, 02:52:45 amThat's good to know, and will be handy if I should do a more complicated SMT project, versus a DIP-and-breadboard thing (the data rates I'll be dealing with aren't nearly as high as what the 'T45 is targeted for).

author: MartyMacGyver
author_rank: Regular Contributor
timestamp: March 13, 2015, 05:54:51 am
content: Quote from: kjs on March 13, 2015, 01:11:23 amFor whatever reason the '0108 is quite tricky to work with, and I'm not the only person saying that out there. I'm not suffering for a lack of them either... and at some point I'd like to understand why they didn't work as expected for me.

author: MyElectronsFellOut
author_rank: Regular Contributor
timestamp: March 13, 2015, 08:46:15 am
content: Having used logic shifters recently, I can atest to the GTL2000 series chips doing the job just dandily. Does everything you need for translation of 3.3 - 5V and back as well as lower voltages. I've used them with 16MHz micros for data ouput to LCD and bidirectionally to an SD card, and they seem to have good noise immunity.datashet -->http://www.nxp.com/documents/data_sheet/GTL2002.pdf

author: MartyMacGyver
author_rank: Regular Contributor
timestamp: March 13, 2015, 09:14:29 am
content: Quote from: MyElectronsFellOut on March 13, 2015, 08:46:15 amI'll keep this in mind as well, for whenever I decide to make SMT breakout boards with such devices. Right now I'm focused on DIP solutions for the sake of breadboarding.

author: Siwastaja
author_rank: Super Contributor
timestamp: March 13, 2015, 09:19:18 am
content: I have connected 3V3 outputs directly to 5V CMOS inputs when I'm feeling super cheap - no translation at all. The '1' level is pretty close to the threshold value (typically about 3.0V) so it's on the brink of failing all the time. A CMOS buffer won't do anything differently than the CMOS inputs of the actual chip, so I miss the point of adding one. A TTL compatible (HCT) buffer will of course lower the threshold (to about 2.4V) so there will be more margin for error.Don't use bidirectional level translator chips that internally decide the direction, without a direction pin.

author: plazma
author_rank: Frequent Contributor
timestamp: March 13, 2015, 09:50:11 am
content: Quote from: MartyMacGyver on March 13, 2015, 05:54:51 amI use TI TXS and TXB level shifters in many designs. They work as designed. TXS for open collertor/drain and TXB for push/pull lines. Check the data sheet for internal schematic. There are pull up and series resistors which may cause issues.

author: kjs
author_rank: Regular Contributor
timestamp: March 13, 2015, 07:25:03 pm
content: Quote from: wraper on March 13, 2015, 02:13:54 amTo discuss datasheet values you better use the datasheet of the mentioned device and not some generic other one from a different part even if it's from the same family. The 1GT50 has completely different input logic levels and was specifically designed for exactly that job. At 5.5V supply the worst case high level is 2V and that IS a safe margin..... The LVC125 datasheet is completely irrelevant.http://www.onsemi.com/pub/Collateral/MC74VHC1GT50-D.PDFpage 3....Quote from: plazma on March 13, 2015, 09:50:11 amSame here but they are a bit critical with the supply bypass capacitors too. The "typical layout" with a 0.1mm ground and supply line circling 3 times around the part before it's connected won't do the job. We have them on ground planes with 1uF/10V X5R caps (Taiyo Yuden or Murata) and never had any issue.

author: Zero999
author_rank: Super Contributor
timestamp: March 13, 2015, 07:55:03 pm
content: Quote from: kjs on March 13, 2015, 07:25:03 pmTo be fair, you made a typographical error in your previous post. You referred to the M74LVC1GT50, which doesn't exist, so he had to guess what you meant.

author: wraper
author_rank: Unknown
timestamp: March 13, 2015, 08:22:05 pm
content: Quote from: kjs on March 13, 2015, 07:25:03 pmLOL, How should I use datasheet of mentioned device if you gave non existing model? , even series are not right, LVC vs VHC. M74LVC1GT50 (non existing) and MC74VHC1GT50 (in the datasheet provided by you) is not the sameTalking about particularly MC74VHC1GT50, input voltage thresholds are comparable (a bit lower) to HCT series at 5V, therefore good for 3.3V->5V. However they are significantly lower at 3.3V Vcc, 0.5Vcc * 3.3V = 1.65V max. Therefore they are not good at all for 5V->3.3V level shifting if you do care about noise immunity a tiny bit.Edit:BTW these are family related input thresholds indeed, not particular part 1GT50 part. Here you go: MC74VHC125http://www.onsemi.com/pub_link/Collateral/MC74VHC125-D.PDFor MC74VHC74http://www.onsemi.com/pub_link/Collateral/MC74VHC74-D.PDF

author: kjs
author_rank: Regular Contributor
timestamp: March 13, 2015, 08:32:46 pm
content: yikes, I just recognized that I gave the wrong link. Looks like the 74LVC1GT50 is no longer available but the 74VHC1GT50 looks like it has the exact same specs (just compared with the old datasheet)..

author: wraper
author_rank: Unknown
timestamp: March 13, 2015, 08:39:04 pm
content: Quote from: kjs on March 13, 2015, 08:32:46 pmThen why you mention it at all if it is not sold anywhere? BTW even google don't know about such part existing. IMO you do have part number inputted wrong the database:https://www.google.lv/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=M74LVC1GT50

author: kjs
author_rank: Regular Contributor
timestamp: March 13, 2015, 08:51:25 pm
content: our database really needed a brush up.... They still had it under the pre-historic name. Sorry for that.Just as a side note: the part TI cross references it to, SN74AUP1T50, only works for supplies lower than 5V (max 4.6V rating) and is not suited as a 3.3V to 5V shifter.Funny thing is the m74vhc1gt50 name still exists.

author: moffy
author_rank: Super Contributor
timestamp: March 15, 2015, 11:40:59 pm
content: Quote from: wraper on March 13, 2015, 12:25:54 amMust agree, I hadn't noticed before how high the threshold could go on the "HC" parts: 3.15v max, ouch.The 2.1v max of the "HCT" makes much more sense.