network-enabled high performance triple conversion ups
TRANSCRIPT
Freescale SemiconductorApplication Note
AN3113Rev. 1, 07/2005
© Freescale Semiconductor, Inc., 2005. All rights reserved.
Preliminary
Network-Enabled High Performance Triple Conversion UPSVenkat Anant
We wish to thank Diego Garay, Jorge Zambada, and LuisReynoso for their contributions that comprised a significantportion upon which this application note was generated.
1. IntroductionThe main purpose of an Uninterruptible Power Supply (UPS) isto provide clean and stable power to a load, regardless of powergrid conditions such as black-outs. Uninterruptible PowerSupplies have been widely used for office equipment, computers,communication systems, medical/life support and many othercritical systems. Recent market requirements include a targetexpectation for UPS reliability of 99.999% power availability,performance demands of zero switch over time, and complexnetwork connectivity and control methods, such as SimpleNetwork Management Protocol (SNMP).
Presently, a UPS is often implemented with an MCU. But MCUshave significant price/performance limitations that can berectified by implementing the UPS using a hybrid MCU withefficient digital signal processing capability. This has not beenpossible until recently, due to performance and the cost of theprocessors required to do the job. The 56F8300 series of digitalsignal controllers has the required performance, peripherals, andprice targets to enable UPS designs to implement advancedfeatures.
Contents
1. Introduction ......................................... 1
2. Freescale Semiconductor’s Solution ... 1
3. Advantages and Features of Freescale’s Controller .................... 3
4. Online UPS Theory and Description .. 5
5. Control Loops In The Online UPS ... 33
6. Control Board Design Considerations ............................. 41
7. Control Software Design Considerations ............................. 55
8. Connectivity Software Design Considerations ............................. 79
9. Results ............................................... 86
10. References ....................................... 95
Freescale Semiconductor’s Solution
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
2 Freescale Semiconductor Preliminary
2. Freescale Semiconductor’s SolutionThe digital 56800/E network-enabled high-performance UPS reduces system component count, increasessystem reliability, and enables advanced functions while reducing cost. Key advantages of thisdigitally-controlled UPS include:
• Single-device solution which combines MCU functionality and DSP processing power• Bidirectional AC/DC conversion• High input power factor with Direct PFC and lower power pollution to the power grid• Extended battery life and lower maintenance costs• Power source and load conditioning can be monitored in real time• Network communication for remote control and monitoring• Expedites time-to-market using out-of-the-box software components
The functional blocks of the on-line triple conversion UPS are shown in Figure 2-1.
Figure 2-1. On-line Triple Conversion UPS Block Diagram
ADC
Input
ADC
Input
ADC
Input
ADC
Input
ADC
InputPWM
0, 1
Fault
0
ADC
Input
AC
InputRectifier
andPower Factor
Correction
Battery
PWM
2, 3
Fault
1
Over
Current
PWM
4, 5
Fault
2, 3
DC to ACInverter
LCFilter
Over
Voltage
and
Over
Current
Current
Feedback
Voltage
Feedback
Bypass Switch (Option)
2 2 2 2
DC
DC
External Memory Interface
CS8900
Ethernet
LAN Controller
LCD
Controller
SCI CAN SPI
802.15
Controller
RS232
Physical
Drive
CAN
Physical
Drive GPIOs
WirelessCAB busRS232
Device
56F8300
56F8346, 56800E Core Family
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
Freescale Semiconductor 3Preliminary
During normal operation, the AC input voltage is rectified by an AC/DC converter that rectifies the inputvoltage and regulates the input power factor. The output of the AC/DC converter is a DCBus voltage that isused as the source for both the battery charger and DC/AC inverter. The battery charger is a boost/buck DC/DCconverter. When the system is charging the batteries, the DC/DC converter works in buck mode, which stepsthe high DCBus voltage down to the batteries’ acceptable voltage level and charges the batteries. When thebattery pack is fully charged, the converter switches to stand-by mode. If an input power failure occurs, theDC/DC converter works in boost mode, which supplies power to the DCBus from the batteries. The DC/ACinverter is used to convert the DC voltage to approximated sinusoidal output voltage pulses. The pulse string isinput to an LC filter, which generates a true sinusoidal output voltage that is supplied to the load. The user canselect the frequency of the sinusoidal output voltage and the frequency can either be synchronized to the inputvoltage frequency or any other desired independent stable frequency. When any failures or faults are generatedor maintenance is needed in the UPS system, the bypass switch will be engaged, which turns the UPS systemoff and connects the load directly to the input power source. All necessary control functions are implementedwithin the controller, such as:
• Power on/off control• DCBus voltage regulation• Input power factor correction• Battery management• AC output voltage regulation• Frequency synchronization of input and output• Power source monitoring• System self diagnostics and self protection• Emergency event processing• Real-time multi-tasking system operation• Communication protocols
3. Advantages and Features of Freescale’s ControllerThe Freescale 56F8300 (56800E core) family is well suited for UPS design, combining the DSP’s calculationcapability with an MCU’s controller features on a single chip. These controllers offer many dedicatedperipherals, including Pulse Width Modulation (PWM) units, Analog-to-Digital Converters (ADC), timers,communication peripherals (SCI, SPI, CAN), on-board Flash and RAM. Generally, all the family members areappropriate for use in UPS design.
The following section uses a specific device to describe the family’s features.
3.1 56F8346, 56800E Core FamilyThe 56F8346 provides the following peripheral blocks:
• Two Pulse Width Modulator units (PWMA and PWMB), each with six PWM outputs, three Current Sense inputs, and three Fault inputs for PWMA/PWMB; fault-tolerant design with dead time insertion, supporting both center-aligned and edge-aligned modes
• Two 12-bit Analog-to-Digital Converters (ADCs), supporting two simultaneous conversions with dual 4-pin multiplexed inputs; the ADC can be synchronized by PWM modules
Advantages and Features of Freescale’s Controller
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
4 Freescale Semiconductor Preliminary
• Two Quadrature Decoders (Quad Dec0 and Quad Dec1), each with four inputs, or two additional Quad Timers, A & B
• Two dedicated general purpose Quad Timers totaling three pins: Timer C, with one pin and Timer D, with two pins
• CAN 2.0 B-compatible module with 2-pin ports used to transmit and receive• Two Serial Communication Interfaces (SCI0 and SCI1), each with two pins, or four additional GPIO
lines• Serial Peripheral Interface (SPI), with a configurable 4-pin port, or four additional GPIO lines• Computer Operating Properly (COP) / Watchdog timer• Two dedicated external interrupt pins• 61 multiplexed General Purpose I/O (GPIO) pins• External reset pin for hardware reset• JTAG/On-Chip Emulation (OnCE)• Software-programmable, Phase Lock Loop-based frequency synthesizer for the controller core clock• Temperature Sensor system
3.2 Peripheral DescriptionPWM modules are the controller’s key features enabling UPS control. Each PWM is double-buffered andincludes interrupt controls. The PWM module provides a reference output to synchronize theAnalog-to-Digital Converters. The PWM has the following features:
• Three complementary PWM signal pairs, or six independent PWM signals• Features of complementary channel operation• Dead time insertion• Separate top and bottom pulse width correction via current status inputs or software• Separate top and bottom polarity control• Edge-aligned or center-aligned PWM signals• 15-bit resolution• Half-cycle reload capability• Integral reload rates from 1 to 16• Individual software-controlled PWM outputs• Mask and swap of PWM outputs• Programmable fault protection• Polarity control• 20mA current sink capability on PWM pins• Write-protectable registers
The UPS utilizes the PWM block set in the complementary PWM mode, permitting generation of controlsignals for all switches of the power stage with dead time insertion.
Introduction
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
Freescale Semiconductor 5Preliminary
The Analog-to-Digital Converter (ADC) consists of a digital control module and two analog Sample and Hold(S/H) circuits. The ADC features:
• 12-bit resolution• Maximum ADC clock frequency is 5MHz with 200ns period• Single conversion time of 8.5 ADC clock cycles (8.5 x 200ns = 1.7µs)• Additional conversion time of 6 ADC clock cycles (6 x 200ns = 1.2µs)• Eight conversions in 26.5 ADC clock cycles (26.5 x 200ns = 5.3µs) using simultaneous mode• ADC can be synchronized to the PWM via the sync signal• Simultaneous or sequential sampling• Internal multiplexer to select two of eight inputs• Ability to sequentially scan and store up to eight measurements• Ability to simultaneously sample and hold two inputs• Optional interrupts at end of scan, if an out-of-range limit is exceeded, or at zero crossing• Optional sample correction by subtracting a preprogrammed offset value• Signed or unsigned result• Single-ended or differential inputs
The Quad Timer is an extremely flexible module, providing all required services relating to time events. It hasthe following features:
• Each timer module consists of four 16-bit counters/timers• Counts up/down• Counters are cascadable• Programmable count modulo• Maximum count rate equals peripheral clock/2 when counting external events• Maximum count rate equals peripheral clock when using internal clocks• Counts once or repeatedly• Counters are preloadable• Counters can share available input pins• Each counter has a separate prescaler• Each counter has capture and compare capability
4. Online UPS Theory and Description
4.1 IntroductionUninterruptible Power Supplies (UPS) are electronic devices designed to provide power to critical missionsystems. An Online UPS (OUPS) provides continuous power to the load during power outage or glitchescaused by power source switching.
Online UPS Theory and Description
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
6 Freescale Semiconductor Preliminary
4.1.1 The Concept of an Online UPSThe minimum components needed to design an Online UPS are the rectifier, the battery bank and the inverter.The rectifier converts the distribution line’s AC (Alternating Current) power to DC (Direct Current) power, theform of current suitable to store energy in a battery bank. At all times, this DC is also fed to an inverter, whichreconverts the DC power to an AC waveform connected to any equipment utilizing AC that a user considers asmission critical. If the AC supply fails for any reason, the inverter will continue to draw power from thebatteries.
Figure 4-1. A Basic Online UPS
4.1.2 Input Power Factor Control (PFC)When a sinusoidal input signal is connected to a full wave rectifier, conduction will occur only during thepeaks of the signal. This causes a two-fold inconvenience to the electricity distribution line:
• Insertion of harmonics to the lines• High current peaks, which imply greater losses on the distribution
These effects are aggravated by the long distances the electric distribution networks usually span.
From the electrical utility’s point of view, the best possible load is the pure resistive: The current waveformshould be a pure sinusoidal waveform identical to the voltage waveform and of the same frequency and phase.
In order to show a resistive load to the utility lines, the input current to the UPS is controlled (i.e., modulated)to make it match a set point. This set point depends on the input voltage waveform, and its amplitude isdependent on the equipment’s power consumption.
4.1.3 DC/DC ConvertersIf a rectifier is connected to the AC line supply, then the DC voltage will be equal to the peak voltage of theline. (i.e., in a 120 VRMS line, the peak will be 120√2, 170V). If the battery bank is configured for 12 or 24VDC, the UPS works by using DC/DC converters.
For an online UPS, two power DC/DC converters are required. One converter operates as the battery charger,and the other boosts the battery voltage in the absence of line input and generates the appropriate DC requiredby the inverter.
Introduction
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
Freescale Semiconductor 7Preliminary
4.1.4 Phase Locked Loop (PLL)This UPS can operate in the Free Running mode or in the Locked-to-Line mode. If the AC main line frequencyis at the nominal value of 50Hz or 60Hz ± 5%, the PLL locks the inverter output to the line. If the AC main linefrequency runs out of limits for any reason, the UPS will automatically switch to run locked to the internalfrequency reference.
The UPS will also work in the Free Running mode if commanded to operate as a frequency converter. Forexample, it can connect to a 60Hz AC main line frequency and output a signal of 50Hz frequency, and viceversa.
The purpose of phase locking the inverter to the line input is to enable the automatic bypass feature and toavoid signal “mixing” at the rails. These two features are detailed in the following sections.
4.1.5 Bypass OperationIn order to allow a UPS bypass without loss of power at the load, two conditions must be met:
• The inverter output must be locked to the frequency and phase of the AC main line• The inverter output and the AC main line’s RMS voltages must be within 10% of one another
When the bypass conditions are met, the bypass switch can transfer the load to the AC main line in the event ofa UPS failure or when commanded by the operator during routine maintenance. It can also switch the load backto the inverter after any maintenance.
4.1.6 Rail RippleThe energy to support the load is stored in the rail capacitors. These capacitors are current-fed by the PFCcircuitry in the Online mode or by the battery booster in the Battery Back-up mode.
In the Online mode, a ripple with the phase and twice the frequency of the AC main line will be present at therails, superimposed with a ripple with the phase and twice the frequency of the inverter current. In thissituation, if a frequency offset ∆f is present, lower-order components can appear. Locked operation is preferredto minimize the effects of frequency mixing.
4.1.7 Pulse Width Modulation (PWM)High-power control requires switchable electronic devices, precluding their use in the active region, wherepower dissipation in the device is very high. For this reason, control is made by pulse width modulation, wherethe duty cycle of a signal is modified, then a linear filtering device passes the desired signal value to the analogcomponents. PWM is then used to implement inverters, PFCs, and DC/DC converters.
4.1.8 A Controller Solution to Control a UPSThe control system for a UPS must accomplish the following functions:
• Control strategies for inverter, PFC, PLL, and DC/DC converters. Every control loop starts at an Analog-to-Digital Converter (ADC) in order to sense the signals, and ends at a Pulse Width Modulator as an actuator.
• Deciding when to activate or deactivate a component• Detecting failure conditions and implementing any required action• Enabling Monitor and Control (M & C) communications
Online UPS Theory and Description
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
8 Freescale Semiconductor Preliminary
Compared to traditional analog controls, today’s low-cost and high-performance controllers provide a bettersolution in performance and cost. A single MCU includes a powerful processor core and such peripherals asPWMs, Timers, and Analog-to-Digital Converters. A single 56800E device is able to assume the monitoringand real-time control required by an Online UPS.
4.2 System OverviewFigure 4-2 depicts a simplified UPS system.
Figure 4-2. Simplified UPS Schematic
Figure 4-3 shows a photo of a completed UPS prototype. The system’s power electronics and ferromagneticcomponents are detailed on the left side of the the figure.
System Actuators
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
Freescale Semiconductor 9Preliminary
Figure 4-3. Prototype UPS
4.3 System ActuatorsA simplified schematic of the controller’s relationship with actuators is shown in Figure 4-4, where allswitches represent MOSFETs or IGBTs.
Figure 4-4. Relationship between a 56800E and Power Actuators
56800E Controller
Online UPS Theory and Description
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
10 Freescale Semiconductor Preliminary
Figure 4-5. Simplified Schematic Diagram of the UPS
4.4 Input Rectifier Theory of OperationThe input rectifier is implemented as a four-diode bridge (X1, X2, D24, and D23). A soft start systemimplemented with SCRs can prevent a huge in-rush current when the system starts, while the system’s internalcapacitors get charged to the line’s peak voltage.
Input Rectifier Theory of Operation
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
Freescale Semiconductor 11Preliminary
Figure 4-6. Input Rectifier
4.4.1 Rectifier Soft StartIf a high voltage is applied to a discharged capacitor, its low impedance will result in a very high inrush currentacross the circuit, reducing the components’ longevity.
A soft start circuit is designed to avoid that circumstance. Figure 4-7 shows a full wave-controlled rectifierbridge. If the trigger angle of X1 and X2 is gradually decreased from the zero crossing towards the peakvoltage, as demonstrated in Figure 4-8, the capacitor voltage will then increase slowly. As the current on acapacitor equals the capacitance value times the voltage derivative with respect to time, the input current willbe proportional to the slope of the voltage applied to the capacitor.
Figure 4-7. Full Wave-Controlled Rectifier Bridge
Online UPS Theory and Description
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
12 Freescale Semiconductor Preliminary
Figure 4-8. Relationship between Rectifier Soft Start Operation / Actuator Signals and the AC Main Line Voltage
4.5 Power Factor Corrector (PFC) Theory of OperationAfter the rectifier soft start finishes, X1 and X2 must act as diodes with continuous triggers. When no PFC isimplemented, the line current will be similar to that shown in Figure 4-9, due to the diode–capacitor nature ofa rectifier.
The objective of the PFC circuit is to simulate a resistive load to the power line; in other words, to obtain aunity power factor and low harmonic content in the current waveform. A fast control must be implemented inorder to make the current waveform follow the AC voltage, while elevating and controlling the rail voltage andsupplying the average power required to the load. Figure 4-10 shows how the PFC works, illustrating a currentsignal waveform similar in form to the voltage waveform. The ripple in the figure is a consequence of theIGBT high frequency switching.
Power Factor Corrector (PFC) Theory of Operation
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
Freescale Semiconductor 13Preliminary
Figure 4-9. Typical Rectifier Current vs. AC Line Voltage
Figure 4-10. PFC Current and Voltage Waveforms
Online UPS Theory and Description
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
14 Freescale Semiconductor Preliminary
Once the voltage on capacitors C3, C7, and C8, shown in Figure 4-11, reach the AC main supply peak after therectifier soft start, the PFC is turned on, correcting the power factor presented to the line and generating the railDC voltages VP and VN at a value higher than the line peak.
Figure 4-11. PFC Schematic
In order to work as a PFC, U1 and U2 in Figure 4-11 turn on and off in complementary mode. When U1 is on,U2 is off, and vice versa.
The switching frequency of operation is 20kHz. The line nominal frequencies are 50Hz or 60Hz, so it is a validapproximation to consider the line voltage as a constant during a switching period. For positive values of theline, when U2 is on (closed) and U1 is off (open), the circuit reduces to that shown in Figure 4-12, where C3 isconnected in parallel to C8, causing the voltages on these capacitors to be the same, thus reducing the ripplevoltage on C8.
Figure 4-12. Partial PFC Schematic when U1 Is Open and U2 Is Closed
Power Factor Corrector (PFC) Theory of Operation
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
Freescale Semiconductor 15Preliminary
For positive values of the line, when U1 is closed and U2 is open, the circuit reduces as shown in Figure 4-13.C3 is now connected in parallel to C7, thus reducing its ripple voltage. The line is applied directly to L1,increasing the current across it with a constant slope, because line voltage could be considered constant, andthe inductor current, which corresponds to the current in the line (ILINE), depends on the voltage across itsterminals.
Figure 4-13. Partial PFC Schematic when U1 Is Closed and U2 Is Open
Inductor current is calculated by the equation:
where:VL1 is the voltage across the inductor terminals
The peak current across the inductor at time t2 depends, among other factors, on the instant value of the linevoltage and the time difference t2 – t1, which is the time that U1 remains closed.
∫=∆ 2
11
t
t Lline dtVL1I
Online UPS Theory and Description
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
16 Freescale Semiconductor Preliminary
Figure 4-14. Resulting Parallel Connection between C3 and C7
The voltage-boosting characteristic of the PFC is accomplished by increasing the voltage across C3 (andconsequently, across C7 and C8). Given that a current is circulating in the inductor L1, when U1 opens, thevoltage across L1 adds to the line voltage as shown in Figure 4-15. This forces D24 into a conduction state andC3 and C8 to charge to the addition of the line and the inductor terminal voltage, VL1. This is a typical boostconfiguration.
Figure 4-15. Voltage Boost across Capacitors C3 and C8
Due to symmetry, this circuit works in the same way for negative values in line voltage.
Battery Booster Theory of Operation
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
Freescale Semiconductor 17Preliminary
4.6 Battery Charger Theory of OperationFigure 4-16 has been extracted from the UPS schematic shown in Figure 4-5. Using the high DC voltages VPrail positive and VN rail negative as its power sources, this circuit provides the charge conditions for a batterybank formed by two 12V batteries connected in series, which must be charged with constant current. When thefloat condition is reached, the charger must preserve a constant voltage while providing the battery bank’sself-discharge current.
Figure 4-16. Battery Charger Schematic
The battery charger is an application of a two-transistor flyback configuration using a coupling inductor ratherthan a transformer. Because this operating mode implies no flow of current in the secondary when the primaryhas a non-zero current, and vice versa, it means that no current flows simultaneously in both windings.
Figure 4-16 shows a two-transistor version of a flyback converter, where U5 and U6 are simultaneously turnedon and off. The advantage of such a topology over a single-transistor flyback converter is that the switches’voltage rating is VP - VN. Moreover, since a current path exists through the diodes D18 and D19, which areconnected to the primary winding, a dissipative snubber across the primary winding is not needed to dissipatethe energy associated with the transformer primary-winding leakage inductance.
The design, calculations and construction of TX1 are critical in order to prevent the reflected voltage fromsecondary to primary rising higher than VP - VN when D22 is on.
4.7 Battery Booster Theory of OperationThe battery booster is a DC/DC converter and transforms the battery voltage of 24VDC to the requireddifferential 440VDC between rails. The rails are symmetric, implying VP = 220VDC at the positive rail, andVN = -220VDC at the negative rail, as shown in Figure 4-17.
Although the topology of Figure 4-17 is usually called “booster” because its output voltage is higher thaninput voltage, it is actually a push-pull converter with an arrangement of two forward converters workingalternatively and a transformer to increase the output voltage.
Online UPS Theory and Description
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
18 Freescale Semiconductor Preliminary
Figure 4-17. Battery Booster Schematic
The switches U9 and U10 cannot be closed at the same time. Typical drive signals are illustrated inFigure 4-18.
Figure 4-18. Drive Signals for Battery Booster Switches
Using a control signal like the one shown in Figure 4-18, the waveforms at the transformer secondary over L10and L9 are illustrated with positive and negative values of voltage in Figure 4-19.
Battery Booster Theory of Operation
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
Freescale Semiconductor 19Preliminary
Figure 4-19. Signals at Transformer Secondary Windings L10 and L9
C9 remains charged to VBAT and is added because the coupling factor is not equal to one, implying that aleakage inductor must be considered. C9 acts as a snubber, creating a current path to avoid an uncontrolledvoltage peak at the primary windings of the transformer.
The four diodes D25, D26, D27 and D28 form a conventional full-wave rectifier bridge and generate onlypositive values in the cathodes of D25 and D27 and negative values at the anodes of D26 and D28, as shown inFigure 4-20.
Online UPS Theory and Description
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
20 Freescale Semiconductor Preliminary
Figure 4-20. Signals at the Cathode of D25 and Anode of D26
The objective of DC/DC converters is to generate a DC voltage. In order to filter any undesirable ACcomponents, two LC filters are added:
• L7 - C7 for the negative rail• L6 - C8 for the positive rail
Inverter Theory of Operation
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
Freescale Semiconductor 21Preliminary
4.8 Inverter Theory of Operation
Figure 4-21. Inverter Schematic Diagram
The chosen inverter configuration is a half-bridge monophasic circuit. It must generate a low-distortionsinusoidal waveform in the output terminals from the VP and VN DC rail voltages. To produce such a signal,VP and VN must be higher than the AC positive and negative peak voltages, respectively.
Consider a switching period of T seconds. Assume that U8 is closed during TP seconds, while U7 is open.During the remaining T – TP seconds, U7 is closed and U8 open. If the cutoff frequency of the low-pass filtercomposed by inductor L5 and C6 is low enough to reject the 1/T Hz switching frequency, then the outputapproximates to:
where:
tp/T is the duty cycle of the control signal
The expression simplifies to :
As 1/T = 20kHz is much higher than 50Hz or 60Hz, then the output voltage will result proportional to TP, andthe sinusoidal signal can be considered constant during T seconds.
⎟⎟⎠
⎞⎜⎜⎝
⎛−+=
Tt
1VTt
VV pN
pPo
kHz20T1,1
Tt p =<
( )N
pNPo V
Tt
VVV +−=
Online UPS Theory and Description
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
22 Freescale Semiconductor Preliminary
4.9 Pulse Width ModulationIf a sinusoidal reference signal is compared to a symmetric triangle wave, the resulting signal is pulse widthmodulated, as shown in Figure 4-22. The triangle waveform frequency corresponds to the PWM switchingfrequency.
Figure 4-22. Generation of a PWM Signal
4.10 Auxiliary CircuitsAdditional circuits are required to make the complete system operational and include:
• Power supplies• Signal sensing circuitry• Limiters• Isolation circuits• Driver circuits for SCRs, NMOSFETs and IGBTs
4.10.1 Power Supplies and Isolation CircuitryThis system requires multiple power supplies with floating references. The typical configuration is shown inFigure 4-23, and consists of a flyback converter similar to the one used in the battery charger. A 100kHzswitching signal with a duty cycle of 35% is provided by the 56800E controller and applied to an NMOStechnology H bridge.
Auxiliary Circuits
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
Freescale Semiconductor 23Preliminary
Figure 4-23. H Bridge Configuration Providing Multiple Floating Power Supplies
The output of the isolating transformer is half-wave rectified and applied to the load. Positive and negativevoltages are generated. The 39Ω resistor limits the current of the transformer’s secondary when M1 and M2 areon. Resistors RL1 and RL2 represent the load.
All isolated power supplies are connected in parallel to the rail voltage, depicted as nodes A and B inFigure 4-23.
Online UPS Theory and Description
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
24 Freescale Semiconductor Preliminary
Figure 4-24. Waveforms at A and B
While M1 and M2 are on, VCC is connected directly to the primary, increasing the current linearly, as shown inFigure 4-25. Cn is simultaneously charging across Dn. The 39Ω resistor acts as a current limiter. M1, M2, Dp,Cp, and the transformer shape a traditional flyback power supply.
Figure 4-25. Current Waveforms
Auxiliary Circuits
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
Freescale Semiconductor 25Preliminary
When M1 and M2 are off, an inverted voltage is induced in the primary and D1, D2 which limit that voltage to15V plus 1.2 from two diode junctures, turning Dp on and charging Cp.
There are several transformers connected to the rails A and B which generate isolated power supplies to driveSCRs, IGBTs, and MOSFETs used in the rectifier, inverter, battery charger, and battery booster.
Figure 4-26 shows the control power supply, which uses a LM2576 step-down voltage regulator, to generate+VCC = 15V fed by the redundant DC voltage coming from 18VAC or +VBAT or an additional power supplyVDCR coming from the battery charger. This circuit also generates the Control Board Power Supply, which isisolated from +VCC.
Figure 4-26. Control Power Supply
4.10.2 Sensing Circuits and Reference Voltage GeneratorAll signals that require sensing as voltages, currents, and temperature at the Analog-to-Digital Converters areconverted to the appropriate input levels and diode-limited to avoid damage to the ADCs; this process usesdifferential amplifiers as seen in Figure 4-28, because of the different ground references shown inFigure 4-27.
Online UPS Theory and Description
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
26 Freescale Semiconductor Preliminary
Figure 4-27. Partial View of the Auxiliary Power Supply and Optoisolation Network
Figure 4-28. A/D Sensing Circuitry
Controller
Auxiliary Circuits
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
Freescale Semiconductor 27Preliminary
Figure 4-29. General Design of the Sensing Circuits
The value of the resistors required to sense every signal is calculated in order to guarantee full swing,minimizing analog and quantization noise at the ADCs.
The reference level of the ADC is used to shift the AC input signal to swing from 0 to VRH (i.e., 0 volts in theinput signal are mapped to VRH/2). If the output of the operational amplifier tends to go out of limits for anyreason, the diodes protect the ADC inputs.
4.10.3 Voltage Reference SupplyThe voltage reference, VRH, is generated by the circuit shown in Figure 4-29. This circuit acts as a buffer tothe reference voltage VREFH from the controller. This circuit also generates two auxiliary voltage outputs:
• VA equal to one diode voltage Vγ• VB with value VRH-Vγ
These voltages will be used to limit the values of voltage applied to A/D modules inside the controller.
Online UPS Theory and Description
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
28 Freescale Semiconductor Preliminary
Figure 4-30. Voltage Reference Generator
4.10.4 Silicon Controlled Rectifier (SCR) Gate DriversThe circuit in Figure 4-30 shows the basic driver which handles the SCRs’ gates using an 4N35 optocoupler togenerate an isolated current supply to trigger the rectifier’s SCRs.
Figure 4-31. SCR Gate Driver
Power Transfer Circuits (Bypass) Theory of Operation
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
Freescale Semiconductor 29Preliminary
4.10.5 IGBT and MOSFET Gate Drivers CircuitFigure 4-32 illustrates the basic isolated circuit implemented to drive the IGBT’s and MOSFET’s gates. It isbased in an HCPL 3101 gate drive optocoupler.
Figure 4-32. IGBT and MOSFET Gate Driver
4.11 Power Transfer Circuits (Bypass) Theory of OperationUnder normal conditions, the UPS inverter feeds all power to the load. However, in order to ensure that theload is supported in the event of a failure, or during maintenance, the equipment must also allow for directconnection to the AC main line. A switching relay is connected as shown in Figure 4-33.
Figure 4-33. Bypass Relay Configuration
Online UPS Theory and Description
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
30 Freescale Semiconductor Preliminary
The relay’s transfer time must be shorter than a period of the AC line. A transfer time of less than 20ms is fastenough to comply with this constraint. The transfer is allowed if phase and voltage conditions are satisfied, asexplained in Section 4.1.4.
Figure 4-34 shows the circuit implemented to turn the bypass relay on and off using the BP1 signal. Pleasenote the three different grounds used in the system.
Figure 4-34. Relay Driver
4.12 Overcurrent ProtectionFigure 4-35 shows the rectifier and inverter current sensing circuit. Figure 4-36 shows the circuitsimplemented to sense the battery charger and battery booster currents. These circuits generate overcurrentsignals when the current value reaches a defined level. These two signals are connected directly to thecontroller’s FAULT 0 and FAULT 1 pins.
Overcurrent Protection
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
Freescale Semiconductor 31Preliminary
Figure 4-35. Overcurrent Protection for Rectifier and Inverter
Figure 4-36. Overcurrent Protection for Charger and Push-Pull
Online UPS Theory and Description
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
32 Freescale Semiconductor Preliminary
The battery charger overcurrent protection generates a fault signal, named “SIC”, which turns off the chargerPWM signal. Likewise, the battery booster’s overcurrent protection circuit generates the FPP signal, whichturns off the drive signal for the MOSFETs.
4.13 Battery Temperature SensingThe battery temperature sensing circuit is shown in Figure 4-37; it uses an LM-35-CZ, which is a precisioncentigrade temperature sensor. The output of this circuit is a voltage that is proportional to the temperature.This sensor must be located near the battery.
Figure 4-37. Battery Temperature Sensing Circuitry
Control Algorithms Discrete Equivalents
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
Freescale Semiconductor 33Preliminary
Figure 4-38. Battery Temperature Sensor
5. Control Loops In The Online UPSThe UPS’ control algorithms are digitally implemented. The topology chosen for the compensators is the PID(Proportional-Integral-Derivative) and the PI (Proportional-Integral), with a 3-bit resolution. All gain constantsare 16-bit implemented. The accumulators are all 32-bit, unless otherwise specified.
5.1 Control Algorithms Discrete EquivalentsAn ideal PID analog controller is expressed as follows:
⎟⎟⎠
⎞⎜⎜⎝
⎛⋅+
⋅+= s
sKsGc d
ip τ
τ11)(
Control Loops In The Online UPS
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
34 Freescale Semiconductor Preliminary
An appropriate technique to discretize this transfer function is the backward difference method, which is basedon numerical integration theory and has the following equivalence rule:
where:Ts is the sampling period
The PID transfer function in discrete time domain is:
It is implemented as follows:
where:
is the discrete time integrator gain
and
is the discrete time differential gain.
The proportional gain constant, KP, remains unmodified.
5.2 PFC and Rail ControlFigure 5-1 shows a simplified PFC control loop, valid only for positive AC line voltages. The PFC is a currentloop with a set point calculated as the product of the rail voltage control output times the AC line voltage.
The voltage control must keep a constant DC rail. V. Positive Rail is sensed and compared to Voltage Setpoint.The error signal then passes through a PI control network, which outputs one of the operands used to calculatethe current set point. The other operand is the AC Line Voltage, VLINE. This signal is then used as the set pointof a second PI control, which forms the current control loop.
sTz
dtds )1( 1−−→→
s
1dp
1i
sppc T
)z1(K)z1(
TKK)z(G
−
−
−⋅τ⋅+
−⋅τ⋅
+=
[ ])1()()()()(0
−−⋅+⋅+⋅= ∑=
kekeKjeKkeKkC D
k
jIP
i
spI
TKK
τ⋅
=
s
dpD T
KK
τ⋅=
PFC and Rail Control
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
Freescale Semiconductor 35Preliminary
Figure 5-1. PFC and Rail Control Loops (Positive Semicycle)
The goal of the rectifier stage is to maintain the rail DC voltage at ± 220V and to control the input current tomimic the voltage waveform (and thus to make the complete system appear as a resistive load to the AC mainline). In order to achieve these two goals, two control loops are required:
A current control loop, implemented with a PI controller, generates a current as required by the inputinductor. The circuit symmetry makes it possible to implement a control using the line voltage absolute valueto control the signal, regardless of its sign. A suitable controller for this application is a PI compensator withthe following parameters:
⎟⎠⎞
⎜⎝⎛
⋅+=
s0002.0114.6)s(Gc
Control Loops In The Online UPS
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
36 Freescale Semiconductor Preliminary
Using the backward difference method yields the following discrete time equivalent:
with :KP = 6.4andKI = 1.6
The second controller keeps the rail voltage constant and uses a low pass filter to reject the 60Hz and 120Hzripple. The process is much slower than any of these frequencies, and therefore should not attempt to correcthigher harmonic disturbances. The chosen controller is a PI. The output of this controller modulates the ACmain line voltage to obtain the reference for the current loop.
The low-pass filter is a first-order Infinite Impulse Response (IIR) filter with a 3dB cutoff frequency of 5Hz,implemented with the following transfer function:
with:b0 = 0.01a1 = 0.9984
The following is the proper PI controller:
Using the backward difference method yields the following discrete time equivalent:
with:KP = 0.9andKI = 0.0008
∑=
⋅+⋅=k
jIP jeKkeKkC
0
)()()(
1
0
)()(
azzb
zezf
−⋅
=
⎟⎠⎞
⎜⎝⎛
⋅+=
ssGc
0563.0119.0)(
∑=
⋅+⋅=k
jIP jeKkeKkC
0
)()()(
Battery Charger Control
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
Freescale Semiconductor 37Preliminary
5.3 Battery Charger ControlThe circuit in Figure 5-2 shows a schematic battery charger control loop, consisting of an inner voltage loopand an outer current loop. The sensed battery voltage determines the charging current (limited to 1 Ampere).This current is a function of the PWM duty cycle.
Figure 5-2. Battery Charger Control Loop
Given that the battery voltage is a slow signal, the sampling frequency for this control is decimated by 16relative to the 20kHz (20kHz/16 = 1250Hz) sampling frequency used elsewhere in the system. The PWMswitching frequency is preserved at 20kHz.
To avoid saturation of the voltage compensating network’s integrator, its input is deactivated if the controloutput is above a predefined threshold.
The batteries are charged using the constant current–constant voltage approach. While the battery voltage islower than the floating voltage (in this case, 28V), a constant current of 1A is applied. When the batteryterminal voltage reaches 28V, the voltage is kept constant, decreasing the charge current. The battery chargersystem is implemented by two nested loops. The inner loop controls the charging current and uses a PI control.The reference for this control is delivered by a voltage control loop, whose output is limited from 0 to 1/3,where 1/3 (in Frac16 notation) represents 1A. When the batteries are discharged, the voltage control increasesthe current reference, looking for a 28V voltage. However, when the voltage control loop reaches 1/3, theintegral action is disconnected and the output is limited, forcing the current loop to set a 1A charging current tothe battery. When floating voltage is reached, the voltage control loop reduces its output, reducing the currentapplied to the batteries.
Control Loops In The Online UPS
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
38 Freescale Semiconductor Preliminary
The controller chosen for the current control loop is a PI compensator with the following parameters:
Using the backward difference method results in the following discrete time equivalent system:
with:KP = 0.7andKI = 0.035
The controller chosen for the voltage control loop is a PI compensator with the following parameters:
Using the backward difference method results in the following discrete time equivalent system:
with:KP = 0.02andKI = 0.0005
5.4 Inverter ControlThe objective of the inverter control loop is to supply the load with a voltage defined by the reference signal.This reference signal is generated by the PLL system, at a sampling frequency of 20kHz, high above the50/60Hz nominal frequency. For this reason, it is reasonable to consider the set point a constant.
⎟⎠⎞
⎜⎝⎛
⋅+=
s001.0117.0)s(Gc
∑=
⋅+⋅=k
jIP jeKkeKkC
0
)()()(
⎟⎠⎞
⎜⎝⎛
⋅−+=
sesGc
332112.0)(
∑=
⋅+⋅=k
jIP jeKkeKkC
0
)()()(
Inverter Control
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
Freescale Semiconductor 39Preliminary
Figure 5-3. Inverter Control Loop
The inverter control is implemented with a nested topology. The outer loop controls the output voltage and theinner loop controls the inductor current. This configuration allows better stability of the feedback system andan implicit limitation of the current delivered to the load. The inner control loop stabilizes the system, acting asa damper for the LC output circuit.
The controller chosen for the current control loop is a PI compensator with the following parameters:
Using the backward difference method results in the following discrete time equivalent system:
with:KP = 0.84andKI = 0.0024The outer loop is the voltage control. The goal of this loop is to keep a sinusoidal voltage waveform, regardlessof the load characteristics. When nonlinear loads (as a full wave rectifier) are connected, a high current isdrawn at the peaks of the signal. The action taken to overcome this condition is to inhibit the integral action bydisconnecting the integrator input when the current draw is high. This action reduces the output distortion andenhances the controller response when the load requires high currents.
⎟⎠⎞
⎜⎝⎛
⋅+=
ssGc
0017.01184.0)(
Control Loops In The Online UPS
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
40 Freescale Semiconductor Preliminary
The controller chosen for the current control loop is a PI compensator with the following parameters:
Using the backward difference method results in the following discrete time equivalent system:
with:KP = 3.42KI = 0.475andKD = 11.75
5.5 Battery Booster Control LoopThe function of this controller is to keep the rail DC voltage at ±220V while the system is supported by thebattery.
Figure 5-4. Battery Booster Control Loop
⎟⎠⎞
⎜⎝⎛ ⋅+
⋅+= s0001688.0
s00036.01142.3)s(Gc
[ ])1()()()()(0
−−⋅+⋅+⋅= ∑=
kekeKjeKkeKkC D
k
jIP
56F8346 Controller
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
Freescale Semiconductor 41Preliminary
Given that the rail voltage is a slow signal, the sampling frequency for this control is decimated by 16 relativeto the 20kHz (20kHz/16 = 1250Hz) sampling frequency used in other sections of the system. The PWMswitching frequency is preserved at 20kHz.
The system is implemented with a PID compensator in order to regulate the rail DC voltage. The control outputmodulates the duty cycle of a push-pull power supply. The following are the parameters of such a controller:
Using the backward difference method yields the following discrete time equivalent system:
with:KP = 16KI = 0.2andKD = 0.1
5.6 Minimizing Delay in the Control Loops The triangular signal used as a carrier wave for the PWM is created from a counter that accumulates at thecontroller’s clock speed (60MHz). The pulse width of the PWM is updated at a rate of 20kHz. This implies thatin order to obtain both the 20kHz sampling frequency and a symmetric triangle wave, this counter must countfrom zero to 1500, then count back from 1500 to zero:
Given that the PWM(s) update their value when the PWM load command is given to the PWM peripheral, thedelay from the time elapsed between the sampling of the signal and the update of the PWM compare valuesshould be minimized, enhancing the system’s stability. The implementation of this delay and the relationshipbetween the PWM reference and the ADC conversion is fully explained in Section 7..
6. Control Board Design Considerations
6.1 56F8346 ControllerTwo source voltages are needed: one for the VDD_IO pins and the other for the ADC module. Jumper JG8 isprovided to connect/disconnect the Temperature Sense Diode to the ADCA, Channel 7 (ANA7).
⎟⎠⎞
⎜⎝⎛ ⋅+
⋅+= s000005.0
s064.01116)s(Gc
[ ])1()()()()(0
−−⋅+⋅+⋅= ∑=
kekeKjeKkeKkC D
k
jIP
15002060
21
=⎟⎠⎞
⎜⎝⎛
KHzMHz
Control Board Design Considerations
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
42 Freescale Semiconductor Preliminary
Figure 6-1. 56F8346 Controller
The Control Board provides a Clock Boot Mode jumper, JG1. This jumper is used to select the type of clocksource being provided to the processor as it exits reset. The user can select between the use of a crystal or anoscillator as the clock source for the processor.
The fault inputs of the PWM modules are tied to ground as a pull-down configuration in order to prevent falsefault conditions; see Figure 6-2.
FAULTB0
FAULTB2FAULTB1
FAULTB3
PWMB2
PWMB0
R60
47K
PWMB1
PWMB4PWMB3
R61
47K
PWMB5
R62
47K
FAULTA1
FAULTA2
FAULTA0
PC2
+3.3V
ANA2
CLKMODE
ANA7
JG8
12
A0
A2A1
A4A3
A6A5
A8A7
A10A9
A12A11
A14A13
D0
A15
D2D1
PC1
D3D4
D6D5
PC0
D7
PC3
D9D8
D10
D12D11
D14D13
D15
EMI_MODE
XTAL
Use on-chipregulators
/CS0
/RD/WR
/IRQA
/RESET
/IRQB
RXD0
EXTBOOT
MISO0
CAN_RX
+3.3V_PLL
JG1
12
U1
MC56F8346
A0138
A110
A211
A312
A413
A514
A6/PE217
A7/PE318
A8/PA019
A9/PA120
A10/PA221
A11/PA322
A12/PA423
A13/PA524
A14/PA625
A15/PA726
PS/CS046
DS/CS147
WR44
RD45
D059
D160
D272
D375
D476
D577
D678
D7/PF028
D8/PF129
D9/PF230
D10/PF332
D11/PF4133
D12/PF5134
D13/PF6135
D14/PF7136
D15137
PB0/A1633
TXD1/PD642
RXD1/PD7 43
PWMB034
PWMB1 35
PWMB2 36
PWMB339
PWMB440
PWMB541
ISB0/PD10 50
ISB1/PD11 52
ISB2/PD1253
IRQA54
IRQB55
FAULTB056
FAULTB157
FAULTB2 58
FAULTB3 61
PWMA062
PWMA164
PWMA2 65
PWMA3 67
PWMA468
PWMA570
FAULTA071
FAULTA173
FAULTA274
EXTBOOT112
XTAL81
EXTAL82
RSTO85 RESET86
ISA0/PC8113
ISA1/PC9 114
ISA2/PC10 115
ANA0 88
ANA1 89
ANA290
ANA391
ANA4 92
ANA5 93
ANA6 94
ANA795
ANB0104
ANB1105
ANB2 106
ANB3 107
ANB4 108
ANB5109
ANB6110
ANB7 111
TEMP_SENSE96
TD0/PE10116
TD1/PE11117
TC0/PE8 118
TRST120 TCK121
TMS122
TDI123
TDO124
SS0/PE7129 SCLK0/PE4130MISO0/PE6
131
MOSI0/PE5132
CAN_TX 126
CAN_RX127
PHA0/TA0 139
PHB0/TA1140
INDEX0/TA2/PC6141
HOME0/TA3/PC7142
PHB1/TB1/MOSI1/PC17INDEX1/TB2/MISO1/PC2 8
PHA1/TB0/SCLK1/PC06
HOME1/TB3/SS1/PC39
TXD0/PE0 4
RXD0/PE1 5
CLKO3
EMI_MODE143
PD0/CS248
PD1/CS349
CLKMODE87
VDD_IO216 VDD_IO11
VDD_IO331
VDD_IO438
VDD_IO566
VDD_IO684
VDD_IO7119
VPP1125
VPP22
VCAPC151
VCAPC2128
VCAPC383
VCAPC415
VSS_IO127
VSS_IO237
VSS_IO363
VSS_IO469
VSS_IO5144
REG_EN79
VDDA_OSC_PLL 80
VDDA_ADC102
VSSA_ADC103
VREFP 100
VREFH 101
VREFMID 99
VREFN98
VREFLO97
RXTXEN
TXD0
CESISCLK0
PD6
/SS0
MOSI0
EXTALCLKO
TDI
CAN_TX
TCK
TMS/TRST
TDO
PB0
/CS3
PD12
ANA0
CLKMODE
ANA3ANA4ANA5ANA6ANA7
ANA1
PWMA2PWMA1
PWMA5
PWMA3
FAULTA0PC10
FAULTA2FAULTA1
PWMA4
PWMA0
PHASEB0PHASEA0
FAULTB0
R361K
+3.3V
+3.3VA
C87100pF
C470.1uF
C820.001uF
Single traceto GNDA
PD11PD10
FAULTB1
ANB0 FAULTB2
ANB2ANB1
ANB3
ANB5ANB4
ANB6ANB7
/CS2
PE8
FAULTB3
+VREFH
PD7
R64
47K
R65
47K
R54
47K
+C152.2uF
R63
47K
+C122.2uF
+C132.2uF
+C142.2uF
/RSTO
/CS1
Single traceto GNDA
C480.1uF
C490.1uF
C190.1uF
PC9
PC7PC6
PC8
Reset/Modes/Clock
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
Freescale Semiconductor 43Preliminary
6.2 Reset/Modes/ClockLogic is provided on the Control Board to generate an internal Power-On Reset; see Figure 6-2. Additionalreset logic is provided to support the reset signals from the JTAG connector, the Parallel JTAG Interface andthe user reset push-button, S1; see Figure 6-3.
Figure 6-2. Reset Logic
The Control Board uses an 8.00MHz cystal (Y1) connected to processor’s oscillator inputs (XTAL andEXTAL). The crystal configuration is shown in Figure 6-3.
Figure 6-3. Selection Mode and Reset Button
U9A
74AC00
1
23
P_RESET
U9C
74AC00
9
108
U9B
74AC00
4
56
U9D
74AC00
12
1311
/J_TRST /TRST
/RESET/POR
EMI MODE JUMPER
EMI A0-A15
EXT BOOT
1 - 2
BOOT MODE JUMPER
NC
EMI A0-A19
PUSHBUTTON 1
PUSHBUTTON 2
INT BOOT
NC
R2810K
1 - 2
+3.3V
R16
10K
JG12
123
PD6
R32
10K
R19
10K
JG13
123
PD7
R20
10K Jumper
50/60
+3.3V
R2510K
R2710K
R2610K
R110M
EXTBOOT
S1
RESET
312 4
S2
OPTION
312 4
S3
ENTER
312 4
+3.3V
XTAL
Y18.00MHz
EXTAL
/POR
PE8
PC10
+3.3V+3.3V
A/M
Jumper
Jumper
110/220PD12
+3.3V
JG14
123
R17
10K
R18
10K
R2410K
EMI_MODE
+3.3V
JG4
12
JG3
12
C460.1uF
C200.1uF
C210.1uF
Control Board Design Considerations
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
44 Freescale Semiconductor Preliminary
The Control Board provides an External/Internal Boot mode jumper, JG4. This jumper is used to select theinternal or external memory operation of the processor as it exits reset.
The Control Board also provides an EMI Boot Mode jumper, JG5. This jumper is used to select the ExternalMemory Addressing Range Operating mode of the processor as it exits reset. The user can select either a 64Kaddress space or an 8M address space.
As seen in Figure 6-3, the board includes two user pushbuttons, S2 and S3 (Option and Enter, respectively)that can be used for general purposes. The jumpers JG12, JG13, and JG14 are used to select Auto/Manualmodes, 50/60Hz, and 110/220V, respectively.
6.3 Program And Data MemoryThe Control Board contains two 128K x 16-bit Fast Static RAM banks. SRAM bank 0 is controlled by CS0and SRAM bank 1 is controlled by CS1 and CS2; see Figure 6-4. This provides a total of 256K x 16 bits ofexternal memory.
Figure 6-4. Program and Data Memory
6.4 RS-232 Serial CommunicationsThe Control Board provides an isolated RS-232 interface by the use of an RS-232 level converter, MaximMAX3245EEAI, designated as U4, and two high speed optocouplers, Fairchild 6N136S, designated as U20and U21.
This circuitry transitions the SCI UART’s +3.3V signal levels to RS-232-compatible signal levels andconnects to the host’s serial port via connector P2.
JG5
12
A1
A3A2
A4
R2910k
R3010k
+3.3V +3.3V
/RD/WR
/ECS2/ECS1/CS1
/CS2
JG10
13
24
+3.3V
U3
GS72116TP-12
DQ1 7
DQ2 8
A41DQ3 9
DQ4 10A32
DQ5 13
DQ6 14
A23
DQ715
DQ8 16
A14
DQ9 29
DQ1030
A05
DQ1131
DQ1232
A1518
DQ1335
DQ1436
A1419
DQ1537
DQ1638
A1320 A1221 A1124 A1025 A926 A827 A742 A643 A544
UB40 LB39
OE41
WE17
CE6
A1622
VSS 34VSS 12
VDD 33VDD11
D2
R391K
D5
D0
D13
D4
D6
D15
D10
D3
D11D12
D7
D1
D8D9
D14
A11
A15
A1
A12
A10
A3
A9
A5
A14
A0
A8
A6
A13
A7
A4
PB0
A2
A6A5
A8A7
A10A9
A12A11
A14A13
PB0A15
D1D0
D3D2
D5D4
D7D6
D9D8
D11D10
/ECS1
D12
D14D13
/RD
D15
/WR
A0
U2
GS72116TP-12
DQ1 7
DQ2 8
A41DQ3 9
DQ4 10A32
DQ5 13
DQ6 14
A23
DQ715
DQ8 16
A14
DQ9 29
DQ1030
A05
DQ1131
DQ1232
A1518
DQ1335
DQ1436
A1419
DQ1537
DQ1638
A1320 A1221 A1124 A1025 A926 A827 A742 A643 A544
UB40 LB39
OE41
WE17
CE6
A1622
VSS 34VSS 12
VDD 33VDD11
+3.3V
R2310K
/ECS0/CS0
+3.3V
R22
10K
R21
10K
/ECS2
NC
128Kx16-bit Data Memory (CS1/CS2)128Kx16-bit Program Memory (CS0)
JG6OPTION
SRAM DISABLE
SRAM WORD ENABLE 1-2JG5OPTION
NC
1-2
CS0 ENABLE JUMPERCS1/CS2 ENABLE JUMPER
SRAM DISABLE
SRAM ENABLESRAM LOWER BYTE ENABLE
SRAM UPPER BYTE ENABLE
3-4
1-2
NC
NC
3-4
+3.3V
NC
R381K
R371K
A16
LCD Interface
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
Freescale Semiconductor 45Preliminary
Flow control is not provided. The SCI0 port signals can be isolated from the RS-232 level converter byremoving the jumpers in JG11. The RS-232 level converter/transceiver can be disabled by placing a jumper atJG7; see Figure 6-5.
Figure 6-5. RS-232 Serial Communications
6.5 LCD InterfaceThe Control Board contains an LCD as the primary user interface feedback. The LCD contains a built-ininternal driver. The display is controlled by some of the 56F8346’s GPIO pins. Figure 6-5 shows this hardwareinterface. As seen in Figure 6-6, the LCD interface (J12) uses a 4-bit data bus (D4-D7).
Figure 6-6. LCD Interface
R1082K
U20
6N136S
NC11
VCC8
-VF3
+VF2
VD6
VE7
GND5
NC24
U21
6N136S
NC1 1VCC8
-VF 3+VF 2
VD6VE7
GND5 NC2 4
C550.1uF
C560.1uF
Q1BSV52LT1
3
1
2
5Vext
R98390
R46
3.9K
R90390
R473.9K
R1072K
Q3BSV52LT1
3
1
2
+5.0V
RS-232 SHUTDOWN JUMPER
5Vext+5.0V
JG11
13
24
C81.0uF
C91.0uF
C101.0uF
U4
MAX3245EEAI
V+ 27C2+1
VCC 26
C2-2
FORCEON23
C1+28
T1IN14
T2IN13
T3IN12
R1OUT19
R2OUT18
R3OUT17
R4OUT16
R5OUT15 R5IN 8R4IN 7R3IN 6R2IN 5R1IN 4
T3OUT 11T2OUT 10T1OUT 9
FORCEOFF22
C1-24 V- 3
GND 25
R2OUTB20
INVALID 21
R34 1K
R35 1K
N/C
1 - 2RS-232 DISABLE
RS-232 ENABLE
CTS
CONNECTOR
RXD
DTR
DSR
RTS
TXD
DCD
T31
T6 1
5Vext
SCI #0
C111.0uF
RS-232
5Vext
R401K
T41T51
T7 1T8 1T9 1
T10 1/EN
JG7
12
R5IN
R4IN
R45 1K
R44 1KR2IN
R3IN
R3INR2IN
R4INR5IN
R43 1K
R42 1KT2IN
T3IN
R41 1K/EN
P2
594837261
T2INT3IN
RXD0
TXD0
5Vext
+5.0V
R3310K
J12
LCD_DISPLAY
GND1
VCC2
VO3
RS4
/RW5
E6
D07
D18
D29
D310
D411
D512
D613
D714
AA
BB
CC
DD
R11020K
13
2
PC3
PC2
PC6PC7
PC9PC8
Control Board Design Considerations
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
46 Freescale Semiconductor Preliminary
6.6 Peripheral Expansion Connectors
6.6.1 Wireless Board ConnectorThe Control Board contains a connector, J11, intended for use by the 13192 RF Daughter Card (13192RFC).The MC13192 RF modem daughter card is a low-cost development board that provides a simple interface toFreescale's MC13192 transceiver.
The MC13192 is a short-range, low-power, 2.4GHz ISM band transceiver which contains a complete 802.15.4physical layer (PHY) modem designed for the IEEE 802.15.4 wireless standard supporting star and meshnetworking. For further information, please visit www.freescale.com/zigbee .
Figure 6-7. Wireless Board Connector
6.6.2 PWM Ports Expansion ConnectorsThe PWM ports A and B are attached to the J5 and J14 connectors, respectively.
Figure 6-8. PWM Ports Expansion Connectors
CESI
J11
WIRELESS BOARD
2468
10121416182022242628303234363840
13579111315171921232527293133353739
MOSI0 SCLK0/SS0 MISO0
+3.3V
/IRQA
RXTXEN /RESET
PWMA0
PWMA4PWMA2 PWMA3
PWMA1
PWMA5
FAULTA2FAULTA0 FAULTA1
PC9PC8PC10
J5
135791113
2468
101214
PWMA PWMB
J14
135791113
2468
101214
PWMB2PWMB0 PWMB1
PWMB4 PWMB5PWMB3
FAULTB2FAULTB0
FAULTB3FAULTB1
Peripheral Expansion Connectors
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
Freescale Semiconductor 47Preliminary
6.6.3 A/D Ports Expansion ConnectorsThe 8-channel Analog-to-Digital conversion port A is attached to the J7 connector and port B is attached toJ13; see Figure 6-9. There is an RC network on each of the Analog ports’ input signals; see Figure 6-17.
Figure 6-9. A/D Ports Expansion Connectors
6.6.4 Timer A Expansion ConnectorThe TA0 and TA1 signals of Timer Channel A port are attached to the J9 connector.
Figure 6-10. Timer A Expansion Connector
6.6.5 GPIOPort C Expansion Connector (Bits 0—1)PC0 (GPIOC0) and PC1 (GPIOC1) pins are attached to the J8 connector.
Figure 6-11. GPIO Port C Expansion Connector
+VREFH
AN13AN10AN12
AN8AN11AN9
A/D PORT B
R14
0 Ohm
R15
0 OhmC840.47uF
AN14 AN15+VREFH
AN2AN5AN4
AN0 AN1AN3
A/D PORT A
J15
12
J16
12
J7
13579
2468
10
J13
13579
2468
10R8
0 Ohm
R10
0 OhmC850.47uF
SHIELDING PIN SHIELDING PIN
AN6 AN7
TIMER CHANNEL A
PHASEA0 PHASEB0
+3.3VR11
0 Ohm
R9
0 OhmC860.47uF
J9
13579
2468
10
SCRsGATE
R13
0 Ohm+3.3V
PC1PC0 R12
0 OhmC830.47uF
J8
13579
2468
10
Control Board Design Considerations
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
48 Freescale Semiconductor Preliminary
6.6.6 GPIO Port D Expansion Connector (Bits 10—11)PD10 (GPIOD10) and PD11 (GPIOD11) pins are attached to the J4 connector.
Figure 6-12. GPIO Port D Expansion Connector
6.7 Daughter Card ConnectorThe Control Board includes two daughter card connectors. One connector, J1, contains the processor’speripheral port signals. The second connector, J2, contains the processor’s external memory bus signals. TheDaughter Card connectors are used to connect the Ethernet evaluation daughter card; see Figure 6-13.
Figure 6-13. Daughter Card Connectors
BYPASS
J4
135791113
2468
101214
PD10 PD11
+3.3V/CS2+3.3V
ADDRESS/DATA PERIPHERAL
/CS1
/CS3
J2
91930-21151
135791113151719212325272931333537394143454749
2468
101214161820222426283032343638404244464850
51
SCLK0
CLKO
MISO0MOSI0
/RESET
/SS0
/IRQA
A9A10
A7A8
D0/WR
D3
D1
D5D4
D7
D6
A15
A11
A14
A12A13
D9D8
D12
D10
D13
D11
D15D14
/RD
A5
A6
A4
A0/CS0
A2
A1
A3 /IRQB
D2
J1
91930-21151
135791113151719212325272931333537394143454749
2468
101214161820222426283032343638404244464850
51
Debug Support
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
Freescale Semiconductor 49Preliminary
6.8 CAN InterfaceThe Control Board contains a CAN physical-layer interface chip that is attached to the FlexCAN port’sCAN_RX and CAN_TX pins through optocouplers. The Control Board uses a Philips high-speed, 1.0Mbps,physical-layer interface chip, PCA82C250.
The CANH and CANL signals pass through inductors before attaching to the CAN bus connectors. A primary,J6, and daisy-chain, J6, CAN connectors are provided to allow easy daisy-chaining of CAN devices. CAN bustermination of 120 Ohms can be provided by adding a jumper to JG2. The FlexCAN port is attached to J17connector; see Figure 6-14.
Figure 6-14. CAN Interface
6.9 Debug SupportThe Control Board provides an on-board Parallel JTAG Host Target Interface and a JTAG interface connectorfor external target interface support. Two interface connectors are provided to support each of these debuggingapproaches. These two connectors are designated the JTAG connector and the Host Parallel Interfaceconnector.
+5.0V
C340.1uF
CAN_RX
CAN_TX
R93 390
C39 0.1uF
CAN BUSTERMINATION
BCANH
U146N137S
NC
11
VCC
8
-VF
3+V
F2
VO6
VE
7
GN
D5
NC
24
JG2
12
BCANL
R1091201/4WU13
6N137SN
C1
1V
CC
8
-VF
3+V
F2
VO6
VE
7
GN
D5
NC
24 BCANL
J613579
2468
10
BCANH
R97390
R95 390
5Vext
C40 0.1uF
5Vext5Vext
U16
PCA82C250
TXD1 RXD 4
GND2VCC
3
CANL 6CANH
7
Vref 5Rs8
R483.9K
Q2BSV52LT1
3
1
2
R92390
+5.0V
L7
CAN_TX
CANH
CAN_RX
BCANLBCANH
CANL
J17
13
24
CAN
Control Board Design Considerations
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
50 Freescale Semiconductor Preliminary
6.9.1 JTAG ConnectorThe JTAG connector on the Control Board allows the connection of an external Host Target Interface fordownloading programs and working with the 56F8346’s registers. This connector is used to communicate withan external Host Target Interface which passes information and data back and forth with a host processorrunning a debugger program.
When this connector is used with an external Host Target Interface, the parallel JTAG interface should bedisabled by placing a jumper in jumper block JG9.
Figure 6-15. JTAG Connector
6.9.2 Parallel JTAG Interface ConnectorThe Parallel JTAG Interface connector, P1, allows the 56F8346 to communicate with a Parallel Printer Port ona Windows PC. All interface signals are optoisolated. Using this connector, the user can download programsand work with the 56F8346’s registers. When using the parallel JTAG interface, the jumper at JG9 should beremoved; see Figure 6-16.
+3.3V
TDI
TCKTDO
TMS
JTAG Connector
KEY
/DE
P_RESET
/J_TRSTJ3
135791113
2468
101214
Debug Support
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
Freescale Semiconductor 51Preliminary
Figure 6-16. Parallel JTAG Interface Connector
PORT_CONNECT
PORT_TDO
R104
51 Ohm
P11
3
215
14
164
175
186
197
208
219
2210
2311
2412
2513
R105
51 Ohm
PORT_DE
PORT_IDENT
U11
MC74HC244DW
1Y118
1Y2 16
1Y314
1Y4 12
2Y1 9
2Y2 7
2Y35
2Y43
2G 191G
1
1A12
1A24
1A36
1A48
2A111
2A213
2A315
2A4 17VCC20
GND10
R52
5.1KT21
R535.1K
R495.1K
PORT_VCC 5Vext
PORT_TDO
PORT_CONNECT
R3110k
PORT_TCK
PORT_TMS
PORT_TDI
/PORT_TRST
PORT_RESETPORT_TMS
PORT_RESET
/PORT_TRST
PORT_TDI
PORT_TCK
1A4
R101390
R94390
PORT_RESET
U17
HCPL-2631S
+VF11
VCC8
-VF23
-VF12
VO26
VO17
GND5
+VF24
R86390
1A1
+5.0V
R85390
R84390
5Vext
R89390
5Vext
5Vext
PORT_TMS 1A2
U18
HCPL-2631S
+VF11
VCC8
-VF23
-VF12
VO26
VO17
GND5
+VF24
PORT_TCKR88390
+5.0V
C500.1uF
R87390 C51
0.1uF
1A3
PORT_TDI
R96390R100390
R99390+5.0V
R82390
R91390
2Y3
R83390
PORT_TDO
2Y4PORT_CONNECT5Vext
5Vext
U12
6N137S
NC11 VCC 8
-VF3
+VF2
VD6
VE 7
GND5
NC24
/PORT_TRST
+5.0V
C520.1uF
+5.0V
U19
HCPL-2631S
+VF1 1VCC8
-VF23
-VF1 2
VO26
VO17
GND5
+VF24
C530.1uF
2A1
TMS
+3.3V
U10
MC74LCX244DW
1Y1 18
1Y2 16
1Y3 14
1Y4 12
2Y1 9
2Y27
2Y35
2Y43
2G19 1G1
1A12
1A24
1A36
1A48
2A111
2A213
2A315
2A417
VCC20
GND10
+3.3V
R505.1K
JG9 12
On-BoardHost Target Interface Disable
T1 1
TMS
P_RESET
TDI
/J_TRST
TCK
P_DE
TDO R58
47K
P_DE
TDO
R51
5.1K
R55
47K
/J_TRST
PWRR57
47K
PWR
R56
47K
/DE
R3 0 Ohm
R4 0 Ohm
R5 0 Ohm
R6 0 Ohm
R7 0 Ohm
2Y3
2Y4
1A1
1A4
2A1
1A2
1A3
R59
47K
Control Board Design Considerations
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
52 Freescale Semiconductor Preliminary
6.10 A/D FiltersAs Figure 6-17 shows, all Analog-to-Digital ports of the processor are connected to RC networks that work aslow-pass filters.
Figure 6-17. Passive Low-pass Filters of the A/D Ports
6.11 Power SupplyThe Control Board has two power inputs, P3 and P4, through the 2.1mm coax power jacks.
The main power input (P3) must be fed with a voltage of +12V DC at 1.2A. This power input feeds a 5V DCvoltage regulator (U6), which supplies two more 3.3V DC regulators. The first of the 3.3V DC regulators, U8,supplies the voltage to all of the 3.3V DC ICs. The second 3.3V DC regulator, U7, feeds the ADC module ofthe controller and feeds another 3.0V DC voltage regulator, U15, used as a reference for the controller’s ADC;see Figure 6-18.
AN0
AN2
AN1
AN4
AN3
AN7
NOTE: Use a single tracefor GNDA signals to thecommon GNDA point.
C730.0022uF
R67
560
C740.0022uF
R66
560
ANA5
ANA6AN6
AN5
ANB0AN8
C650.0022uF
R75
560
ANB1AN9
C660.0022uF
R72
560
AN10 ANB2
C670.0022uF
R73
560
AN11 ANB3
C680.0022uF
R74
560
AN12 ANB4
C690.0022uF
R71
560C750.0022uF
R80
560ANA0
C770.0022uF
R81
560ANB5AN13
C700.0022uF
C780.0022uF
R68
560
R76
560
C790.0022uF
R70
560
R69
560C800.0022uF
ANB6AN14ANA2
ANA1
ANA4
ANA3
C710.0022uF
ANA7
R77
560
C760.0022uF
R79
560
AN15 ANB7
C720.0022uF
R78
560
Power Supply
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
Freescale Semiconductor 53Preliminary
Figure 6-18. Power Input
The second power input (P4) feeds the +5V DC voltage regulator, U5. This regulator supplies the voltage to apart of the optocouplers and the components before them.
7-12V DC/ACUNREGULATED POWER INPUT
+3.3V_PLL
R20 Ohm
D4
S1ABDICT-NDDNP
12D3
S1ABDICT-NDDNP
12
P31
3
2
+3.3VA
+5.0V
U7
MC33269DT-3.3
VIN3
VOUT2
VOUT 4GND1
+ C447uF10VDC
L3
FERRITE BEAD
R106
10 DNP+VREFH
C540.1uF
U8
MC33269DT-3.3
VIN3
VOUT2
VOUT 4GND1
+3.3V
L5
FERRITE BEAD
+ C1470uF16VDC
+ C7330uF10VDC
+ C347uF10VDC
+5.0V
L2
FERRITE BEAD+3.3V
L4
FERRITE BEAD
C230.1uF
C220.1uF
+3.0V
JG6
12
Single traceto GNDA.
C162.2uF TANT10VDC
D1
S1ABDICT-ND
1 2
C182.2uF TANT
10VDC
U6 LM2575S-5.0
VIN1
OUT2GND3
FB4
ON/OFF5
TAP6
D610BQ060
Diode schottky
L1
PM5022 330uF
VCC
+5.0V
U15
REG113NA-3/3K
VIN1
VOUT 5
NR 4
GND2EN
3+3.3VA
+ C8110uF6VDC
C590.01uF
+VREFH
C240.1uF
+12V
+ C547uF10VDC
Control Board Design Considerations
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
54 Freescale Semiconductor Preliminary
Figure 6-19. External Power Input
Several test points were placed over the Control Board and LEDs indicate when the power sources are turnedon; see Figure 6-20.
Figure 6-20. Power Supply LEDs and Test Points
D2
S1ABDICT-ND
1 2
C172.2uF TANT10VDC
7-12Vext DC
EXTERNAL POWERSUPPLY INPUT
P41
3
2L6
FERRITE BEAD
U5
MC33269DT-5.0
VIN3 VOUT 2
VOUT 4GND1+ C2470uF16VDC +C6
47uF10VDC
5Vext
D5
S1ABDICT-ND
12
C330.1uF
+12Vext
TP9
1
GROUNDextTEST POINT POWER GOOD LED
+5.0V
R103270
LED1GREEN LED
12
TP6
1
TP1
1
TP3
1
TP2
1
GROUND TEST POINT
ANALOG GROUND TEST POINT
+3.3VA TEST POINT
+3.3VA
+3.3V TEST POINT
+3.3V
TP4
1
TP5
1
GROUND TEST POINT
GROUND TEST POINT
5Vext
R102270
LED2GREEN LED
12
5Vext
POWER GOOD LEDPOWER SUPPLY 5VextPOWER SUPPLY +5.0V
TP7
1
+5.0V TEST POINT
+5.0V
TP8
1
+5.0Vext TEST POINT
Peripheral and I/O Pins Assignment
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
Freescale Semiconductor 55Preliminary
7. Control Software Design Considerations
7.1 Peripheral and I/O Pins Assignment
Table 7-1. Assignment of the Analog-to-Digital Converters
Peripheral Input Signal
ADCA 0 Inverter Output Voltage
ADCA 1 Inverter Inductor Current
ADCA 2 Line Input Voltage
ADCA 3 Line Input Current
ADCA 4 Battery Voltage
ADCA 5 Battery Current
ADCA 6 Rail Voltage Difference (VP + VN)
ADCA 7 UPS Load Current
ADCB 0 Battery Temperature Sensor
Table 7-2. Digital Outputs and Inputs
Peripheral Port Function
PWMA 0 and 1 Inverter Switching Network – Output
PWMA 2 and 3 Battery Booster Switching Network – Output
PWMA 4 and 5 Power Factor Correction Switching – Output Network
Timer A0 Battery Charger PWM – Output
Timer A1 100kHz 35% Duty Cycle signal to auxiliary power supplies – Output
Timer C0 General purpose delay generator (start up and LCD)
Timer C2 Sets delay between PMW load and ADC start of conversion Synchronizes ADC to PWM
GPIOC0 Rectifier SCR Control – Output
GPIOC1 Inverter Enable – Input
GPIOD6 Auto/Manual Frequency Selection Jumper – Input
GPIOD7 50/60Hz Manual Frequency Selection Jumper – Input
GPIOD10 Bypass relay control – Output
GPIOD12 120 / 220V selector
Control Software Design Considerations
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
56 Freescale Semiconductor Preliminary
7.2 Main Execution RoutineAll real-time operational software runs in the interrupt service routines. The main execution routine isdedicated to Monitor and Control functions. All real-time processing is accomplished by interrupt serviceroutines.
PWMA - Fault 0 Inverter Overcurrent Protection; PWM Fault 0 – Input
PWMA – Fault 1 PFC Overcurrent Short Circuit Protection; PWM Fault 1 – Input
PWMA – Fault 2 Battery Booster Overcurrent Short Circuit Protection; PWM Fault 2 – Input
Table 7-2. Digital Outputs and Inputs (Continued)
Peripheral Port Function
Main Execution Routine
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
Freescale Semiconductor 57Preliminary
Figure 7-3. Main Routine Flow Diagram
3 second Delay
Initialization of Variables
Declaration of Variables
Configuration of DSP Core and Peripherals by Processor Expert
Determination of:
•Auto/Manual jumper position.
•50/60 Hz jumper position.
•AC Main Line Frequency
Set UPS Initial Operational Conditions
Infinite Loop:
Square root calculations of RMSs
Check battery charge flag to determine flash write.
If temperature_counter = 20000 then start ADC B conversion.
Scale adjust of output variables
Format operational variables to ASCII strings to show at Display and Communications
3 second Delay
Initialization of Variables
Declaration of Variables
Configuration of DSP Core and Peripherals by Processor Expert
Determination of:
•Auto/Manual jumper position.
•50/60 Hz jumper position.
•AC Main Line Frequency
Set UPS Initial Operational Conditions
Infinite Loop:
Square root calculations of RMSs
Check battery charge flag to determine flash write.
If temperature_counter = 20000 then start ADC B conversion.
Scale adjust of output variables
Format operational variables to ASCII strings to show at Display and Communications
Control Software Design Considerations
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
58 Freescale Semiconductor Preliminary
7.3 Interrupt HandlersThe following interruptions perform the system’s environment sensing:
• ADCA End Of Conversion• ADC End Of Conversion• PWM Fault 0• PWM Fault 1• PWM Fault 2• Delay_Timer_OnInterrupt
7.3.1 ADC End of Conversion Interrupt Service RoutineAll real-time controls are executed inside this routine. Figure 7-4 through Figure 7-8 show the flow of theprogram.
Interrupt Handlers
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
Freescale Semiconductor 59Preliminary
Figure 7-4. Flow Diagram for the Interrupt Service Routine AD1_OnEnd (1 of 5)
Control Software Design Considerations
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
60 Freescale Semiconductor Preliminary
Figure 7-5. Flow Diagram for the Interrupt Service Routine AD1_OnEnd (2 of 5)
Interrupt Handlers
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
Freescale Semiconductor 61Preliminary
Figure 7-6. Flow Diagram for the Interrupt Service Routing AD1_OnEnd (3 of 5)
Control Software Design Considerations
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
62 Freescale Semiconductor Preliminary
Figure 7-7. Flow Diagram for the Interrupt Service Routine AD1_OnEnd (4 of 5)
Interrupt Handlers
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
Freescale Semiconductor 63Preliminary
Figure 7-8. Flow Diagram for the Interrupt Service Routine AD1_OnEnd (5 of 5)
Control Software Design Considerations
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
64 Freescale Semiconductor Preliminary
7.3.2 UPS Overcurrent Protection Interrupt Handlers
Figure 7-9. Overcurrent Management
Three overcurrent events are sensed and connected to the Fault inputs of the PWM modules. These are:
• Inverter Current out of Limits• Rectifier (PFC) Current out of Limits• Booster Current out of Limits
PWM Fault inputs are set up to disable the corresponding PWM pins when overcurrent is detected.
Interrupt Handlers
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
Freescale Semiconductor 65Preliminary
A single overcurrent event should not disable the complete system, as peak currents can occur when switchedcapacitive loads are connected (i.e., a power supply implemented with rectifier and capacitor). For this reason,a current out of limits counter is implemented in all of the PWM-controlled systems. Every time the interrupthandler routine is called, the counter increases by an amount, A. The 20kHz End of Conversion interruptdecreases the counter by an amount, B. The UPS is sent to the fail condition only if:
kA - Bn > Threshold
where: k is the number of times the current out of limits event occursn is the number of times the 20kHz routine is called
The weights A and B and the threshold are selected to balance a trade-off requiring the system not be shutdown when capacitive loads cause periodic overcurrent events, and to shut down the UPS when a continuedshort circuit condition is detected.
7.3.3 Battery Temperature ReadingThe interrupt service routine AD2_OnEnd reads and stores the battery temperature to a variable. The executionof the ISR is shown in Figure 7-10.
Figure 7-10. Battery Temperature Reading
7.3.4 Delay_Timer_OnInterruptThis routine merely counts 21 times 140ms (the time interval of the timer) in order to generate a time delay of3 seconds following the controller’s core start-up. This is a wait time to allow the auxiliary power supplies tostabilize.
Conversion
Reset Tempertature counter
ADC Stop
Interrupt Handler for ADCB End of Conversion
Read Temperature from ADCB 0
Reset Tempertature counter
RTI
ADC Stop
Control Software Design Considerations
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
66 Freescale Semiconductor Preliminary
7.4 Program Loop TimingThe timing of the program originates at the PWM, configured for one complete cycle reload, andcenter-aligned. The modulo of the PWM is set to 1500, generating a 20kHz triangle wave from the 60MHzinternal bus clock.
The SYNC signal of the PWM is passed to Timer C2 to provide the sync signal to the ADCA peripheral. AtTimer C2, the SYNC signal is delayed in order to reduce the time between the sampling and the updating of thevalues at the PWM, enhancing the stability of the discrete time control algorithms.
Figure 7-11. Program Loop Timing
After the configured delay, Timer C2 signals the ADCs to start conversion. At the end of the conversion, theADC module interrupts the core processor. All control loops are executed in this interruption.
7.5 Inverter Control LoopThe control network for the inverter is constructed with an inner current PI control loop and an outer PIDcontrol loop as shown in Figure 7-12.
The outer control loop receives the sinusoidal wave synthesized by the PLL module as a reference andcompares it with the inverter output voltage. The error signal passes through a PID compensator whose outputconstitutes the set point for the inner PI control loop. This current set point is compared with the load current.
The transfer function of a discrete time PID control loop is calculated by this equation:
⎥⎦⎤
⎢⎣⎡ −
+−
+= DIPT KZ
1ZK1Z
ZKK)Z(C
PFC Control Loop
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
Freescale Semiconductor 67Preliminary
The transfer function of a discrete time PI control loop is calculated by the following equation::
The sine wave generated is used as the set point of the inverter control. The inverter uses the output voltage andcurrent as sensing inputs to the control, which have a double control loop topology, inner PI current control andouter PID voltage control. Figure 7-12 shows the details of the inverter loop as implemented in the sourcecode. Signal names are the actual variable names in the C code.
Figure 7-12. Inverter Control Loop Diagram
7.6 PFC Control LoopFigure 7-13 shows the actual function implementation of the PFC control loop. It consists of two controls, oneto control the rail-to-rail voltage and another to control the current drawn to the AC main line. The current setpoint for the inner loop is the AC line voltage times a factor linearly proportional to the error signal at the rails(and finally dependent on the UPS load current). The hardware implementation in this UPS (please refer toFigure 7-13) requires the inner control to work with the absolute values of the signals in order to avoiddiscontinuities at the current control output.
Both control loops use Proportional–Integral (PI) compensators, implemented with 32-bit integrators. The Zdomain transfer function of a PI compensator is:
where:KP is the proportional gainKI is the integral gain
A total gain, KT, is implemented in order to allow flexibility when tuning the control; i.e., varying the totalloop gain without the necessity of modifying the individual gains.
TI
P K1ZZ*KK)Z(C ⎥⎦⎤
⎢⎣⎡
−+=
PLL Sin Table
Lookupx
Inverter_SoftStart (0 to 1 in 1.6 sec)
INVERTER_OUTPUTSETTING
Σ
PID ControlwithSaturation Function
+
++
P
I
D
Σ Σ+
Σ+
P
IGain = 0.475 Shift = 1
Gain = 0.9 Shift = 2
Gain = 0.25 Shift = 1
Gain = 0.38 Shift = 5
Disconnect Integrator if |output| greater than 0.833
Gain = 0.3 Shift = 1
Gain = 0.35 Shift = 2
Gain = 0.04
PWM Actuator & Switching Network
Inductance
Capacitor and Load
+
--
+
PI ControlwithSaturation Function
UPS_OutputVoltage
UPS_OutputCurrent
PLL Sin Table
Lookupx
Inverter_SoftStart (0 to 1 in 1.6 sec)
INVERTER_OUTPUTSETTING
Σ
PID ControlwithSaturation Function
+
++
P
I
D
Σ Σ+
Σ+
P
IGain = 0.475 Shift = 1
Gain = 0.9 Shift = 2
Gain = 0.25 Shift = 1
Gain = 0.38 Shift = 5
Disconnect Integrator if |output| greater than 0.833
Gain = 0.3 Shift = 1
Gain = 0.35 Shift = 2
Gain = 0.04
PWM Actuator & Switching Network
Inductance
Capacitor and Load
+
--
+
PI ControlwithSaturation Function
UPS_OutputVoltage
UPS_OutputCurrent
TI
P K1ZZ*K
K)Z(C ⎥⎦⎤
⎢⎣⎡
−+=
Control Software Design Considerations
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
68 Freescale Semiconductor Preliminary
Figure 7-13. PFC Control Loop Diagram
7.7 Battery Booster Control LoopThe battery booster control signals for the switches are not complementary but 180° phase shifted. This isimplemented at PWMA channels 2 and 3, defining the compare value of channel 3 as 1500 (the full scale of thePWM) minus the compare value of channel 2, and inverting its output. A protection time of 4ms isimplemented between the active state of these signals at maximum duty cycle .
Decimation by 16 is implemented for a routine sample frequency of 1250Hz. Figure 7-14 shows the batterybooster system.
Figure 7-14. Battery Booster Control Loop
x
RailtoRail_SoftStart (0 to 1 in 2.4 sec)
Σ
PIControlwithLowSaturation Function
+
+P
IΣ Σ
+Σ
+
P
IGain = 1 Shift = 0
Gain = 0.9 Shift = 0
Gain = 0.0008 Shift = 0
Disconnect Integrator if output lower than 0
Gain = 1 Shift = 3
Gain = 0.8 Shift = 0
Gain = 0.2
PWM Actuator & Switching Network
Line Input & Rail Network
+
--
+
PIControlwithSaturation Function
RailtoRail_InstantVoltage
Line_CurrentInput
Rail_SetPointIf input Signal < 0, output 0
abs
abs
xsign
5 Hz Low Pass Filterx
RailtoRail_SoftStart (0 to 1 in 2.4 sec)
Σ
PIControlwithLowSaturation Function
+
+P
IΣ Σ
+Σ
+
P
IGain = 1 Shift = 0
Gain = 0.9 Shift = 0
Gain = 0.0008 Shift = 0
Disconnect Integrator if output lower than 0
Gain = 1 Shift = 3
Gain = 0.8 Shift = 0
Gain = 0.2
PWM Actuator & Switching Network
Line Input & Rail Network
+
--
+
PIControlwithSaturation Function
RailtoRail_InstantVoltage
Line_CurrentInput
Rail_SetPointIf input Signal < 0, output 0
abs
abs
xsign
5 Hz Low Pass Filter
SetPointBoost
-
∑=
−15
0)(
161
kknx
Σ+
16Decimation
Σ
PIDBooster Function (Runs at 1250 Hz)
+
++
P
I
D
Gain = 1
Gain = 0.00625
Gain = 0.0125
Disconnect Integrator if |derivative| greater than 0.00005
If input Signal < 0, output 0
PWM Actuator & Switching Network
RailtoRail_InstantVoltage
SetPointBoost
-
∑=
−15
0)(
161
kknx
Σ+
16Decimation
Σ
PIDBooster Function (Runs at 1250 Hz)
+
++
P
I
D
Gain = 1
Gain = 0.00625
Gain = 0.0125
Disconnect Integrator if |derivative| greater than 0.00005
If input Signal < 0, output 0
PWM Actuator & Switching Network
RailtoRail_InstantVoltage
Phase Locked Loop Routine
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
Freescale Semiconductor 69Preliminary
7.8 Battery Charger Control LoopThe battery charger is a constant current power supply. The control loop uses the measured battery current tocalculate the appropriate voltage set point. Decimation of the sampling rate by 16 allows for better precisionfor the battery voltage variable. The variables are sensed at 20kHz, but the battery voltage routine is executedat 20kHz/16 = 1250Hz. Moving averaging of the samples is implemented for noise filtering.
Due to the slow speed of the system, the integrator input of the voltage control is disabled when the output ofthe controls reaches a defined limit.
Please see Figure 7-15 for a detailed diagram of the battery charger system.
Figure 7-15. Battery Charger Control Loop
7.9 Phase Locked Loop Routine
7.9.1 Phase DiscriminatorThe Phase Locked Loop uses a phase and frequency discriminator inspired by the Phase Comparator II of theFairchild Semiconductor’s CD4046, modified to fit a synchronous state machine. The continuous arrows inFigure 7-16 correspond to the asynchronous state machine. The dashed arrows were added to fit thesynchronous implementation.
x
Charger_SoftStart
Σ
PIControlwithSaturation Function (Runs at 1250 Hz)
+
+P
IΣ Σ
+Σ
+
P
IGain=0.05 Shift = 0
Gain = 0.4 Shift = 0
Gain = 0.01
Disconnect Integrator if |output| greater than 1/3
Gain = 0.7 Shift = 0
Gain = 0.5 Shift = 1
Gain = 0.05
PWM Actuator & Switching Network
Battery Charger Network
+
--
+
PIControlwithSaturation Function
Battery_InstantVoltage
Battery_InstantCurrent
Charger_ReferenceVoltageLimitIf input Signal < 0, output 0
If input signal < 0, output = 0
∑=
−15
0)(
161
kknx 16
Decimation
x
Charger_SoftStart
Σ
PIControlwithSaturation Function (Runs at 1250 Hz)
+
+P
IΣ Σ
+Σ
+
P
IGain=0.05 Shift = 0
Gain = 0.4 Shift = 0
Gain = 0.01
Disconnect Integrator if |output| greater than 1/3
Gain = 0.7 Shift = 0
Gain = 0.5 Shift = 1
Gain = 0.05
PWM Actuator & Switching Network
Battery Charger Network
+
--
+
PIControlwithSaturation Function
Battery_InstantVoltage
Battery_InstantCurrent
Charger_ReferenceVoltageLimitIf input Signal < 0, output 0
If input signal < 0, output = 0
∑=
−15
0)(
161
kknx 16
Decimation
Control Software Design Considerations
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
70 Freescale Semiconductor Preliminary
Figure 7-16. Synchronous Phase Discriminator State Machine
Table 7-17 is the transition table for the state machine. The input description is formed by x, the sign of thereference signal to the PLL, and y, the sign of the Digitally Controlled Oscillator (DCO) output. The presentstate combines with the input xy and determines both the next state and the output of the phase discriminator.
00
11
10 01
00
11
01 1000
11
01 10
0
12
3
4
5
6
7
8
9A
B
xy
z
x: PLL Referencey: DCO Output
z: State Index
Output: -1 0 1
Existing Transitions for Asynchronous State Machine
Added Transitions for synchronous State Machine
00
11
10 01
00
11
01 1000
11
01 10
0
12
3
4
5
6
7
8
9A
B
xy
z
x: PLL Referencey: DCO Output
z: State Index
Output: -1 0 1
Existing Transitions for Asynchronous State Machine
Added Transitions for synchronous State Machine
Phase Locked Loop Routine
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
Freescale Semiconductor 71Preliminary
The phase discriminator output feeds a phase accumulator that integrates from the reference signal’s positivezero crossing to the next one. After one iteration is ended, the accumulator output is fed to a PI control, thenreset. The Proportional—Integral control routine runs at every positive zero crossing.
The output of the control is added to the sine wave index, transforming the table look-up algorithm in anumerically controlled oscillator, then closing the Phase Locked Loop.
7.9.2 Control LoopThe PLL reference may be either AC Main Line or Freerun. The Freerun operation is chosen if the AC MainLine frequency is out of specifications, as explained in Section 7.10. See Figure 7-18 for a block diagram ofthe PLL Control Loop.
Table 7-17. Transitions of the Synchronous Phase Discriminator
Next State (Depending on Input xy)Output
Input xy 11 10 01 00St
ate
Inde
x
0 3 A 5 0 0
1 B A 1 0 0
2 7 2 5 0 0
3 3 2 1 0 0
4 3 2 5 4 -1
5 3 2 5 4 -1
6 7 6 5 4 -1
7 7 6 5 4 -1
8 3 A 1 8 1
9 B A 9 8 1
A 3 A 1 8 1
B B A 9 8 1
Control Software Design Considerations
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
72 Freescale Semiconductor Preliminary
Figure 7-18. PLL Control Loop
7.9.3 Sine Wave Look-Up TableThe sine wave is generated by look-up of a table of 800 samples from a full cycle of a sine wave, scaled from–1 to 1 in Frac16 fixed point fractional number format.
At 20kHz sample frequency, the sine wave table pointer increments 2.4 memory positions per sample to yielda 60Hz wave. To generate a 50Hz wave, the increment is 2.0 positions. The custom data type FixedInt wascreated to implement fractional advances. The phase value is stored in a long signed integer. Only the mostsignificant 16-bit integer word is used to address two consecutive samples of the table, then a linearinterpolation using the fractional part of the index is performed.
typedef unionstructunsigned int IntL;int IntH;I;long L;FixedInt;FixedInt Data Type Definition
The FixedInt can be used as a long (variable.L) or as its integer part (variable.I.IntH), plus its unsignedfractional part (variable.I.IntL). The integer part is used to address the table, and is a modulo 800 circularcounter.
7.10 Frequency Measurement RoutineThe AC main line frequency is measured with two purposes:
• Auto-sensing line frequency when the UPS starts up• Determining the quality of the AC main line frequency
If out of limits, the UPS will switch to the internal reference mode.
To avoid divisions, period rather than frequency is measured in the form of interrupt counts (50µs each). Thetime window for interrupt counts is 10 cycles of the line signal.
+Σ
+
P
IPhase Discriminator
Gain = 0.09
Gain = 0.0016
Table_Index calculation
Look up Table
F_Table_Sample
Low PassΣ
f0= 50 or 60 Hz
PLL_FreerunFlag
Freerun Reference1
0Line_VoltageInput
Low PassTable_Sample
+Σ
+
P
IPhase Discriminator
Gain = 0.09
Gain = 0.0016
Table_Index calculation
Look up Table
F_Table_Sample
Low PassΣ
f0= 50 or 60 Hz
PLL_FreerunFlag
Freerun Reference1
0Line_VoltageInput
Low PassTable_Sample
Frequency Measurement Routine
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
Freescale Semiconductor 73Preliminary
Figure 7-19. Frequency Measurement Routine
Control Software Design Considerations
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
74 Freescale Semiconductor Preliminary
7.11 Rectifier Soft Start RoutineIn order to implement the rectifier soft start, a software synchronized ramp is generated and compared with therectifier trigger level signal, which starts at a value higher than the peak of the ramp, then decrements towardszero. The result of the compare operation generates a PWM signal that is set at the zero crossing time minustime T, and is always reset at the zero crossing. As the trigger level decrements, the time τ increases from zeroto a half period. This signal can drive the input SCRs that form the full wave rectifier at the input of the UPS.
Figure 7-20. SCR Control Signal Generation at the Beginning and End of the Rectifier Soft Start
7.12 Root Mean Square (RMS) SensingRMS sensing is accomplished by filtering the squared input signal by two cascaded second-order digital filters.This operation is done in real time, sample-by-sample in the converter interruption routine. The next twoblocks are performed in noncritical processing times.
Figure 7-21. RMS Sensing System
Routine for Measurement of the Battery Stored Charge
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
Freescale Semiconductor 75Preliminary
7.13 Power SensingLike RMS sensing, power sensing is performed in two operations, first multiplying and filtering in real time,then adjusting the display processing routine. This routine is applied to calculate both the input and the outputpower.
Figure 7-22. Power Sensing System
7.14 Routine for Measurement of the Battery Stored ChargeMeasuring the battery stored charge is complicated by several requirements:
• Determining the state of the battery charge when first connected to the UPS• The ability to modify the algorithm according to the capacity of the battery connected• Integrating the charging/discharging current over long periods (hours for the recharging process),
when the system sampling rate is 20kHz • Performing low gain integrations to minimize the quantization effect• Correcting the effect of different sensing circuits
The hardware is implemented with one sensing circuit for the battery charge, but a different sensing circuit for the battery discharge. Shunt resistors have in a 10:1 ratio for charge/discharge, respectively.
These requirements are met by implementing three nested integrators with variable gains and integration timewindows, depending on whether the battery is accepting or yielding charge. The same constants are used totune the charge measurement algorithm, depending on the battery size.
Full charge is indicated when the outer integrator reaches one in Frac32 notation.
The first time that the batteries are connected to the system, the battery stored charge is unknown until thecharging current decreases to reach the floating regime. When such a condition is detected, the battery storedcharge variable is forced to one (100%), and the integration/deintegration summations are executed to track thebattery charge. This condition is stored in the Valid Battery Charge flag variable.
The charging capacity integration while the battery is accepting charge is then:
∑ ∑ ∑= = =
⎟⎟⎠
⎞⎜⎜⎝
⎛⎟⎟⎠
⎞⎜⎜⎝
⎛=
n
13nWindowIntegratio
1200
12nWindowIntegratio
1000
11nWindowIntegratio
tCurrenttanIns_Battery2000
31200
11200
2eargStoredCh_Battery
Control Software Design Considerations
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
76 Freescale Semiconductor Preliminary
The integration used to update the charge when the battery is delivering charge is:
The constants presented correspond to 7.2AH/10H batteries. Note the asymmetry between charging anddischarging constants.
To avoid deletion of the charge information when the system is powered down, the flags and integrators arestored in Flash memory. It is the operator’s responsibility to record this information in the system.
7.15 General Purpose Digital Filters Used in the Implementation
7.15.1 10Hz Low Pass Filter, 2 StagesWhen averaging is required in RMS and power sensing, a cascade of two 10Hz low-pass filters is implementedto minimize quantization effects.
Each stage corresponds to the digital implementation of a first-order Butterworth filter, with a 3dB cut-offfrequency of 10Hz.
The Laplace transfer function of the analog filter is:
Applying a bilinear transformation over the transfer function, with fs = 20kHz yields the Z-domain transferfunction:
The transposed direct form II is chosen for discrete time implementation using 32-bit registers for theaccumulators (w1 and w2):
Figure 7-23. Implementation of Low-Pass Filter
∑ ∑ ∑= = =
⎟⎟⎠
⎞⎜⎜⎝
⎛⎟⎟⎠
⎞⎜⎜⎝
⎛ −=
n
13nWindowIntegratio
1200
12nWindowIntegratio
1000
11nWindowIntegratio
tCurrenttanIns_Battery2000
30120
1500
2eargStoredCh_Battery
SxxsH9984310299.6102732.6)(
6
6
+=
1
133
99686.011056833.11056833.1)(
−
−−−
−+
=Z
ZxxZH
General Purpose Digital Filters Used in the Implementation
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
Freescale Semiconductor 77Preliminary
The calculated gains are:b0 = 1.56833408x10-3
b1 = 1.56833408x10-3
a1 = -0.996863
7.15.2 High-Frequency Noise Rejection FilterA second-order low-pass filter is used when high-frequency noise is to be rejected from the line signal (i.e.,before zero crossing algorithms).
The design starting point is an analog low-pass Butterworth filter with a 3dB cut-off at 1kHz. For asecond-order filter, the Laplace transfer function is:
Applying the bilinear transform to calculate a discrete time implementation yields:
For the accumulators (w1 and w2), 32-bit registers were chosen. To allow the implementation of a1 = -1.561,whose magnitude is greater than one, without losing the use of saturated arithmetic, the coefficients aremodified and shifts to the left are introduced, resulting in the following implementation of a transposed directform II:
Figure 7-24. Implementation of the High Frequency Reject Filter
The final gains used in this implementation are:b0 = 2.0083x10-2
b1 = 4.0165x10-2
b2 = 2.0083x10-2
a1 = -7.80509 x10-1
a2 = 3.206757 x10-1
161329
1672
104267.6104346.1106012.1104266.61044.1180)(
xSxSxxSxSSH
+++−
=
211
22122
104135.6561.11100083.2100165.4100083.2)(
−−−
−−−−−
+−++
=ZxZ
ZxZxxZH
Control Software Design Considerations
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
78 Freescale Semiconductor Preliminary
7.16 Flash Memory AccessFlash memory is used to store the charge value and flags controlling the battery load measurement. Theembedded bean functions SetLongFlash and GetLongFlash interface with Flash.
7.17 Development Tools Used for Software Implementation
7.17.1 Processor ExpertTM
Processor Expert beans have been used to initialize the internal PLL bus generator, ADC, PWMs, Timerinterruption, pulse generation, GPIO pins, interrupt vector and interrupt service routines.
7.17.2 Intrinsic 56800E FunctionsThe following functions from the “intrinsics_56800E.h” library are used:turn_on_sat();turn_off_conv_rndg();Word16 add(Word16,Word16);Word16 mult(Word16 , Word16);Word 16 msu(Word32,Word16,Word16);Word 16 sub(Word16,Word16);Word16 mac_r(Word32,Word16,Word16);Word16 abs_s(Word16)Word16 shlfts(Word16,Word16);Word16 msu_r(Word32,Word16,Word16);Word16 negate(Word16);Word32 L_mac(Word32,Word16,Word16);Word32 L_msu(Word32,Word16,Word16);Word32 L_mult(Word16,Word16);Word32 L_shifts(Word32, Word16)Word32 L_add(Word32, Word32);
These functions allow filter calculation using the 56800E core processor’s full set of features for fixed-pointarithmetic and saturation.
7.17.3 Direct Register WritesDirect write to configuration registers by the Processor Expert Support Library PESL was used in the followingcases:
• Timer C initialization• Enable and Disable Software control in the PWM module• Turning PWMs 0 and 1 off and on • PWM and Timer A duty cycle set up
7.17.4 Assembly InlinesNo explicit assembly inlines have been used in the C source code.
Implementation
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
Freescale Semiconductor 79Preliminary
8. Connectivity Software Design Considerations
8.1 Connectivity DescriptionThe OUPS’ connectivity allows the user to communicate with the board via the TCP/IP protocol, supportingsuch known standards as HTTP Web pages or e-mails.
The software used for OUPS connectivity will run on a 56F8346 controller, a member of the 56F8300 family.The 56F8346’s operational software is downloaded by the CodeWarrior IDE into the device’s internal Flashand executed from there. The TCP/IP stack software provides the functionality that allows remote UPSconfiguration and monitoring using transparent bi-directional transfer of Internet Protocol (IP) andTransmission Control Protocol (TCP) traffic between an HTTP client and the UPS unit across an Ethernetnetwork.
This software is based in OpenTCP Software, an open source project developed by Viola Systems. It brings ahighly reliable, portable TCP/IP stack for 8/16-bit microcontrollers. More information about OpenTCPsoftware can be found at: http://www.opentcp.org/.
For detailed documentation of the OpenTCP API, please refer to: http://www.opentcp.org/documentation/api/html/index.html
8.2 Peripheral and I/O Pins Assignment
8.3 ImplementationThe OpenTCP software allows an easy implementation for defining proper layers.
Figure 8-2 shows the implementation of the OpenTCP software for the 568F346.
Table 8-1. Digital Outputs and Inputs Used for Connectivity
Peripheral Port Function
A0-A15 Address Bus for Ethernet Controller
D0-D15 Data Bus for Ethernet Controller
CS2 Chip Select for Ethernet Controller
WR Write Signal for Ethernet Controller
RD Read Signal for Ethernet Controller
IRQA Interrupt Request from Ethernet Controller
Reset Reset
Connectivity Software Design Considerations
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
80 Freescale Semiconductor Preliminary
Figure 8-2. Implementation of OpenTCP for OUPS
8.3.1 LAN91C111 DriverThe LAN91C111 Ethernet Controller allows the processor to communicate with the Ethernet bus. Its driverhandles the proper initialization for a correct physical layer and the reception and transmission of packages.
8.3.2 Network BuffersThis block is the part of the OpenTCP port for the 56F8346 that handles the buffering of frames coming fromthe Ethernet Controller adapter. Ethernet frames travel up the stack in the form of special buffers, calledmBufs, special structures that include fields to support the OpenTCP macros to process a frame on abyte-by-byte basis.
8.3.3 Ethernet Abstraction LayerThe Network Adapter Block is the part of the TCP/IP stack that interfaces the packet processing portion of thestack to the actual Ethernet Controller. This block handles Ethernet frames coming and going through thenetwork. Incoming frames are detected by the Network Adapter Block and transferred to the top portion of theOpenTCP stack. The TCP/IP connectivity interfaces to the UPS control software by sending and receivingframes through the well-defined OpenTCP networking interface.
8.3.4 OpenTCP StackThe OpenTCP Stack is open source, reliable code which handles packet processing and allows a direct andstandard interface with the OUPS code.
LAN91C111 Driver (Ethernet Controller Driver)LAN91C111 Driver (Ethernet Controller Driver)
Ethernet Abstraction LayerEthernet Abstraction Layer
mBUFs Interface mBUFs Interface mBUF QUEUEmBUF QUEUE
Application Level ProcessingApplication Level Processing
OpenTCP StackOpenTCP Stack
Connectivity Initialization
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
Freescale Semiconductor 81Preliminary
8.3.5 Application Level ProcessingApplication functions are called by the OUPS and allow the OUPS to perform such required activities, asservicing HTTP Web pages or sending e-mails.
8.4 Connectivity InitializationConnectivity initialization is performed during the UPS initialization routine. All layers, from the lowest leveland continuing upwards, must be initialized properly in order to execute the application layers, which in thiscase are the HTTP Server and the SMTP Client.
Figure 8-3. Connectivity Initialization
8.4.1 System Services InitializationRoutines in Table 8-4 are performed to initialize system services for connectivity.
Table 8-4. System Services Initialization Functions
Function Description
void timer_pool_init(void) This function resets all timer counters to zero and initializes all timers to an available (free) state
void nBufInit(void) Initializes the memory buffer subsystem
Connectivity Software Design Considerations
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
82 Freescale Semiconductor Preliminary
8.4.2 Physical Layer InitializationTable 8-5 details routines used to initialize the Ethernet Controller and physical layer.
8.4.3 Network Layers InitializationRoutines in Table 8-6 are used to initialize all network layers.
8.4.4 Application Layer InitializationRoutines in Table 8-7 initialize the application layer. The OUPS works as an HTTP Server and an SMTPClient.
Table 8-5. Physical Layer Initialization Functions
Function Description
void eth_init( void ) Generic initialization for 56800E SMSC Ethernet boardsCalled from application start-up codeInitializes the Ethernet chip select, interrupt, etc.
void smc_init( void ) Initialization routine called by network device driver code
int smc_open( void ) Opens and initializes the SMC chip/board
Table 8-6. Network Layers Initialization Functions
Function Description
void arp_init (void) Call this function to properly initialize Address Resolution Protocol (ARP) cache table and so that ARP allocates and initializes a timer for its use
INT8 udp_init (void) Initializes User Datagram Protocol (UDP) socket pool to put everything into a known state at start up
INT8 tcp_init (void) Initializes all sockets and corresponding Transmission Control Blocks (TCBs) to a known stateTimers are also allocated for each socket and everything is brought to a predefined state
Table 8-7. Application Layer Initialization Functions
Function Description
INT8 https_init(void) Initializes the HTTP server
void smtpc_init (void) Initializes the SMTP client
Main Application
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
Freescale Semiconductor 83Preliminary
8.5 Main ApplicationAfter initialization, the software enters an infinite loop. During this loop, the OUPS will perform simplemonitor and control functions along with the main connectivity loop. The most critical section of control isexecuted in interrupt service routines, and these will always have the highest priority.
Figure 8-8 shows the tasks performed during the main application loop, although some of the activity isperformed in the interrupt context when the microcontroller receives an IRQA interrupt.
Figure 8-8. Main Application Diagram
8.5.1 Stack LoopDuring the infinite loop, the software will execute the steps outlined in Figure 8-9.
Connectivity Software Design Considerations
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
84 Freescale Semiconductor Preliminary
Figure 8-9. Main Loop Diagram
The defines in Table 8-10 are required for the main loop.
Table 8-10. Defines Used by Main Connectivity Loop
#define NETWORK_CHECK_IF_RECEIVED() ETH_Receive()
Description: Invoke this macro periodically to check if there is new data in the Ethernet controller
#define NETWORK_CHECK_IF_RECEIVED() ETH_Receive()
Description: Invoke this macro when the received Ethernet packet is no longer needed and can be discarded
Main Application
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
Freescale Semiconductor 85Preliminary
Routines in Table 8-11 are required for the main loop.
Table 8-11. Functions Used by Main Connectivity Loop
UINT8 process_arp (struct ethernet_frame* frame)
Description: Invokes the process_arp function when the ARP packet is received
INT16 process_ip_in (struct ethernet_frame* frame)
Description: Processes the IP packet received by checking necessary header information and storing it according to the received_ip_packet variable
INT16 process_icmp_in (struct ip_frame* frame, UINT16 len)
Description: Invokes the process_icmp_in when the IP datagram containing an ICMP message is detectedThis function checks the accuracy of and ICMP message received and sends ICMP replies when requested
INT16 process_udp_in(struct ip_frame* frame, UINT16 len)
Description: Invoke this function to process UDP frames received
INT16 process_tcp_in (struct ip_frame* frame, UINT16 len)
Description: Invoke this function to process TCP frames received
void arp_manage (void)
Description: Iterates through ARP cache aging entriesIf a timed-out entry is found, removes it (dynamic address) or updates it (static address)
void tcp_poll (void)
Description: Checks all TCP sockets and performs various actions if time-outs occurThe type of action is performed is defined by the state of the TCP socket
void https_run (void)
Description: This function is the main “thread” of the HTTP server program and should be called periodically from the main loop
void smtpc_run (void)
Description: This function is the main “thread” of the SMTP client program and should be called periodically when the SMTP client is active It is responsible for sending commands and data to the SMTP server and making callbacks to the user function stubs
Results
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
86 Freescale Semiconductor Preliminary
8.6 Interrupt HandlersThe connectivity software requires one interrupt from the Ethernet Controller. This interrupt is located inIRQA.
9. Results
9.1 Inverter PerformanceThe following parameters were measured using a Fluke 43B Power Quality Analyzer:
• RMS Amplitude• Real Power• Reactive Power• Total Power• Power Factor• Harmonic Distortion• Current Crest Factor
The following load types were connected at the inverter output for these measures:
• Linear Load: 110Ω• Nonlinear Load: A full-wave rectifier followed by 220µF capacitor and 330Ω in parallel• Full load: The linear load in parallel with the nonlinear load
The full load measurement was made under online (AC Main) and offline (battery operation) conditions.
Table 8-12. Interrupts Used by Connectivity Software
void smc_isr ( void )
Description: This interrupt can be called with any of the following sources:• Reception: A packet was received• Transmition Complete: When at least one packet transmission was completed or one of
the following errors occurs:—- Transmit Underrun—- SQE Error—- Lost Carrier—- Late Collision—- 16 Collisions
• Transmition Empty: Set if TX FIFO goes empty• Allocate: When TX ram pages are allocated correctly• Receiver Overrun: Receiver aborts due to an overrun caused by a failed memory
allocation, a packet is greater than 2Kb, or if a message was discarded• Ethernet Protocol Handler: Set when the Ethernet Protocol Handler detects a special
condition (LINK OK, Counter ROLL Over, etc.)• Early Receive Interrupt: Set when a packet is being received and the number of bytes
received exceeds a threshold• Physical Error: Set when one of several physical layer issues occur (LINK FAIL, Loss of
Synchronization, CodeWord Error, etc.)
Inverter Performance
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
Freescale Semiconductor 87Preliminary
9.1.1 Inverter Waveforms Under No Load Conditions
Figure 9-1. Inverter Waverforms—No Load
9.1.2 Inverter Voltage Harmonics Under No Load Conditions
Figure 9-2. Inverter Voltage Harmonics—No Load
Results
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
88 Freescale Semiconductor Preliminary
9.1.3 Inverter Waveforms Under Linear Load Conditions
Figure 9-3. Inverter Waveforms—Linear Load
9.1.4 Inverter Voltage Harmonics Under No Load Conditions
Figure 9-4. Inverter Voltage Harmonics Under Linear Load Conditions
Inverter Performance
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
Freescale Semiconductor 89Preliminary
9.1.5 Inverter Waveforms Under Full Load Conditions—Battery Operated
Figure 9-5. Inverter Waveforms Under Full Load Conditions—Battery Operated
9.1.6 Inverter Voltage Harmonics Under Full Load Conditions—Battery Operated
Figure 9-6. Inverter Voltage Harmonics—Full Load, Battery Operated
Results
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
90 Freescale Semiconductor Preliminary
9.1.7 Inverter Transient Response—60W Cold Bulb
Figure 9-7. Inverter Transient Response—60W Bulb
9.1.8 Inverter Transient Response to a Resistive Load (200W)
Figure 9-8. Inverter Transient Response—Resistive Load (200W)
PFC Performance Measurements
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
Freescale Semiconductor 91Preliminary
9.2 PFC Performance MeasurementsThe following parameters were measured using a Fluke 43B Power Quality Analyzer:
• RMS Amplitude• Real Power• Reactive Power• Total Power• Power Factor• Harmonic Distortion
Loads connected to the PFC for measurements:
• Inverter with full load plus battery charger• Inverter with linear load plus battery charger• Inverter with no load plus battery charger
For all measurements, the inverter was phase and frequency locked to the AC main line (60Hz).
9.2.1 PFC Performance Under Full Load Conditions
Figure 9-9. PFC Waveforms—Full Load Conditions
Results
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
92 Freescale Semiconductor Preliminary
9.2.2 PFC Performance at 298W Linear Load Conditions
Figure 9-10. PFC Waveforms—Linear Load Conditions (298W)
9.2.3 PFC Performance at 59W Linear Load Conditions
Figure 9-11. PFC Waveforms—Linear Load Conditions (59W)
Frequence Performance
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
Freescale Semiconductor 93Preliminary
9.2.4 PFC—Transient Response to a Load Step
Figure 9-12. PFC Performance—Transient
9.3 Frequence PerformanceFreerun Output Frequency: 60.0105Hz
Figure 9-13. Freerun Frequency Measurement
Results
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
94 Freescale Semiconductor Preliminary
9.4 Battery Charger Performance
9.4.1 Battery Charger Performance, Current and Voltage Waveforms
Figure 9-14. Battery Charger Performanc—Charging
9.4.2 Battery Charger—Floating Conditions
Figure 9-15. Battery Charger—Floating
Bypass Switch Performance
Network-Enabled High-Performance Triple Conversion UPS, Rev. 1
Freescale Semiconductor 95Preliminary
9.5 Bypass Switch Performance
9.5.1 Inverter Bypass Switch Operation
Figure 9-16. Bypass Switching Time
10. References1. 56F8300 Peripheral User Manual, MC56F8300UM
2. 56F8346 Data Sheet Preliminary Technical Data, MC56F8346
To provide the most up-to-date information, the revision of our documents on the World Wide Web will be themost current. Your printed copy may be an earlier revision. To verify that you have the latest informationavailable, refer to www.freescale.com or contact your Freescale representative.
How to Reach Us:
Home Page:www.freescale.com
E-mail:[email protected]
USA/Europe or Locations Not Listed:Freescale SemiconductorTechnical Information Center, CH3701300 N. Alma School RoadChandler, Arizona 85224+1-800-521-6274 or [email protected]
Europe, Middle East, and Africa:Freescale Halbleiter Deutschland GmbHTechnical Information CenterSchatzbogen 781829 Muenchen, Germany+44 1296 380 456 (English)+46 8 52200080 (English)+49 89 92103 559 (German)+33 1 69 35 48 48 (French)[email protected]
Japan:Freescale Semiconductor Japan Ltd.HeadquartersARCO Tower 15F1-8-1, Shimo-Meguro, Meguro-ku,Tokyo 153-0064, Japan0120 191014 or +81 3 5437 [email protected]
Asia/Pacific:Freescale Semiconductor Hong Kong Ltd.Technical Information Center2 Dai King StreetTai Po Industrial EstateTai Po, N.T., Hong Kong+800 2666 [email protected]
For Literature Requests Only:Freescale Semiconductor Literature Distribution CenterP.O. Box 5405Denver, Colorado 802171-800-441-2447 or 303-675-2140Fax: [email protected]
Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners.This product incorporates SuperFlash® technology licensed from SST.
© Freescale Semiconductor, Inc. 2005. All rights reserved.
AN3113Rev. 107/2005
Information in this document is provided solely to enable system and software implementers to use Freescale Semiconductor products. There are no express or implied copyright licenses granted hereunder to design or fabricate any integrated circuits or integrated circuits based on the information in this document.
Freescale Semiconductor reserves the right to make changes without further notice to any products herein. Freescale Semiconductor makes no warranty, representation or guarantee regarding the suitability of its products for any particular purpose, nor does Freescale Semiconductor assume any liability arising out of the application or use of any product or circuit, and specifically disclaims any and all liability, including without limitation consequential or incidental damages. “Typical” parameters that may be provided in Freescale Semiconductor data sheets and/or specifications can and do vary in different applications and actual performance may vary over time. All operating parameters, including “Typicals”, must be validated for each customer application by customer’s technical experts. Freescale Semiconductor does not convey any license under its patent rights nor the rights of others. Freescale Semiconductor products are not designed, intended, or authorized for use as components in systems intended for surgical implant into the body, or other applications intended to support or sustain life, or for any other application in which the failure of the Freescale Semiconductor product could create a situation where personal injury or death may occur. Should Buyer purchase or use Freescale Semiconductor products for any such unintended or unauthorized application, Buyer shall indemnify and hold Freescale Semiconductor and its officers, employees, subsidiaries, affiliates, and distributors harmless against all claims, costs, damages, and expenses, and reasonable attorney fees arising out of, directly or indirectly, any claim of personal injury or death associated with such unintended or unauthorized use, even if such claim alleges that Freescale Semiconductor was negligent regarding the design or manufacture of the part.