Half bridge or dual forward Cortex M based converter - Page 1
Forum section: electronics / projects

author: ali_asadzadeh
author_rank: Super Contributor
timestamp: February 18, 2018, 01:10:40 pm
content: Hi,I want to experiment with a 200-400W power supply, We can go the analog way like using TL494, But I'm interested in doing it with a Cortex M processor, Do we have a good starting point? like an app note, a book or an open source project, with detailed calculations and how to do the stuff. Any Hints or Ideas would be highly appreciated, As this would be my first Digital SMPS.

author: ocset
author_rank: Super Contributor
timestamp: February 18, 2018, 01:44:14 pm
content: i think tl494 is very poor controller.See "the digital power supply revolution" by dr ray ridleyi tried to attach it here but it is too big.Digital power supplies controlled by software are generally too expensive unless there is a certain complexity to the spec.An example where a digital power supply was needed was in a 3kw battery charger (offline) whereby the pfc output voltage had to be varied in order to suit the follow-on LLC converter. (llc converters aren’t good with a wide range of vins and vouts.)…so they needed to adjust the pfc output voltage...at some times the pfc vout was 440v (ripple pkpk was 10v)…and the pfc output cap was only 450v rated ………as such , they needed a special software algortithm for the pfc controller so that they never breached the 450v spec of the pfc output capacitor…...eg in sudden no-load etc etc………..you couldn’t have such a versatile pfc with a low component count analog solution.Also, they were using the same processor to control both the dual pfc stages and the downstream llc converter, which meant a small overall size solution could be got……this is why they needed software controlled smps….but generally…….you just don’t need the sheer expense of a software controlled solution, with the cost of software engineer, software updates etc etc…….another software engineer to come and re-write the software when the processor goes obsolete etc etc.

author: ocset
author_rank: Super Contributor
timestamp: February 18, 2018, 02:56:58 pm
content: Well i answered generally.Really we should be asking the usual...Whats Vin?Whats Vout?Do you need isolation?Do you need a fast transient response?What is max allowable overshoot/undershoot in vout following a particular load transient transient which you must spec. to us.What's the load?Is it constant load or occasional power pulses etc etc?Whats the size profile?What is the ambient temperature?etc etc.But i think the article from Dr Ridley is a good one.Crucially the Ridley article speaks on why analog smps are in many senses "digital" in nature......take for example the action of the pwm comparator in an "analog" SMPS..it has an output which determines duty cycle and it is either high or low output....very "digital" indeed.

author: ali_asadzadeh
author_rank: Super Contributor
timestamp: February 18, 2018, 03:10:11 pm
content: Thanks for replies, treez would you share the link, so I could get it?But I wanted to learn this topic, any lights to shed?

author: ocset
author_rank: Super Contributor
timestamp: February 18, 2018, 03:13:01 pm
content: Though I speak in the auspices of truth…and really, you can do a software smps by doing a software imitation of an analog controller……what you basically do is sample the vout signal (usually it’s a divided down voltage)…then you apply an algorithm to it which imitates the error amplifier….which has an integrator kind of action……so basically you want to do a moving average type operation on the sampled vout samples….you then of course are producing an error signal, which is how ever far away from the demand signal (which is AKA the reference voltage)…you apply a gain factor to this error signal and of course this ultimately gets compared with the reference, so as to see if the pwm comparator goes high or low, and thus afflicts the duty cycle. (if tis a duty cycle controlled converter).One advantage of a software controlled smps is that you can control and adjust the gains on the fly…but often, there just isn’t any need to do this.i will share the link........but i think its hard to find...i have the pdf, but problem is how do i get it to you when the forum wont allow 14MB pdfs to get attached?You might be able to find it herehttp://www.ridleyengineering.com/..or maybe will have to pay a dollar or two for it...it might be in one of ridleys books.Sorry i cant find the link...i downloaded it years ago, but the link has gone.

author: Siwastaja
author_rank: Super Contributor
timestamp: February 18, 2018, 04:52:21 pm
content: Many modern SMPS-oriented MCUs - for example, I have used STM32F334 - include enough software-configurable HW to implement inherently stable current mode controllers where only "slower" things (such as outer voltage PID (or often just PI)) loop run on software (interrupt handlers).For example, in STM32F334, I just configured one DAC channel to drive reference input of an internal analog comparator - another input is from high bandwidth inductor current measurement. The comparator output goes to PWM generator block (HRTIM). This generates nice peak current mode controller, unconditionally stable, without any software after the init. Now comes the software part: the current measurement input pin is shared and also an ADC pin: we can average out the current and finetune the aforementioned DAC setting to actually make average current accurate, while the quick analog loop makes it extremely stable and react quickly. In addition, voltage is measured using ADC, and a simple PID loop can adjust the current setpoint as well. The BOM is, basically:- STM32F334- bootstrap fet driver- current sense amplifierI was very happy in this project - no showstoppers, zero blown fets...Many other MCUs today offer the same, this is very basic stuff. Many include enough resources to run several converters in sync to form multiphase converters.

author: ali_asadzadeh
author_rank: Super Contributor
timestamp: February 19, 2018, 06:41:01 am
content: Siwastaja welldonewould you share more? how did you started it all?treez would you please upload it somewhere else so you could send the link in here.

author: diyaudio
author_rank: Frequent Contributor
timestamp: February 19, 2018, 04:19:40 pm
content: Quote from: treez on February 18, 2018, 01:44:14 pma digital power supply is as poor and good as ones knowledge using a tl494.

author: jbb
author_rank: Super Contributor
timestamp: February 19, 2018, 06:34:27 pm
content: Quote from: Siwastaja on February 18, 2018, 04:52:21 pmSome of the Texas Instruments Piccolo devices also include a little hardware block which causes the internal DAC channel to generate a programmable ramp signal to implement adjustable slope compensation. (Slope compensation can be required in some converters (I think most often buck with duty > 50%)).EDIT: also the Piccolo line (well, the C2000 line generally) have excellent PWM blocks with nice features like adjustable phase synchronisation, high resolution modes etc.

author: ali_asadzadeh
author_rank: Super Contributor
timestamp: February 20, 2018, 07:55:20 am
content: So do we have a good tutorial on this subject? take for granted that I'm newbie in this field. Please do not suggest that it's not worth it! I want to learn something new

author: T3sl4co1l
author_rank: Super Contributor
timestamp: February 20, 2018, 09:09:59 am
content: Quote from: diyaudio on February 19, 2018, 04:19:40 pmDigital is better because TL494 limits you to very basic PWM controls (you can't even do a latched peak current mode control with a TL494, without doubling the amount of components in your controller).If digital is truly anything, say an FPGA with the real time computational capacity of a PC for example, you can do some very subtle and impressive things that way -- and at that, much higher than the ~200kHz limit of the TL494.Tim

author: Siwastaja
author_rank: Super Contributor
timestamp: February 20, 2018, 09:19:07 am
content: I didn't have any tutorial. For my first real digital SMPS job, I just picked STM32F334 by looking at the peripheral specs (so that I knew what I wanted to do was available), read the reference manual how to program it, used common sense and basic equations (super simple stuff such as V = Ldi/dt), and just did it. Didn't have any major problems. But for this reason, I have no idea what references to recommend, sorry.There's a lot of mathematical talk into "loop compensation" - often required explicitly to try to make voltage control loop stable. Beware that the voltage control loop (as the inner loop controlling the PWM) is inherently the Wrong Thing To Do, so lengthy discussions heavily involved in math around it may not make sense, if you just want to know how to make actual converters with modern technology. Today, every sane controller is using a current loop.For example, my converter didn't have a PWM (pulse width modulator) - the classic component taking an error input and building a variable duty cycly output based on that input, which seems like some kind of "default" in literature.In a current mode controller, the FET control signals can be "directly" built based on the actual measured inductor current, so that the desired inductor waveform isdirectlycontrolled and generated to our liking. This is a HUGE fundamental difference to how literature classically describes it, and how voltage-controlled SMPS'sweredesigned in the past: by separately generating a PWM, and feedbacking the generation process in hopes that we get what we want - with delays, overshoots, ringing, and possible unstability regions needing careful tuning (digitally: PID; analog: compensation R&C networks), and ugly things like adding significant amount of extra resistive losses to the output capacitors to make it stable. In a modern current mode design, most of these issues just simply go away, they don't exist at all, so the analysis is also simplified. In fact, you can skip most of the math and directly go to the inductor current triangle wave. Having an absolutely simple and super fast current limit that just always works makes designing the outer voltage loop so much easier, and you can't blow things up if your voltage PID parameters are wrong.In software, it's also so easy to just write:if(voltage > SAFE_LIMIT) turn_it_off();

author: ali_asadzadeh
author_rank: Super Contributor
timestamp: February 20, 2018, 02:48:37 pm
content: Thanks for the updates,Siwastaja is it possible for you to share some part of your project in here?I would really appreciate it.

author: Siwastaja
author_rank: Super Contributor
timestamp: February 20, 2018, 03:30:09 pm
content: Quote from: ali_asadzadeh on February 20, 2018, 02:48:37 pmSorry, it would be too time consuming, especially since I don't own the design alone as I was paid to do it. I already described the "block diagram" in my first post to this topic. Devil is in the details and things like exact power PCB layout and exact software trickery needed will take most of the time, even though the basics are simple.But, I'd recommend you'd get some SMPS-oriented MCU, preferably from a MCU family you are at least a bit familiar with, and take the simplest project you can think about managing yourself, then actually try it for yourself. You'll learn that way. Start with generating a PWM, or measuring a current with ADC, or using the current measurement in analog comparator to trig an interrupt first.The very first thing I did was to write an interrupt service handler that gets triggered automatically if the free-running ADC ever converts a current reading too high (near the inductor saturation). The STM32 ADC has this functionality, you can set a threshold value for certain ADC channels, exceeding the value instantly rises an interrupt flag. Then, I configured that interrupt handler to have higher priority than any other ISR, and wrote some quick code to disable the gate driver. Then, injecting some current from a power supply over the shunt resistor, you can easily test this handler indeed works, measuring the reaction delay with a scope. Now your FETs are protected against inductor saturation caused by any wrong software setting, and you can apply the real supply...Zero blown FETs during the project.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: February 20, 2018, 08:09:15 pm
content: Protection features are fantastic. The transistors I've blown, from hobby projects to industrial modules, all fit on one hand (though to a certain extent, it helps that one of them is an IGBT module, upon which the rest can be stacked). Current mode controls, and desat detection where applicable (usually for IGBTs and for larger drives, >1kW), make a very robust system indeed.When you can shove a screwdriver across the output terminals of your inverter, hear but a click, and have no damage to the circuit, you've done right.Tim

author: jbb
author_rank: Super Contributor
timestamp: February 21, 2018, 05:54:21 am
content: Quote from: Siwastaja on February 20, 2018, 09:19:07 amPedantic footnote: current fed converters should probably use an innervoltageloop. (But current fed converters are a bit unusual...)Quote from: T3sl4co1l on February 20, 2018, 08:09:15 pmDesat is very good. Mostly works for MOSFETs too. My general recommendation for firmware bring up is to start with ADC measurements, then overcorrect / over voltage tripping (disable PWM outputs ASAP!), then inner current loop, then outer voltage loop.I advise having a look at TI reference designs. They have a number which use their Piccolo (aka C2000) microprocessors (quite good chips too) which include quite a lot of details.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: February 21, 2018, 09:21:15 pm
content: Quote from: jbb on February 21, 2018, 05:54:21 amYes, of course everything is flip-flopped that way.Which often catches newbies off guard when their "ZVS" driver explodes, because it's actually a current fed inverter, but not really because the current source is an inductor, which gives an odd mixture of CC and CV properties to the circuit.Tim

author: ali_asadzadeh
author_rank: Super Contributor
timestamp: February 24, 2018, 08:31:43 am
content: Thanks for the hints,QuoteI'm very familiar with ST and NXP, so I will go with ST MCU,So if I implement an ADC out of window ISR and shut down the PWM immediately, Does it prevent me from FET blow up!? I mean suppose that I have did this very thing right and all the other things including some circuit parameters, like snubbers wrong,Does it prevent damage? what about voltage spikes!? Suppose that I have done some wrong calculation on the Transformer too, and my PID loops are all wrongly tuned too

author: T3sl4co1l
author_rank: Super Contributor
timestamp: February 24, 2018, 09:59:31 am
content: Well...It is impossible to make something truly foolproof. You see, fools are just too ingenious.The only thing for which it is -- more or less -- strictly true, is the control loop: hopefully, at least, a shutdown will occur in microseconds, whereas the control loop will have time constants of hundreds to thousands of microseconds. Thus the compensation of the control loop shouldn't factor in.But, ingenious as fools tend to be, there are more than plenty possible exceptions that could apply:- Pathologically bad layout: one switching event kills it, period- Snubbers wrong, FET draws short circuit current (hey, you saidwrong-- how wrong could it be? Use your imagination.. how about crossed wires?)- Snubbers wrong, layout bad, turn-off of fault current causes FET avalanche, with excessive energy- Excess input voltage, accidentally wired to 480V 3ph instead of automotive 12V- Transformer wired wrong, 480V 3ph stepped up to 14.4kV, PCB fails in melted blob of charred glass- MCU written pathologically badly, fault ISR takes 20ms to process- MCU just outright crashes; lack of "keep-alive" or watchdog in both hardware and software results in failure- MCU divides by zero, control loop jumps suddenly to maximum; or core faults, and etc.For most of these possibilities, yes, the magnitude of the accident is freakish indeed -- a factor of 10 or 100 too far, one way or another.But, strictly speaking: if you ask ifanyvalue can cause problems, I must strictly -- and quickly and unequivocally -- answeryes!What is the safest plan of action? Familiarize yourself with the fundamentals of the circuit. Establish a working understanding of the voltages and currents in circuit, where they go between switching events, and what componentand parasiticparameters control their values.Moreover, establish methods to measure and verify all of these circuit parameters. That includes the MCU: benchmark the performance of various routines, test them against random interrupts and fuzzed inputs; disassemble/inspect the object output to verify the code is doing what you think it should be doing (prerequisite: have at least a hand-waving knowledge of your processor's instruction set, so you can read this output, if not write it directly yourself).You will still be off by some error factor. But it needn't be a factor of 10 or more. A factor of 10% is easy to achieve in practice, but getting to that level of practice takes much learning, and practicing at practice, so to speak.Tim

author: benst
author_rank: Regular Contributor
timestamp: February 26, 2018, 05:35:36 pm
content: Perhaps you've found this already, but ST has a small cheap dev board with the SMT32F334C8 for playing with buck/boost topologies:http://www.st.com/content/st_com/en/products/evaluation-tools/product-evaluation-tools/mcu-eval-tools/stm32-mcu-eval-tools/stm32-mcu-discovery-kits/32f3348discovery.htmlBen

author: ali_asadzadeh
author_rank: Super Contributor
timestamp: February 27, 2018, 07:08:16 am
content: Thanks for the hint