DIP version of voltage level converter SN74LVC1T45 ? - Page 1
Forum section: electronics / projects

author: FrankBuss
author_rank: Unknown
timestamp: April 10, 2019, 09:33:04 pm
content: I'm searching a DIP part which does the same as theSN74LVC1T45. I need to do voltage level translation between 3.3 V and 5 V and the other direction. For 5 V to 3.3 V I tried to use a resistor divider with 3.3 k and 2.2 k, but the edges look terrible at 8 MHz, and it should work up to 20 MHz. For the other direction I triedthiscircuit, but it was not that fast, too, because of the high pullups.Is there a solution with only DIP parts for both translations? The direction is fixed for each translation, but I need a solution for each direction. I'm planning to interface an Atmega328 with a SPI flash or FRAM chip, and my client wants to release it as a DIY kit with through hole parts, only.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: April 10, 2019, 10:06:33 pm
content: Use lower value resistors, and use 74HCT family receivers to go the other way.Or just use 3.3V to begin with. Almost everything available today supports it!74LVC is basically useless in DIP. If you can only find SOICs of them, and nothing else with the same function, consider learning SMT. SOIC is only half pitch, it's quite easy to deal with.Tim

author: FrankBuss
author_rank: Unknown
timestamp: April 10, 2019, 10:26:06 pm
content: The Atmega328 needs to run at 20 MHz, which is not supported at 3.3 V. I would use all SMD parts, but my client insists on having it all in through hole.Maybe I could use lower resistors, but maximum output current is 40 mA per pin, but this is the absolute maximum rating, and output voltage drops already to like 4.5 V at 15 mA, and the supply voltage could be a bit lower than 5 V as well (USB power supply powered). Maybe it would work, but this is how it looked at 8 MHz (yellow trace) :And I want to use the SPI bus at 20 MHz, so I don't think the resistor divider would be a good solution.I don't mind using some discrete external parts like MOSFETs or transistors, but I'm not an analog expert, I have no idea how this would look like for this high speed.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: April 10, 2019, 10:36:01 pm
content: Well, not guaranteed at 3.3V. If you don't need 100% yield, you can consider overclocking it.Sounds like you've worked yourself into a bit of a corner. Have you considered a different clock frequency? Faster MCU (XMEGA say)? Why does it have to be AVR at all, if you need hard real-time performance? Why not an ARM at 80MHz+? (They're far more powerful, and just as cheap. Internal USB support is common, too.)Tim

author: oPossum
author_rank: Super Contributor
timestamp: April 10, 2019, 10:37:13 pm
content: 74HCT for 3.3 to 5 volt.74AHC for 5 to 3.3 volt74xx244, 74xx125, etc...

author: FrankBuss
author_rank: Unknown
timestamp: April 10, 2019, 11:16:03 pm
content: Quote from: oPossum on April 10, 2019, 10:37:13 pmThanks, this looks perfect, I will try it. So 5 V to 3.3 V:74AHC125, powered with 3.3 V. The datasheet says it can handle up to 7 V at the inputs. And for 3.3 V to 5 V:74HCT125, powered with 5 V. High input level voltage is 2 V min. But the 74HCT125 is a bit slow.

author: jaycee
author_rank: Regular Contributor
timestamp: April 10, 2019, 11:43:41 pm
content: He's being quite unreasonable to expect everything TH these days. SOIC is plenty solderable by the average hobbyist, and they better get used to it as non-SMD stuff is going away very quickly.

author: FrankBuss
author_rank: Unknown
timestamp: April 10, 2019, 11:56:50 pm
content: Ok, found a better chip for the 3.3 V to 5 V conversion:http://www.ti.com/lit/ds/symlink/sn74ahct125.pdfOnly 10 ns propagation delay with 50 pF load. This should be fine for 20 MHz.And right, for me SMD is even easier to solder, but some people still think it is difficult

author: jaycee
author_rank: Regular Contributor
timestamp: April 11, 2019, 12:01:40 am
content: the best part about SMD is you dont need to drill so many bloody holes!

author: OM222O
author_rank: Frequent Contributor
timestamp: April 11, 2019, 12:03:26 am
content: you are over complicating this way too much!just use a hex inverter and connect each 2 inverters back to back to from a basic buffer. if you power the inverter from 3.3V you can get 5v downto 3.3V conversion and if you power it from 5 volts, you get 3.3v to 5v conversion. it is extremely cheap and should be able to support speeds you want. also because they are logic chips, your edges will be clean as!if you need more than 3 channels, just use more chips, they are dip 14 packages anyways.just connect 1Y to 6A, 2Y to 5A and 3Y to 4A. then your inputs will be 1A, 2A and 3A, your outputs will be 6Y,5Y and 4Y. you can't get any better than this!

author: FrankBuss
author_rank: Unknown
timestamp: April 11, 2019, 12:11:00 am
content: Quote from: OM222O on April 11, 2019, 12:03:26 amI don't think this would work reliable. Not all chips tolerate 5 V if powered from 3.3 V and not all chips powered from 5 V have as low as 2 V min high level voltage. And some inverters can be quite slow, like a 74LS14 can be max 22 ns, so this would be 44 ns for two inverters. Too slow for 20 MHz, because first the clock gets translated, and then the output of the flash chip gets translated back again, which then would be too much phase shifted to the original clock for a reliable SPI detection.But I think the 2 chips I selected with the hints from oPossum should work.

author: OM222O
author_rank: Frequent Contributor
timestamp: April 11, 2019, 12:16:39 am
content: http://www.ti.com/lit/ds/symlink/sn74hc04.pdflook at that part. I have tried it with many projects, especially in SPI up conversion (3.3 to 5), but in practice, if you want down conversion, you should use some resistors (1k is more than enough) to limit the current and the internal zener clamps would take care of the rest.if you are paranoid, you can use 10k resistors as well.those chips will work but they are not easy to find pin compatible replacements for, and probably cost more (it matters a lot in volume). trust me, this is as solid of an option as you can get. it has worked amazingly well over the past years and is a common solution.edit: the switching frequency changes depending on the VCC, but it should still be fine at 20MHz (2 propagation delays is about 40ns max).

author: FrankBuss
author_rank: Unknown
timestamp: April 11, 2019, 12:25:59 am
content: If I use a 10 k series resistor, then it could be too slow. And on the 3.3 V power supply is only the flash at the moment, so if I use a 1 k resistor, the supply voltage could rise, especially when the flash is in sleep mode. And the datasheet of your 74HC04 says when powered at 2 V, the propagation delay can be up to 95 ns, so at 3.3 V it would be between 95 ns and the 19 ns for 4.5 V. It is an inverter, and for SPI it would be 3x delay (clock in one direction, with two gates, MISO in the other direction, I can invert it in software, so 1 gate). I really don't think this would work reliable with 20 MHz.

author: OM222O
author_rank: Frequent Contributor
timestamp: April 11, 2019, 12:34:38 am
content: 5v/1k = 5mA and the maximum rating is about 20mA or so. again, 10k is if you are paranoid and it won't slow down anything (the input capacitance is too small at these values)also looking at figure 2:at 3.3V propagation delays are just slightly over 20ns. if you are seriously concerned that much about speed, spi has 4 modes. you can simply change your input / output mode to match one inversion at either end (any modern MCU has all 4 options). but I would suggest you do actual testing as it's almost guaranteed even 2 propagation delays are fine in your case.in terms of your 3v regulations, I'm not sure what you are using that will be so poorly regulated that some switching can cause spikes ... even then, that's exactly what decoupling capacitors are used for?In case there is a misunderstanding, I meant 1k resistor on the inputs, not the supply rail itself!Edit: these 3 channels work in parallel and propagation delays are the same regardless of the input singal, so clock is inverted with the same delay as data line (within the specified tolerances that is) so there is not much phase shift, if any! I'm not sure why you would use 2 gates for clock and one for MISO/MOSI? that is actually a use case which can cause issues. just use the same number of gates for all signals.

author: oPossum
author_rank: Super Contributor
timestamp: April 11, 2019, 12:51:02 am
content: Quote from: OM222O on April 11, 2019, 12:16:39 amYes. Look at the specs carefully. The logic high is out of spec when 3.3V logic is used with Vcc of 5.0V.QuoteMakes the square wave un-square and that is un-good.QuoteThere is a difference between something that 'works' and something that is well designed.

author: FrankBuss
author_rank: Unknown
timestamp: April 11, 2019, 12:55:13 am
content: Quote from: OM222O on April 11, 2019, 12:34:38 amAll linear regulators I know do only regulate the voltage down, like a variable series resistor. The resistance can't get negative, so if you add some voltage on the 3.3V side, the voltage at the decoupling capacitor would rise through the zener clamp diode of the flash, the faster the lower the capacitor. It might not destroy the flash or FRAM with a 1k resistor with only 5 mA, but nevertheless it would be out of spec.Quote from: OM222O on April 11, 2019, 12:34:38 amI need to invert clock twice, because regardless of the SPI mode, it is sampled and changed at the same edge at the sender and receiver. E.g. if I use SPI mode 0, the data is changed at rising edge, both MISO and MOSI, and it is sampled at falling edge. If I would invert the clock only once, it wouldn't work, unless you rely on a minimum gate propagation delay, but this would be a bad design. But for MISO and MOSI you would need just one gate, because this is easy to change in software in the transfer function.

author: OM222O
author_rank: Frequent Contributor
timestamp: April 11, 2019, 01:18:40 am
content: well it seems everyone hates this solution, but I emphasize again: it has worked without any issues in dozens of designs. even if you look at the functional diagram of voltage converter ICs, many of them use this exact same thing, just embedded as one chip on the silicon. for example:http://www.ti.com/lit/ds/symlink/cd4504b.pdfIt is by no means poorly designed, too slow or bad on supply regulations. I will not fight anymore, but I highly recommend you try it with 1k resistors on the inputs for current limiting. you will be surprised as to how well it works. I don't have access to my uni lab right now, but in our design projects this has been used for the past 3 years or so in most of our projects without a single hiccupedit: I'm not sure the input resistance on the inputs (didn't look carefully enough) but you might not even need the 1k resistors if they are already included on the inverter chips (which they most definetly are, because you can connect them back to back without an issue, 5v vs 3.3 is also not big enough to exceed 20mA per pin!)

author: FrankBuss
author_rank: Unknown
timestamp: April 11, 2019, 01:52:33 am
content: Well, it looks like it is working, but the datasheet doesn't allow higher voltages at the input, and unless you have a written note from the manufacturer that you can do this, I wouldn't do it. And did you test it with 20 MHz, or at 85°C? I think it would be too slow. And as oPossum wrote, the series resistor smooths the edges of the input signal, which introduces additional delays and possible problems.These flash chips can be really picky. I did a test with one:https://hackaday.io/page/6060-spi-flash-testand just using a resistor divider for the 5 V to 3.3 V translation didn't work, even with a slow 1 MHz clock, because the flash chip expected a faster rising and falling time on the clock line, otherwise it didn't work reliable. I guess the reason is because it can run with up to 104 MHz according to the datasheet, and looks like it doesn't have a schmitt trigger input, so this might result in bad behavior for slow edges.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: April 11, 2019, 02:02:36 am
content: You mean the series resistors? Nah, the level shifter circuit is full CMOS -- resistors would cost supply consumption, which would be specified.Relying on input protection diodes is a bad idea for three reasons:1. They're intended for transient use only. This isn't always relevant, but sometimes it is.2. The charge injection can disturb logic states, or affect propagation time, etc.3. The injected charge returns through the substrate and nearby ESD diodes, depending on which ones are active. This increases supply consumption considerably, and can interfere with signals on nearby pins.I've written a model for this before. It was the CD4001, including measured hFE of the "ESD diodes" that are actually BJTs. The input-to-VDD diodes actually shunt about half of the positive ESD current to ground (the current is cascoded through a PNP with low hFE). A small fraction (about 3%) leaks out adjacent input pins if applicable (ESD diodes are typically per-gate, so in a 4001, this causes leakage out the other input pin, but doesn't affect other gates; this is N/A for a buffer/inverter). The VSS-to-input diodes work the same way but have good hFE, so essentially all the negative ESD current is drawn from VDD.Anyway, this is easily avoided, by adding external schottky diodes (BAT54C seems a likely choice), or using a device with an input structure that tolerates higher voltages (like the CD4504 pictured).I don't think discrete logic has any problems with #1, so that should be safe. It is something to be aware of, in general. For instance, FPGAs can have these limitations. Many are made with input structures as small as possible -- to offer as much speed as possible, given the wide range of output types they need to be programmable for. Consequently, they can't handle much DC current. This is a reliability problem, driven by electromigration. Some specify transient voltage or current limits, others don't. (Offhand, Altera's Cyclone III was rated for VCC + 1V or VDD - 1V, for 2ns, or something like that, and 2mA DC.)Tim

author: OM222O
author_rank: Frequent Contributor
timestamp: April 11, 2019, 12:05:53 pm
content: external diodes will be costly. the point of this circuit is being dirt cheap and from jelly bean parts. Yes, you can absolutely design something over the top "which is better in x and y and z" but do you really need that for level conversion? if it works for your application, well then it does. if you go with that mindset, a simple ADC circuit cane either be made with current limiting resistors + some filters costing about 5$, or adding a bunch of protection and whatnot, making it cost 20$ ...As I mentioned you would probably be fine without any external resistors and you will not shorten the life of the chip. it's extremely unlikely that micro can even put out that much current at 5v to a logic chip. I have not tested at 85C or 20MHz ... the logic part of the circuit shouldn't get hot, so just test at ambient. as for the frequency, the data sheet suggest it should have no problem, but you can test with your oscilloscope and a signal gen (micro at the clock speed you want) just to be sure. in terms of reliability, I have had no issues with this design if you pick a fast enough chip, which you can choose different logic families for that. I think S series are more power hungry but are faster because they use schottkies. it only needs to be a hex inverter chip from the family you want.Edit: voltage on the inputs does not matter at all. there is no specification on it whatsoever. only maximum current rating which is +-20mA. keep that in mind.in terms of note from manufacturer look at page 9:if you just read the datasheets of the exact chip from the family you want, 99.9% of your questions are already mentioned there

author: TK
author_rank: Super Contributor
timestamp: April 11, 2019, 12:24:39 pm
content: Why not use ICs made specifically for digital level shifting like TXB0104 or a level shifting solution using FET transistors?

author: FrankBuss
author_rank: Unknown
timestamp: April 11, 2019, 12:30:41 pm
content: Quote from: OM222O on April 11, 2019, 12:05:53 pmThanks, looks like the 74HC04 can be used for the 5 V to 3.3 V conversion, if powered with 3.3 V. But I still think it would be too slow. And it won't work reliable for the other direction, because at 4.5 V the high level input voltage is min 3.15 V. This is a very low margin to the 3.3 V output of the flash. And for 6 V it is even 4.2 V, so for 5 V supply voltage it would be right on the edge of 3.3 V.My solution is to usehttp://www.ti.com/lit/ds/symlink/sn74ahc125.pdffor 5 V to 3.3 V, andhttp://www.ti.com/lit/ds/symlink/sn74ahct125.pdffor 3.3 V to 5 V. They don't break the bank either for less than $0.50, no need to design a $20 circuitI will buy some of these chips and will post some tests, and I will buy a 74HC04 as well to compare it.Quote from: TK on April 11, 2019, 12:24:39 pmThe requirement of my client is to use only DIP chips. I don't think that the TXB0104 is not available in DIP. If SMD would be allowed, I would use the SN74LVC1T45, which I already used in other circuits like myCrazy Cartridgeand it worked fine.A solution with FET transistor would be fine, too, if it works for 20 MHz. But I don't know how this looks like, because I don't know much about analog electronics. And I guess would need more parts than the solution with the 2 ICs I've selected and more expensive, if assembly costs per part are also counted.

author: Zero999
author_rank: Super Contributor
timestamp: April 11, 2019, 12:59:21 pm
content: Quote from: FrankBuss on April 11, 2019, 12:25:59 amHow about bypassing the resistor with a suitable capacitor to speed it up?If the capacitance of the input is known, then the capacitor can be chosen so it translates 5V to 3.3V at AC, with the resistor not contributing to the voltage conversion.

author: OM222O
author_rank: Frequent Contributor
timestamp: April 11, 2019, 04:05:05 pm
content: if you want purely speed, you can even use BJTs in DIP packages and make the gates using some external resistors. 2 BJTs would still be suitable for >1GHzyou just need to choose your values so you won't exceed their current / voltage limits which should be simple at logic levels of 5 or 3 voltssomething like below, and depending on whether you power it from 3.3 or 5 volts, it can do up / down conversion and again, it is fast enough for GHz range. calculating base resistor and emitter resistors should also be a trivial task.edit:sparkfun uses the exact same topology for their level shifter modules (although they use fets which makes it much slower than BJTs, but it's the same idea):https://www.sparkfun.com/products/12009searching for bjt level shifter you can find this:or a bidirectional one here:http://saeedsolutions.blogspot.com/2013/07/bidirectional-buffer-circuit-using.html

author: FrankBuss
author_rank: Unknown
timestamp: April 13, 2019, 01:40:53 pm
content: I got the ICs I selected, thanks to the initial suggestion from oPossum, and did some tests, and compared it with the 74HC04 as well:https://hackaday.io/page/6095-voltage-level-translatorsThe 74HC04 might work, but the other ICs are a little bit faster, and for the 3.3 V to 5 V translation, the 74AHCT125 works with lower input voltages, guaranteed by the datasheet, so I will use these ICs. Should be no problem for the 20 MHz SPI clock.

author: FrankBuss
author_rank: Unknown
timestamp: April 14, 2019, 05:52:35 am
content: Fully working example with a FRAM memory chip with 3.3 V, where the SPI port runs at 10 MHz, and an ATmega328, running at 5 V:Works without problems, problem solved. Yellow is the clock signal from the microcontroller and green the MISO signal from the memory, measured at the microcontroller input: