74HC4050 vs SN74LVC125A - Page 1
Forum section: electronics / projects

author: JacquesBBB
author_rank: Frequent Contributor
timestamp: December 20, 2015, 04:03:18 pm
content: I designed a dual SD card modulehttps://www.eevblog.com/forum/projects/hot-swap-spi-devices/msg750407/#msg750407made the PCB, tested it, and it failed miserably.I was not so surprised, as I did not completely tested the design and rush for the PCB a it wasmade at the same time of several other modules.Now I want to look back to this in a more systematic way, and the first thing I tried to do is to evaluate the behavior of the74HC4050 and SN74LVC125A which I am using in my design.Both are line buffers, and the SN74LVC125A has a three state output which I needed. I thought both would behave the same way, but this is not the case.I made a simple setting, with a function generator, issuing a (about) 6 V sinusoid. Both were powered in 3.7 V or 3.4V.In a first experiment, the input signal is fed directly to the chip (1A, output in 1Y)For the 74HC4050 (http://www.nxp.com/documents/data_sheet/74HC4050.pdf), everything was as expected, with a clean step for the ouput, with a rising time of about 22ns.

author: JacquesBBB
author_rank: Frequent Contributor
timestamp: December 20, 2015, 04:14:45 pm
content: continued...But for the SN74LVC125A, things were very different.First I realised that I omitted the pullup resistors for the enable pins. I do not know is this is very important, asthe pins are normally set HIGH by the microcontroller, and set LOW as well with the CS pin of the SD card.More important, it seems that the chip cannot be directly fed by the input sinusoidal signal, but needs aninline resistor of at least 1.5 k otherwise the behaviour of the response is very erratic when switching fromLOW to HIGH or HIGH to LOW. I suppose that the impedance of the SN74LVC125A is not very high, but I did notsee that in the datasheet from Ti.http://www.ti.com/lit/ds/symlink/sn74lvc125a-q1.pdfAfter several tests, I put a 9k resistor, and everything behaved better, with a very short rising timeof about 3.2 ns, but there is an overshoot in the output.Is this overshoot a problem for the MISO and MOSI lines of the SD card ?I have put a 470 R resistor in series of the output pin, and the overshoot was reduced, but the rising time largely increased.With a 51 R resistor, results are in between the previous ones.I have made many experiments, but do not want to add to many things to the design. I also realise that on the final board,things may be quite different than on the breadboard used for the experiments.Remains two main questions :- Is it necessary to put a resistor > 1.5 k in series of the input pins .- Can I suppress the output resistor and live with the overshoot, which give the fastest rising time, or is it better to atenuate it ?

author: exmadscientist
author_rank: Frequent Contributor
timestamp: December 20, 2015, 06:09:49 pm
content: There's so much wrong here I'm not quite sure where to start....I guess the key point is that LVC is afastlogic family. It has fast edges, can go up past 100MHz in clock, and has substantial transition currents on edges. HC is not nearly so fast. You really, really, really need a Schmitt trigger input if you're going to be using LVC on such a slow input edge; this is a well known problem in that case. LVC also really does need proper decoupling capacitance for handling the edge transition currents.Also, you're overdriving the hell out of that poor '125A. LVC is specified up to 5.5V input. HC4050, at least for NXP's 74HC4050 (the first datasheet I found), is specified up to 15V. That means I'd expect it to be happy, and worry that you might be killing the '125A.I strongly recommend a look through the digital logic sections of the new Art of Electronics third edition. They cover all of your problems here and more in nice, plain language.

author: JacquesBBB
author_rank: Frequent Contributor
timestamp: December 20, 2015, 06:42:25 pm
content: Thanks for your comments.I will look to the chapter of AoE.Quote from: exmadscientist on December 20, 2015, 06:09:49 pmYou are right, The voltage of the input was a little bit high, but this is because I did so many experiments that I got confused at the end. Here is the same thing withVCC = 3.4 V and an input sine of 4.5V pp . As you can see, the result is the same.The first picture is with no input resistor.Then with 500 R input resistor with an additional detailed view.Then with 1.5k resistor. This is about the limit to get it right.

author: ajb
author_rank: Super Contributor
timestamp: December 20, 2015, 07:14:23 pm
content: Do you you actually need to convert a since wave to a square wave in your application, or is the sine wave just for testing purposes? Because if you're getting a sine wave in an spi interface, you've got serious problems.Without a Schmitt trigger input, a digital device has only a single threshold, so any input above that is considered high, and anything less is considered low. When you have a really slow rising or falling edge the input signal lingers close enough to that transition point for enough time that a small amount of noise can bounce the signal above and below the threshold. If the digital device is fast enough, it will be able to respond to each of those transitions, which is exactly what you're seeing. Furthermore, fast devices exhibit large transient currents when they switch (they have to in order to be fast!), and without proper layout and decoupling, these transients can disrupt the input signal enough to cause spurious transitions or oscillations even without any other noise in the system. Note in your traces how when the output oscillates the input appears to oscillate as well? That suggests a problem with layout, decoupling, or your probe setup as a result of those switching transients.

author: Zero999
author_rank: Super Contributor
timestamp: December 20, 2015, 07:57:44 pm
content: It appears to be reflections caused by improper termination.The 74HC series have an output impedance of around 50Ohm and as pointed about above aren't that fast. Any reflections will be absorbed by the 74HC's output impedance.The 74LVC series is not only faster but has a much lower output impedance so any reflections will bounce back and forth between the output and gate inputs.Try connecting a 100R resistor between the inputs of the gates you're interfacing with and 0V via a 100pF capacitor.

author: JacquesBBB
author_rank: Frequent Contributor
timestamp: December 20, 2015, 10:14:36 pm
content: Quote from: ajb on December 20, 2015, 07:14:23 pmThe sine wave is just for testing. from my past errors I believe that its better to understand properly the behaviour of each individual part of a design, but the drawback is that it takes time to do so, and you are right, in the testing setting, there may be some circumstances that are never encountered in the real design.

author: bson
author_rank: Unknown
timestamp: December 21, 2015, 12:40:43 am
content: The input signal transitions are too slow for LVC. You can't simply feed it a sinusoidal and expect a shaped output. When doing clock shaping with LVC it's common to connect a resistor between inverter inputs and outputs of the first stage to eliminate this, but that won't work with tri-state driver. You will need to shape the sinusoidal before it's feed to the tri-state line driver. (Or use an 'HC125.) This is actually a fairly typical result when mixing logic families of such different speed in general.

author: JacquesBBB
author_rank: Frequent Contributor
timestamp: December 21, 2015, 05:18:08 pm
content: Quote from: exmadscientist on December 20, 2015, 06:09:49 pmI have looked to the chapter 12 which is the most relevant on this problem, and it is really enlightening. It seems that everytimes you open again AoE you learn new things that you have not remarked at the previous reading.I was naively thinking that the logic CMOS IC drew no practically no current, but it is well explained here that during the switching, the load of the capacitor draws some current that becomes non negligible in these fast switching devices.The fig.12.10 of AoE (p.801) is very similar to my screen shots.Additionally, I see there that in AoE, they assume that most LVC IC will operate up to 5V, despite they are labelled up to 3.6V in their datasheets. Do I understand this well ?This is nice, as I would like to use the SN74LVC125A up to 4.2V which would be given by an unregulated Lipo battery.

author: exmadscientist
author_rank: Frequent Contributor
timestamp: December 22, 2015, 04:41:50 am
content: Quote from: JacquesBBB on December 21, 2015, 05:18:08 pmNo -- only some LVC chips are specified at 5V. AoE mentions this in, for example, the caption to Figure 12.3. You have to check a specific part's datasheet. For example, the SN74LVC125A is specified up to 3.6V, but the SN74LVC1G125 goes to 5V. (I agree that this is rather a dumb way to do things.)

author: DutchGert
author_rank: Frequent Contributor
timestamp: December 22, 2015, 11:12:15 am
content: Never assume anything because a book suggests so. That is bad engineering. Read the datasheet of the device u want to use and base your design on those.Also, as you can see, nothing (even 'just some logic') is simple

author: T3sl4co1l
author_rank: Super Contributor
timestamp: December 22, 2015, 11:30:53 am
content: Yeah, LVC isstupid fast on crack, only to be used where you need to beat the shit out of a signal! 74LVC is in the class of logic where you need to worry about signal quality: ground planes, ample supply bypass, terminations for traces, measurements requiring oscilloscopes >= 400MHz, etc. Using 74LVC where you actually need 74HC or less, always invites problems, from the mundane (excess RFI) to the batshit crazy (like the oscillation seen here, which will gladly couple into resonant traces and upset more circuitry).For everything else, there's 74HC, or even CD4000 for that matter (though it doesn't really work down at 3.3V). I forget if 74C works at 3.3V, or if it behaves identically to CD4000.For SD cards, 74HC should be fine.Tim

author: bson
author_rank: Unknown
timestamp: December 22, 2015, 11:11:27 pm
content: What.tesla said! Seriously, use HC if it's fast enough... I checked the TI datasheet for the LVC125 and it's only 5Vtolerant. With a 5V supply voltage I would expect nothing good or reliable...HC is cheap and easy!