Micros for digital SMPS control - TI, NXP (Freescale) opinions - Page 1
Forum section: electronics / general

author: vectorotter
author_rank: Contributor
timestamp: January 02, 2021, 07:35:14 pm
content: Hi there,I'm designing a power supply from scratch as a learning exercise. It'll be line connected, transformer isolated and with some form of active power factor correction to 48V DC CC CV @ ~ 100W or so. The exact topology and control scheme isn't fixed down yet - still reading, running simulations and understanding what's possible. The load should be roughly constant over time except under failure conditions. The control is going to be all digital.I see TI have the C2000 series micros and from another post I found on the forum Freescale have micros designed with exactly this application in mind.From what I can tell the toolchains are bundled in Code Composer Studio in the case of TI and the Code Warrior for the Freescale parts. Re: the TI part, I dislike eclipse :-) although if I need to drive the compile from outside there I'm sure that can be made to work. Any comments/comparisons?More importantly I'm interested in anyone having experience with the 'Solution Adapter' and if there is some NXP/Freescale equivalent for configuring, generating code and seeing examples of how the peripherals get wired up. The compensation and then the simulation of overall response seems like it could be a help provided my eventual topology matches some existing application sufficiently well.Anyone have any real-world experience of either or preferably both who can comment on the tools, the parts and so on? Seems like some of the TI eval boards are not available at Digikey - not sure if that is typical.Thanks for any help in advance.Err... I think the magic smoke will make an appearance at some point on this one.

author: opampsmoker
author_rank: Regular Contributor
timestamp: January 03, 2021, 03:03:00 am
content: 100W and offline, isolated.For that a HiperPFS PFC stage followed by a Innoswith flyback would be very good...no code needed, but i appreciate you want to practice.For a code controlled SMPS to be worthwhile, it needs to have a spec that calls for code.Eg i took apart a 3kW offline battery charger once.It had two Parallel PFC stages followed by a half bridge LLC...all three were controlled by a single micro. The micro was worthwhile here because...The micro changeover switched the PFC stages every 10ms, so that they shared the thermal load between them.The micro also continually monitored and controlled/changed the vout of the PFC stages so that the "open loop" LLC stage had the right input voltage to optimally charge the battery.The micro also changed the f(sw) of the LLC stage from 100khz to 200khz when in light load (at the end of charging), or when necessary, eg if battery voltage was very low at start of charging.The micro also did adaptive dead time control of the LLC stage FET drive.This was a great example of a micro being needed. A 100W offline isolated SMPS does not need code, but i am sure you know this.

author: vectorotter
author_rank: Contributor
timestamp: January 04, 2021, 07:06:01 am
content: Thanks for the input but it doesn't address any of the questions or provide opinion that I sought.

author: uer166
author_rank: Super Contributor
timestamp: January 04, 2021, 08:18:29 am
content: I've been using STM32G474 micro with some success for toy power electronics projects. All have direct current control using MCU peripherals (comparators, HRTIM, DACs, etc..), and a software outer control loop. The Cube thing makes it easy to set-up some of the peripherals, with hand-written C for actual control loops. The number of ADCs and analog resources makes it easy to automate a lot of the control/safety stuff.There is a "solution" generator athttps://www.biricha.com/st-wds.html,although haven't tried yet since it only does simple topologies.

author: vectorotter
author_rank: Contributor
timestamp: January 04, 2021, 08:34:07 am
content: Thanks. I'm familiar with the STM32 offerings in general and all else being equal I would go for an STM32 part, being familiar with the toolchain, Cube thing and so on.My suspicion, without having gone in to detail is that, as with all these 'Wizard' type utilities, once you start moving off the reservation then one ends up either having to spend a lot of time coercing the thing to fit what one wants or dropping it altogether and starting from scratch.The TI parts boast a high-resolution PWM that can be tripped directly from the ADC without CPU intervention presumably for implementing the safety cut-out. I guess I'm after confirmation or denial that I can get to the same/similar point without those special features, and yes, I guess having a 'toy' spec means getting away with it more easily.Nice to know about the "solution" generator anyway. Thanks.

author: uer166
author_rank: Super Contributor
timestamp: January 04, 2021, 08:43:22 am
content: Quote from: vectorotter on January 04, 2021, 08:34:07 amSo does almost every STM32 ADC, it's called "analog watchdog". You wouldn't do this using the ADC though, it's easier to route it to a comparator+DAC for a true hardware safety cutout.HRTIM runs at an euquivalent of 4.7GHz for ~200ps resolution for normal PWM mode.I think it really doesn't matter what you chose, obviously all these chips are capable for all kinds of power control..

author: Siwastaja
author_rank: Super Contributor
timestamp: January 05, 2021, 08:59:27 am
content: I like STM32F334. HRTIM is quite easy to use, IMHO, it's a clean-cut design with all the flexibility in mind from day one so configuring it makes sense.DAC can provide comparison reference for the internal comparator, which can then be routed to command the HRTIM.Don't use any stupid "toolchain". None is needed. gcc-arm-none-eabi is available as a simple install. Write your own code, it's almost always just easier that way.

author: sandalcandal
author_rank: Unknown
timestamp: January 05, 2021, 10:02:53 am
content: Was busy doing my on research on nearly the same question and missed your thread :sI'm looking at much higher power systems but I've posted my own research and thoughts so far there:https://www.eevblog.com/forum/projects/picking-a-dsp-mcu-experiences/Discussion here reminds me I should probably take a look at NXP and also have a check over of the peripheral configuration tools.

author: vectorotter
author_rank: Contributor
timestamp: January 05, 2021, 11:33:36 am
content: Quote from: Siwastaja on January 05, 2021, 08:59:27 amThanks.Quote from: Siwastaja on January 05, 2021, 08:59:27 amHence why I did not like the idea of using either the TI or NXP part - I'm a gcc devotee. I didn't want to load the question with bias at that point ;-)

author: Siwastaja
author_rank: Super Contributor
timestamp: January 05, 2021, 12:01:18 pm
content: BTW, I'm fine with using ADC for safety shutdowns. Often you don't have the choice, analog comparator and DAC channels run out so the STM32-style ADC "analog watchdog"s come in handy. For example, if you watch for inductor current with analog comparator, you may want to use ADC "analog watchdog" to look at input under and overvoltage and output overvoltage.When you do that, make sure to enable all possible error interrupts (like OVERRUN, which happens if DMA fails) in addition to the analog watchdog interrupts themselves; configure highest interrupt priority (0 in ARM), don't use the same priority for anything else. If available, configure clock safety system (switching to the internal RC oscillator and triggering an interrupt if the main oscillator stops). Never __disable_irq() but instead wrap access to BASEPRI (in ARM) with your own IRQ dis/en macros so you never disable the highest priority ISR, not even for a short time. Make the highest priority interrupt unrecoverable, just shut everything down and indicate error. This way, I don't think using ISRs and code is any less reliable than using the peripheral HW features. You just have quite a few things to remember so the risk of forgetting something is obviously bigger.Remember to test each and every protection feature.

author: nctnico
author_rank: Super Contributor
timestamp: January 05, 2021, 01:46:14 pm
content: @Siwastaja: I'd still be cautious with software only protection. I have come across (extreme) situations where the microcontroller stops completely (not even a watchdog reset) or executes random code. Therefore I always have hardware cycle-by-cycle current limiting in my software based SMPS designs as a backup.

author: vectorotter
author_rank: Contributor
timestamp: January 06, 2021, 10:17:24 am
content: Thanks for the detailed info. I will mull all of that over.Quote from: Siwastaja on January 05, 2021, 12:01:18 pmYes, in a similar sense to test-driven development in the software world. Create the protection feature (test case) individually and have it fail perhaps even before writing anything to do meaningful control.

author: TimNJ
author_rank: Super Contributor
timestamp: January 06, 2021, 07:10:49 pm
content: I just noticed today that NXP has a new version of its LLC resonant controller: TEA2016T. It has a I2C interface which allows you to tap into a ton of internal parameters. Seems very interesting.This is one of the first controllers, targeting mass market, that I've seen with this level of programmable functionalityI know this is not really the same as using a generic/blank MCU, but on the other hand, doing it from scratch just seems like a huge headache unless you are trying to do something particularly special.I wonder if these I2C programmable controllers will become the norm soon.

author: Siwastaja
author_rank: Super Contributor
timestamp: January 07, 2021, 09:22:19 am
content: Quote from: nctnico on January 05, 2021, 01:46:14 pmMany peripheral HW features are also in risk of stopping. Often they require clock signal, at very least, which can stop either due to a software fault (runaway program counter accesses clock tree configuration), or through oscillator failure.Some do have asynchronous protection features, check it up. There is still the risk that software fails to initialize it properly, although it seems quite small to me.For really critical cases, you may want to add an external, like analog, protection. For overvoltage, independent analog crowbar + properly specified fuse, for example.Current limiting often isn't a problem; it's easily made safe with a properly sized fuse (which is inexpensive and simple). Sure enough, software fault then causes hardware damage blowing up the semiconductors and the fuse, but then again, this becomes just an availability/maintenance problem. The good thing with software is, it does not age (in this context), and variation between units is minimized. With ST, of course, they may suddenly completely change the MCU behavior without changing part number so all bets are off regarding what you receive from your distributor. A recent example being STM32H743/H750 changing the ADC sampling clock frequency by factor of two, which could have the potential to keep application running normally but affect rarely needed protection functions, so that some PCBs in the batch work and some are dangerous. The only thing we can do is hope this never happens again. Or run full test of all features on each PCB. Which is obviously what we should be doing on anything safety-critical.Keeping the software simple (and state space small) is a good way to avoid surprises; then each feature can be thoroughly tested and verified.

author: JohnG
author_rank: Frequent Contributor
timestamp: January 07, 2021, 01:55:05 pm
content: No Microchip users?I don't do controllers, so I cannot expound on the merits or lack thereof, but my company uses the dsPIC versions targeted at SPMS and motor drivers. I know that they are also used on some vendors "brick" type power supplies, particularly the ones with really high power density.Cheers,John

author: nctnico
author_rank: Super Contributor
timestamp: January 07, 2021, 03:40:53 pm
content: Quote from: Siwastaja on January 07, 2021, 09:22:19 amNo. For a PWM controller it is extremely simple to implement. Feed the PWM signal to the clock of a flip-flop (which has an asynchronous reset) and an AND gate which combines the PWM signal and output of the flip-flop. Connect the overcurrent to the reset pin of the flip-flop. The flip-flop will be reset in case the overcurrent hits for the remainder of the period.QuoteA fuse is to prevent a circuit from catching fire; not to protect a circuit. To me relying on a fuse to catch software errors is not acceptable.

author: sandalcandal
author_rank: Unknown
timestamp: January 08, 2021, 03:34:17 am
content: Quote from: JohnG on January 07, 2021, 01:55:05 pmgae_31 mentioned some experience working with dsPIC here:https://www.eevblog.com/forum/projects/1kw-resonant-converter-analysis-design-build-and-validation/msg3392780/#msg3392780Quote from: gae_31 on December 30, 2020, 07:00:27 amAlso from taking a look at stuff on paper myself, looks like dsPIC has potentially better cost effectiveness but development and design to get things working well is a bit more involved since you have to deal with lack of FPU.

author: nctnico
author_rank: Super Contributor
timestamp: January 08, 2021, 09:50:41 am
content: You don't need an FPU to use floating point by definition. You only need an FPU in case software floating point is too slow. On a 32 bit ARM core software floating point isn't very slow though; I use it a regulary for realtime control loops.

author: Siwastaja
author_rank: Super Contributor
timestamp: January 08, 2021, 01:03:22 pm
content: Gee, just don't make software errors.The fuse is there to prevent a software error causing a fire; just making the product fail instead, so worst case, the customer complains, forcing investigation into what went wrong.The fuse is really the last line of defence.I like to avoid excess parts whenever possible; adding more parts to a problem requires yet more work to verify nothing can go wrong.Of course, in order for this to work you need quite a lot of trust in the software. Simplicity is the key here.Often, I think it's better if the product fails completely forcing fixing the actual bug, than if it runs a "bit weird" because the software fails and some analog subsystem silently works against it keeping it kinda-running. Such alternate system receives little real-world on-field testing. This is why I have never added an external "is PWM running, if not, override it" watchdog out of logic gates; but I do like having independent analog overvoltage protection especially for battery chargers, and I do like properly sized fuses.

author: Siwastaja
author_rank: Super Contributor
timestamp: January 08, 2021, 01:08:02 pm
content: IMHO you don't need floating point (hardware or software) for SMPS control, or motor control for that matter. Use fixed point. 32 bits tends to be enough range even for multiplications, most of the time, and if unsure, using 64-bit operands isn't too expensive.The idea is that if you write code in auto-pilot mode without thinking, floating point is less risky because there is both range and precision available. But SMPS math tends to end up so simple you can easily add range checks and verify max/min values.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: January 13, 2021, 07:56:58 pm
content: If you like STM32, then have a look at "STSPIN".Those are a line of uC specifically designed for 3-phase motors, and for that they have some very nice extra's:* Built in SMPS for the uC power.* Built in high side and low side Gate drivers for external fets.* Built in opamps.

author: vectorotter
author_rank: Contributor
timestamp: January 14, 2021, 06:38:26 am
content: Quote from: Doctorandus_P on January 13, 2021, 07:56:58 pmI'll check them out. Thanks. I was just considering how to get some auxiliary power for the uC !