Digital Power-Conversion For The Analog Engineer
Digital Power-Conversion For The Analog Engineer
By
Bryan Kris
Staff Architect, Architecture & Applications
Digital Signal Controller Division
Microchip Technology Inc.
It is no secret that, in the past, analog engineers have struggled with complexity
when designing power supplies that require multiple outputs, coordinated load
sharing, hot-swap capability, or extensive fault handling. Using analog circuitry
to implement system control functions is not always cost-effective or flexible.
A new breed of digital signal controllers (DSCs) is now making digital conversion
possible with features such as intelligent power peripherals that combine
counter-based pulse-width-modulation (PWM) modules, analog comparator-
based feedback and coordinated analog-to-digital converter (ADC) sampling,
coupled with fast multiplication in a single clock cycle. The combination of these
features allows DSCs to handle the high execution rates needed for control-loop
software.
In current-mode control, the difference between the desired and actual output
voltage (error) creates a threshold for an analog comparator to set the peak
inductor current, in an effort to control the average inductor current.
The next step is to choose a DSC that meets all or most of your chosen
design requirements.
Figure 1: Synchronous Buck Converter
The ideal output voltage for a Buck converter is the product of the input voltage
multiplied by the duty cycle of the transistor. By inspection (see Figure 1), the
output voltage will equal the input voltage, if transistor Q1 is always turned on. If
Q1 is always off, then the output voltage will be zero. In reality, there are voltage
drops across the transistor and the inductor that increase when the load current
rises.
We can now begin to design a digital SMPS control system using DSCs (see
Figure 2).
Figure 2:
In this typical SMPS control system for a synchronous buck converter, note
carefully that there are delays associated with each block in this diagram.
Total control-loop delay is the sum of the ADC sample and convert time (500 ns),
the PID calculation time (1 µsec), the PWM output delay (0), the transistor
switching time (50 ns) and the PID execution-rate period (2 µsec). The total loop
delay in this example is 3.65 µsec, which implies the maximum effective control-
loop sampling rate of 274 kHz.
The most basic PWM mode is the standard edge-aligned PWM, where the ratio
of the on time versus the off time controls the flow of power. Only one of the
PWM outputs per output pair is used in these Asynchronous Buck, Boost and
Flyback converter circuits.
Our Synchronous Buck Converter uses a complementary PWM mode, where the
complementary output controls a “synchronous switching” rectifier that is
implemented with a MOSFET, instead of the typical rectifier. The complementary
PWM mode can also be used in other circuits that use synchronous rectification
to improve system efficiency.
Push-pull converters are commonly used in DC/DC converters and AC/DC power
supplies. The term “multiphase PWM” describes multiple PWM outputs that are
not edge-aligned. Multiphase converter circuits are often used in DC/DC
converters that must supply high current in applications where the load may
change very rapidly.
Phase-shifted PWM mode is becoming more common because of its wide use in
personal computer power supplies. Microchip’s dsPIC DSC SMPS family
supports all of the known PWM modes currently in wide use by the power-supply
industry.
If a PWM module does not have enough resolution, the control system (hardware
or software) will dither the PWM outputs to achieve the desired average output.
In power-supply applications, PWM dithering can create problems with ripple
currents, and cause the control to enter a bad mode of operation called “Limit
Cycling.”
For example, consider a PWM that can output values of 3 and 4 while the
control-loop needs an output value of 3.25. In this case, the PWM dithers
between the values 33343334. This is easily put into perspective – many DSCs
offer PWM counters that operate in a range from 40 to 150 MHz, yielding PWM
resolutions of 6 to 25 ns. The SMPS dsPIC DSC family features a duty cycle
resolution of 1 ns.
You can apply your analog insights to intelligent power-supply design using
DSCs. The on-chip ADC provides the system status (feedback) to the control-
loop. Conventional ADCs are designed with an assumption that the ADC values
are collected and processed in a “group.” ADCs in audio processing and
industrial control systems typically function in this manner. Group sampling
causes the processor workload to peak in groups, and this increases control-loop
latency.
Often in SMPS circuits, the analog signal to be sampled and converted does not
exist, or may not be significant at all times. The signal may only be important at
specific points in the PWM cycle. Standard ADC modules may, therefore, miss
the desired data due to imprecise sample timing.
Figure 3: The importance of ADCs with individual sample-and-holds (S & Hs).
Figure 3, above, shows an example circuit where a current-sense resistor is used
to monitor current flow. In this circuit, the current can be sensed only when the
transistor is turned on. Typical ADC modules cannot accurately command the
sample-and-hold circuit to take a sample at the appropriate time. If the
application has multiple circuits to sense, then the ADCs are inadequate.
The ADC module onboard the SMPS dsPIC DSC provides independent sample-
and-hold circuits that can sample independently of each other. It can therefore
monitor voltages or currents at precise times, which enables event transitory
signals to be sampled. This ability to can reduce system costs. In addition, the
ADC onboard the SMPS dsPIC devices can sample asynchronously, enabling it
to support multiple control loops operating at different frequencies, such as PFC
(70 kHZ) and DC/DC (250 kHz).
PID Algorithm
Using the PID algorithm, the proportional, integral and derivative errors of the
actual versus the desired output voltage are combined to control the PWM duty
cycle. The PID algorithm can be used in both voltage- and current-mode control
loops.
Many analog engineers think that complex DSP programming skills are required
to handle the DSP-like architecture involved with these DSCs. However, this is
not the case. In fact, DSP skills are not needed to handle Microchip’s DSCs (see
code listing in Figure 5, below). The central “core” of the control software (Figure
4) is the PID loop. The PID software is typically small -- one or two pages of
code -- but its execution rate is very high, often hundreds of thousands of
iterations per second. This high iteration rate requires the PID software routine
be as efficient as possible to maximize performance. Using an assembler is a
good method to insure “tight code”.
The idle loop is entered after completion of the system and peripheral
initialization tasks. Typically, the idle loop monitors temperature, calculates the
“feed-forward” terms, and checks for fault conditions.
The SMPS software implements the control algorithm, with the ADC interrupt-
driven PID loop as its most time-critical portion. The PID software should use no
more than approximately 66% of the available processor bandwidth, so that the
remainder of the computing resources can be allocated to the idle loop software.
Assuming 30 MIPS operation with the PID loop (comprising 30 instructions), the
execution time is approximately 1 µsec. If the iteration rate is 500 kHz (2 µsec),
then the PID workload consumes one-half of the available processor bandwidth,
or 15 MIPS.
CALCULATE_PID:
push.s ; Save SR and W0-W3
bclr.b IFS0+1, #3 ; Clr IRQ flag in interrupt controller
mov #PID_REG_BASE, w8 ; Init pointer to PID register block
mov #PID_GAIN_REG_BASE, w10 ; Init pointer to PID gain register block
SUM_PID_TERMS:
clr A, [w8]+=2, w6, [w10]+=2, w7 ; clr A, prefetch w6, w7
mac w6*w7, A, [w8]+=2, w6, [w10]+=2, w7 ; MAC proportional term and gain
mac w6*w7, A, [w8]+=2, w6, [w10]+=2, w7 ; MAC derivative term and gain
mac w6*w7, B, [w8]+=2, w6, [w10]+=2, w7 ; Update Integrator
add ACCA ; Add ACCB (Integrator) to ACCA
sftac A, -#8 ; scale accumulator (shift)
mov ACCAH,w0 ; Read MSW of acca (result)
btst ACCAU,#7 ; Check sign bit of ACCA
bra z, OUTPUT_PWM ; Branch if acca PWM value is positive
clr w0 ; Clear negative PWM values
OUTPUT_PWM:
mov w0, DC1 ; Output new duty cycle value
pop.s ; Restore SR, w0-w3
retfie ; Return from Interrupt
Figure 5:
This code listing shows an example of the PID software for a digital-mode Buck
converter. Although the PID software would not change for most SMPS
topologies, the initialization code may need to be changed for the peripheral
modules.
An evaluation board enables designers to test, modify the SMPS control software
and understand SMPS design principles. In this case, you may consider
Microchip’s dsPICDEM™ SMPS Buck Development Board (see Figure 6) -- a
rugged, low-power, DC/DC Buck converter to evaluate the DSC device and
control software. The board derives its input power by the standard AC/DC 9V,
0.75A power-supply. Two independent buck converters are available on this
board, and the demonstration software is set-up to provide +5V and +3.3V
output.
Figure 6: Microchip’s dsPICDEM™ SMPS Buck Development Board
This board accepts an input voltage ranging from 8 – 14V DC. The output loads
should be limited to 0.75A each, and input power can be supplied through either
the coaxial input-power connector J2 or the test clip connections P1 and P2.
This board also provides a dynamic load for the +5V output. This load is driven
by a 1 kHz square wave signal that is generated by the output compare module.
The onboard dynamic load uses a FET to connect a resistor load to the converter
output to ground and enables converter stimulation so that the converter’s
dynamic behavior can be measured. The use of dynamic loads is user-
selectable via jumper blocks and/or software.
Power-supply designers can easily add new features and capabilities to their
designs using the latest DSCs available for digital loop control. Complex digital
signal processor (DSP) processing skills do not need to be learned in order to do
this -- rather, using familiar analog components and software, designers can
quickly and cost-effectively build more intelligence into their power supplies using
DSCs.
Note: The Microchip name and logo, dsPIC, PIC, and MPLAB are registered trademarks of Microchip
Technology Inc. in the USA and other countries. dsPICDEM is a trademark of Microchip Technology Inc. in
the U.S.A. and other countries. All other trademarks mentioned herein are property of their respective
companies.