Welcome! Log In Create A New Profile

Advanced

Level shifter issues

Posted by TopherMan 
Level shifter issues
August 24, 2013 02:08PM
Hey all,

Long story short, I'm working on a project connecting an LPCXpresso 1769 with my RAMPS, using some protoboard and a ton of wire. Since the LPCXpresso is a 3.3V board, I decided to use a level shifter to switch the MOSFETs. Unfortunately, it's not working.

I'm using this shifter, 3.3V on side A and 5V on B. If I switch the various pins on and off, on the A side (3.3V, connected to MCU) the voltage is correct. However, the B side acts bizarrely. If I don't have anything connected, and I'm just reading voltage, they will switch up to 5, but won't switch off until I disconnect the voltmeter and reconnect it. If I have the RAMPS connected, and switch one of them on, they all switch on, and none of them will switch off until I disconnect power. As far as I can tell, I have it wired properly, VCCA=3.3V, VCCB=5V, GND=GND, OE=VCCA, pins all to the appropriate ports, the RAMPS works fine on the Arduino, and I don't have any shorts between lines. At this point, I have no idea what to do. Are there resistors I'm supposed to add anywhere? Should I replace it with a unidirectional shifter? Did I totally fail to understand the purpose of the OE pin?

Any help is appreciated,
Chris
Re: Level shifter issues
August 24, 2013 04:47PM
In case anyone's curious: just talked to the guys over at the Smoothie irc channel, and it turns out the problem is that the level shifter is the wrong component for the job, since MOSFETs draw such a large current. I'll either add a mosfet driver or just replace the fets themselves.
Re: Level shifter issues
August 25, 2013 04:30AM
Hi m8!

The TXB and TXS level shifters are for logic, e.g. weak current. For example one of these cant even drive I2C coz of current limits.

I suspect fet input gate capacitance may have something to do with your issue. This capacitance may be significant. Perhaps your IC functions correctly and it just discharge the capacitance extremely slowly. But i would think its burned coz the peak current is so much higher than it would be rated for. Mosfet gate input capacitance is in range of 5000pF-10000pF. It is very high for power mosfets coz it needs to drive huge currents (&peaks), hence the geometry of the conducting channel needs to be big enough for that, and a big physical geometry equals big parasitic capacitance. In comparison, a small logic mosfet gate may have 4-10pF input capacitance, e.g. 1k times smaller, coz a logic mosfet is designed for small currents. Similarly, lets say a logic buffer IC is made for speed (60Mhz) and very small parasitic capacitance, at some extent perhaps its current capability may be even lower than the rating of uC pin itself.

Charging a gate with such capacitance makes high peak currents, blindly say it can get in range of 3-6A (peak). Some time ago the TC drivers i chose for that board we made had 9A and 12A peak ratings, good for up to 10nF load capacitance. Bit overkill but good to have it capable to dissipate enough for driving in range of some 10s of kilohertz, coz after one cycle the frequency matters directly for power dissiapation. The TXS/TXB dont even give peak ratings, they say just continious +/-50mA, lets say a peak would be around 0.5A rating so the power mosfet capacitance may be too much. Hence, i wouldnt use these logic buffers for mosfet driving.

For example IRL8743 using some datasheet values for peak charging current:
Peak current (I) = Q / dt = MOSFET gate charge 36(typ) to 54(max) nC / Turn-on/turn-off time 23 ns = 2.35A(max) to 1.56A(typ).
Q is also C * V, so can be 5110pF*5V ~ 25.55 so Peak I = (C*V)/dt = 1,11A. Again, these are one-time peaks and not continious values. After these math out, the power dissipation needs to do same in relation to switching frequency, then it should be all good.
Re: Level shifter issues
August 25, 2013 05:00AM
Yeah, gate capacitance is an important but often overlooked characteristic. Everyone "knows" about gate voltage, but applying the right voltage is half the story.

It is perhaps fortunate that we can get away with driving a MOSFET from an AVR at 5V, but it makes it look simpler than it is. When going to 3.3V the drive current on the MCU output pins is also a lot lower.

I've been batting this around for quite a while, and have not found a really cheap and simple solution using discretes. Choosing a gate driver like noobman suggests (I think [uk.rs-online.com] is the sort of thing) adds a little cost but it should provide reliable performance.

It's almost tempting to stick in a small PIC/AVR just to handle 5V I/O. If it had an SPI interface, it could be a way to extend operation to multiple extruders with only a few pins.
Re: Level shifter issues
August 25, 2013 06:36AM
Yup, changing a power mosfet with another power mosfet shouldnt matter much because the high capacitance is coming from the big physical geometry required to channel big currents, and that is more or less the case for all power mosfets, of course depending on ratings and such, but generally speaking it may vary some, but wont drastically change.

Which means the thing needed to change is the driving circuitry. The reasoning chain is as follows. Could use 2 mosfets with 2-3 resistors, but would lack performance. Disadvantage is that the mosfets are probably low current and hence require series resistors in line with the gate, hence the rise and fall times will be inherently slow. Besides, populating the pcb with 2 mosfets and 3 resistors isnt as easy are using one single driver. At some extent may find some p- and n- channel paired mosfets in same 8 pin package, with mid-current ratings, that could be used with some resistors, but again we can go straight to mosfet drivers, probably at similar price, and less complications. And the driver is made specifically for the job, hence this solution should be faster and much better.

If we do go with mosfet drivers, I think the that one with 1.5A is too low, e.g. the math in previous post was 2.35A and i think there are mosfets with double value for total gate charge. A better choice is perhaps TC4422A, or TC4452, these have 9A and 12A peaks, these were my previous choice. Probably all driver types are more or less around same price, e.g. they probably have the same wafer hex size so should cost about the same so i'd personally rather go with higher current ones. Besides this reasoning, once a circuit is launched around ppls will play with it, copy it, and replace mosfet with who knows which one, so i'd rather go with a driver that can handle everything rather than a driver that has ratings very close to a specific component.

After the one time peaks math out, what normally matters is the switching frequency which makes the power dissipation, to be under the max allowed. But i dont think this is a real issue in this context, I think these variants should have no trouble to drive fets at much more than 100khz, (datasheet graphs are very generous), while the current arduino pid frequency is probably something like less than 80-60khz. Even for a board that could do more than that, probably the firmware wont do that, coz it would tend to maintain compatibility with circuits that do not have mosfet drivers, and those need longer rise/fall times, hence lower frequency. And besides that, when increasing that frequency of a uC output pin, probably the quality of the waveform should deform progressively, so its probably not a good idea to push it too much anyway. Especially coz in our case its not even needed and after some point the only thing it does is to increase the power losses and dissipation without any extra utility. So a frequency that is reasonable for our extruders is not expected to be a real criteria (for mosfet drivers), although normally it should be (for direct driving mosfet or for discrete parts). Basically with mosfet drivers the interval is probably larger than any other driving solution.
Re: Level shifter issues
August 25, 2013 06:58AM
For example looking at IRL3803 the total gate charge is 140nC and turn on is 14ns, so this is worse scenario than previous one, peak is now 10A. If its a mosfet driver with 1,5A, it needs a resistor in line with gate to limit the peak current at 1,5A. But this resistor will make the rise time slow, and that is not so good. The point in using mosfet driver was to make it as fast as possible, to make mosfet transition fast in its triode region and thus minimize the losses of it being only partly opened.

Edited 1 time(s). Last edit at 08/25/2013 07:05AM by NoobMan.
Re: Level shifter issues
August 25, 2013 11:33AM
Cool, thanks guys! Yeah, the gate drivers worked well on the XpressoSmoothie board, but some recent changes in Smoothie locked down the use of a bunch of pins to I2C and SPI, and unfortunately, they were pins I assigned to steppers. Eventually, I'm going to update the board to fix that, but I think it's going to end up being a tangled mess. So, for the mean time, I wanted to hack something together out of parts I had laying about, and one of those things was a level shifter.

On a related note, the guy who helped me out (wolfmanjm) mentioned that another Smoothie dev tested the AOT240L and it worked straight off the pin at 3.3V.
Re: Level shifter issues
August 25, 2013 12:35PM
I think you could try running mosfets directly even at 3.3v. The problem isnt as much with mosfets themselves but more with the lack of current in the uC driving pin, which by being limited it then charges the gate slowly rather than quickly, especially coz of lower voltage 3.3v instead of 5v. Probably more reason to use only bang-bang and avoid pid of pwm as control method.
Re: Level shifter issues
August 26, 2013 07:25AM
Quote

If its a mosfet driver with 1,5A, it needs a resistor in line with gate to limit the peak current at 1,5A.

Are you sure? I mean, currents are usually limited to avoid overheating. But if this high current lasts only a few microseconds, there's no time to develop substantial heat. The product of current and time is always the same, so the developed heat is also always the same. Oversimplified?


Generation 7 Electronics Teacup Firmware RepRap DIY
     
Re: Level shifter issues
August 26, 2013 08:03AM
If the mosfet driver has a rating of maximum 1.5A *peak* current and tries to charge a parasitic capacitance that tries to draw 10A peak current, that cant be good. It may work, but its not inside datasheet parameters, or it may burn or else. I think its like when the mosfet driver upper mosfet starts conducting, it starts conducting a peak of 10A when its only rated for a peak of 1.5A, that means its probably going to fry or enter protective mode if it has one. Perhaps some smarter drivers can detect and limit the current automatically if have this as a function. Else, if we put a resistor in line with the current path this way it can limit the current peak to keep the driver in safe operating area. But rising edge will change and charging will be slower (plus the rc filter effect if we think of pid pwm) - and that would make on-off times in datasheet sort of irrelevant. Alternatively we can go with another mosfet driver that has 10A peak rating, and advantage is that we take resistor away, plus it will also charge in fastest time possible - up to the mosfet driver's on and off times. Why wouldnt be like that, what do you see or think differently?
Re: Level shifter issues
August 26, 2013 09:11AM
Ah just read it again and realized it was missing "peak" word under first number, as both are peak ratings. E.g. in the example 1,5A was peak rating of the mosfet driver, and 10A is peak current drawn by the "natural" rising edge of charging the gate of the driven mosfet. Both peaks, they need to reconcile, either the driver needs to actively limit the current by itself, or a resistor in line with the gate needs to do so, or something like that.

If it would of been 1,5A *continuous* and 10A would be peak, fast, then indeed something like that could probably work together just fine. If it would math out to less than some absolute max and less than max power dissipation, then should work. Sry i forgot the "peak" word that was misleading. Its not continuous coz everything driver does is charging and discharging, rise and fall times, so peak currents are the tangible ratings, in other terms there is no constant current flow to speak of.
Re: Level shifter issues
September 03, 2013 01:55AM
Have a look at ZXGD3005E6TA. It's pretty low cost and has a peak output current of 10A. That's the absolute maximum of course, but it's still not bad.
Re: Level shifter issues
September 03, 2013 05:03AM
I did had a look at that some time ago when somebody else proposed it. The problem i see with that is that it is a current device, this is why datasheet has no VIH and VIL levels. It is controlled by current in its IN pin. On the other hand we have a uC that "talks" in voltage levels, thats a voltage device. That being said ofc it is quite possible to pair a voltage device with a current device. Just imho, this context is not ideal, especially not when talking about fast switch times and precise control. Ofc, this is just an opinion. The mosfet drivers from microchip have VIH and VIL ratings in datasheet, that means their input take voltage levels and that is what our uC outputs, sort of speaking in this case they can "understand" each other better. So while its not wrong to use that particular zetex mosfet driver, i would prefer to use a device that is voltage controlled coz that is what my controller outputs, and in this context it sort of makes more sense to me.
Re: Level shifter issues
September 04, 2013 02:41AM
Quote
Noobman
Just imho, this context is not ideal, especially not when talking about fast switch times and precise control
What, 46ns is too slow for you? at 100kHz, tr=46ns, tf=35ns changes the output duty cycles less than 1%. Those times are with a 10nF load, which is far higher than you'll get with a MOSFET.

Aren't these MOSFETs used inside a PID loop? Well, PID is what guarantees precision, not the MOSFET driver.

What the datasheet is unclear on is the minimum acceptable input high voltage. I will have to do some digging on that.
Re: Level shifter issues
September 04, 2013 09:41AM
Annirak Wrote:
-------------------------------------------------------
> What the datasheet is unclear on is the minimum
> acceptable input high voltage. I will have to do
> some digging on that.

Yes that was my point about. It doesnt have Vih and Vil at all. Because its current controlled. E.g. "current device" being controlled by current to its input. Sort of speaking it doesnt have Vih and Vil (voltage input high and low), in same terms it should of had Iih and Iil (curent input high and current input low), if it would of had a "current static discipline". That *was* my point, its a current device, it takes current level for input, while uC outputs voltage. At same time the others, microchip's mosfet drivers take voltage for input, i think coz they are made for microchip's microcontrollers and "they speak same language" - voltage.

Quote

Low input current of 1mA to deliver 4A output current


My point was about that, the input side (from the microcontroller - uC). Simply because our uC outputs voltage, it makes sense to me to use a device which input is controlled by voltage instead of one being controlled by current. In the same way but reversed, if my uC output would be as current level, then it would make more sense to pair it with a mosfet driver that takes input as current like this one. This is about uC and driver sort of speaking same language / static discipline.

    * If uC output controls the voltage level, and driver is controlled by voltage level, then its easy to calculate the exact time it takes do anything, including precise switching point. Its just a rising edge of voltage and that's all the math there is, and its exact. Since the uC gives "on/off" signal, we can easily calculate how much time till driver registers input to switch on/off.

    * But, if the uC pin voltage is linked to a device that takes current as input, then its probably not impossible, but at least a bit harder to math out what is exactly the point when driver input switches states. For example, theoretically could solve this with a voltage to current transfer function. But afaik the uC pin lacks the capacity to offer precise current control as output, and this gives room to a little uncertainity. At least the way i see it, the precise point where input state determines driver to switch on-off, that point is a little more "fuzzy".

Again as i said first time, this is my opinion, my preference, etc. To pair a voltage output device with another voltage input device. If its voltage both for uC output and device input this is simpler and to me feels more tangible, control points are clearly stated, and i'm with keeping it simple as much as possible.

On the other hand there have to be billions of applications where an uC pin with a digital output (voltage lvl) controls a traditional transistor (current input) instead of a mosfet (voltage input), and there is nothing wrong with it. On the same page we could of used a darlington transistor or IGBTs (current input devices) to control heated bed and extruder instead of using mosfet (voltage input) and this should of also worked more or less the same - perhaps except very high freq.
Re: Level shifter issues
September 04, 2013 04:34PM
So I had to do some sim to get a decent answer; thankfully, Diodes Inc. provides SPICE models for these devices. It turns out that the reason there's no VIH or VIL is that there isn't one. It's a pure current amplifier. The output voltage is (roughly) the input voltage. I guess these aren't really effective for level translation.
Re: Level shifter issues
September 05, 2013 05:17PM
After looking into it some more, these are the options I've come up with:
  • L6743
  • FAN3100

They're both in a similar price range and they are real MOSFET drivers, not just high speed current amplifiers.
Sorry, only registered users may post in this forum.

Click here to login