Home
AN4449 - STMicroelectronics
Contents
1. lt T AN4449 SLi a Application note Buck boost converter using the STM32F334 Discovery kit Introduction This application note describes the buck boost DC DC converter included in the STM32F334 Discovery kit 32F3348DISCOVERY a low cost and easy to use development kit to quickly evaluate and start application development with microcontrollers of the STM32F3 series The STM32F334xx ARM Cortex M4 microcontrollers combining high integration and performance have been designed for digital power conversion applications and this buck boost DC DC converter illustrates how they can efficiently control an H bridge topology converter This application note demonstrates how the STM32F334xx products meet the needs of this function thanks to their embedded high resolution timer HRTIM and the settings flexibility adapted for such switching based converter application This demonstration example needs an external power supply that will be connected independently from the mini B USB cable connected to the host PC The firmware associated to this example needs to be programmed into your STM32F334 Discovery kit prior to the demonstration Reference documents e UM1733 Getting started with STM32F334 Discovery kit e DB2343 Discovery kit for STM32F334 microcontrollers e UM1735 Discovery kit for STM32F3 series with STM32F334C8 MCU User Manual These documents are available on STMicroelectronics web site http www st com Before install
2. Once the converter has started the signal LEDs green blue orange and red are active and the following displays are observed according to Vin VouTr conditions and to context Standard operation Figure 18 Green LED toggles for buck mode Blue LED toggles for boost mode both Green and Blue LEDs toggle for mixed mode Figure 18 Signal LEDs during standard operation a cja oe W BUCK MODE MIXED MODE BOOST MODE LD5 toggling LD5 amp LD6 toggling LD6 toggling MS35828V 1 Limited operation Figure 19 The same display is performed but the Orange LED is also toggling when converter operates near maximum duty cycles limits Application can sustain such conditions above 95 of allowed operation range but user is warned that operating limits are close Figure 19 Signal LEDs during limited operation a e BUCK MODE MIXED MODE BOOST MODE LD5 toggling LD5 amp LD6 toggling LD6 toggling LD4 fast toggling LD4 fast toggling LD4 fast toggling MS35829V1 7 DoclD025970 Rev 1 AN4449 Application description e Stopped Operation Figure 20 A fault condition has been detected into the converter Orange LED toggling Vin is not in the expected range 3 15 V nc Red LED toggling Converter stopped PI controller limits reached for a given time Overload detected current exceeds limit Software initialization fault Figure 20 Signal LEDs during fault condition a
3. Po VIN CONVERTER STOPPED OUT OF RANGE OVERLOAD DETECTED LD4 toggling LD3 toggling MS35830V 1 DoclD025970 Rev 1 25 34 s Firmware description AN4449 2 2 1 26 34 Firmware description STM32F334xx peripherals used by the application This application example uses the following STM32F334xx peripherals with the settings described below GPIOs GPIOs are essentially used for the 4 signal LEDS and few others for further development or debug purposes e PB6 to PB9 set as output GPIOs to drive the signal LEDs e PAO set as input GPIO and connected to the User push button B1 but the button function is not implemented yet in this example Users can place their own code into the mentioned section if needed ADC ADC peripheral manages Vin and V our 12 bit ADC sampling An ADC calibration is performed at application startup Two channels are used in injected conversion mode with different sampling times according to respective Vin and Vour hardware adaptation The ADC conversion is triggered by the HRTIM Timer A compare event CMP4 at every PWM period and the Vin and VouT conversions stored HRTIM High resolution timer As mentioned earlier in overview section the high resolution timer is connected to the power interface of the DC DC buck boost converter The 4 HRTIM TA1 TA2 TB1 TB2 outputs are used for the 4 PWM signals generation of the H bridge topology converter In debug mode HRTIM Tim
4. based on ADC inputs The input or output currents are not sensed by any hardware current sensing method series sense resistor MOSFET current sensing current transformers etc but evaluated by a software solution described later in this document For safety reasons users must not modify the current design and must comply with firmware operating limitations Moreover USB voltage source is not recommended as an alternate power supply source for Vj as this can damage the board or the host USB PC port if a high current is forced in the converter DoclD025970 Rev 1 7 34 Application description AN4449 1 4 2 Note 8 34 Non inverting buck boost converter basics Step down operation buck mode This mode operates when V n gt gt Vour target and when the converter lowers the input voltage level As shown in Figure 4 TA1 and TA2 are two PWM signals generated by the HRTIM and act together as complementary signals As evidenced by the converter topology two transistors from a same leg cannot be switched at the same time thus risking to create a short circuit on the power line Therefore Q1 and Q2 cannot be turned ON together and must be managed one by one with the HRTIM peripheral by inserting dead time periods between conductions of Q1 and Q2 as shown in Figure 5 When Q1 is closed the inductor charge phase is observed When Q2 is closed at its turn the inductor discharge phase can start On the right side of the H bridge Q
5. theoretical duty D is 3 15 0 2 Based on these parameters and from the initial equation di pel dt The inductor L estimation value can be calculated with the formula below Lun gt LU Tou p l Fpwm Tripple L min gt ee joy 64uH 250000 0 5x0 3 For the boost mode the input and output ranges are similar and the formula is now Vin Vout Vin l L min gt F T Fpwm Vout Tripple The chosen value is L 82 uH with a resistance n of 460 mQ typical and typical saturation current of 1 1 A Setting the STM32F334 High resolution timer This section describes how the STM32F334 high resolution timer is set for this application example As described above the N and P MOSFETs of the H bridge converter are each ones assigned to one of the HRTIM outputs For the buck right side there are TA1 and TA2 PWM waveforms connected to the buck leg and for the boost left side TB1 and TB2 PWM waveforms connected to the boost leg TA1 and TA2 as well as TB1 and TB2 act as complementary signals There are 4 modes that control the buck boost converter as described in Tapie 7 7 DoclD025970 Rev 1 AN4449 d Application description Table 1 HRTIM output signals through operating modes HRTIM Converter mode output IDLE BUCK MIXED BOOST PMA PMA ana Ys me S pe Ye IDLE mode is a waiting mode when only timers A and B have been started but none of the outputs has been set yet As soon as outputs from Ti
6. 29 3 DC DC converter main electrical characteristics 31 4 eelte IE ei EER EN OT EE EE EE EE OR EF 32 5 Revision history soas vae de sed dee re OD RE Ee De Ee re NEE le 33 2 34 DocIDO25970 Rev 1 yy AN4449 List of tables List of tables Table 1 HRTIM output signals through operating modes SE SES SS SE SS ees 15 Table 2 Event settings through operating modes 0 SES ES SS ee ee 15 Table 3 Collection table for buck mode ee ee nee 18 Table 4 Collection table for boost mode ee eee 18 Table 5 Collection table for mixed mode 1 SEE SE SE SS ee eee 19 Table 6 Main electrical characteristics ee ee ees 31 Table 7 Document revision history 0 0 ee eee as 33 LST DocID025970 Rev 1 3 34 List of figures List of figures Figure 1 Figure 2 Figure 3 Figure 4 Figure 5 Figure 6 Figure 7 Figure 8 Figure 9 Figure 10 Figure 11 Figure 12 Figure 13 Figure 14 Figure 15 Figure 16 Figure 17 Figure 18 Figure 19 Figure 20 Figure 21 Figure 22 4134 AN4449 Connecting the external power supply naana ee eee 5 Overview of STM32F334 Discovery KI ES ESE EE SE eee 6 STM32F334 Discovery Buck Boost converter topology ESE EES EES Es eee 7 Step down operation buck mode SEE SE SS ee eee ee 8 Step down operation signals buck mode ESE SS SS SE SS SE SE es ee 8 Step up operation boost mode ESE EE
7. 4 is maintained closed and Q3 open during all buck operating phase In figures 4 and 5 the same color scheme has been used to indicate current flows Figure 4 Step down operation buck mode Icharge MS35814V1 dead time dead time nia ripple t MS35815V 1 7 DoclD025970 Rev 1 AN4449 Application description During charge phase Q1 is closed and the Vin voltage is applied to the inductor The current flows through the inductor and the output capacitor is charged through the ground If the voltage across Q1 and Q4 are ignored ideal switches the relation between Vin Vout L and the current flowing through L can be expressed by the formula below EE Le dt During discharge phase Q1 is open and the current continues to flow through Q2 now closed and through the inductor In this condition and with Q2 and Q4 drop voltages ignored as well the formula between the current L and V our becomes a 1 dt If the HRTIM PWM switching period is Tpwry in seconds then the charge phase toy and the discharge phase torr are linked together by the formula ton torr TPwyM The PWM duty cycle is the ratio of time when Q1 is turned ON over the total Tpwpm period D is always included between 0 and 1 It can be expressed as ON D TPwM When Q1 is turned OFF the OFF time is equivalent to torr 1 D xXTpwa Consid
8. Rev 1 yy AN4449 Application description To compute the polynomial interpolation based on Lagrange s interpolation at least 4 distinct points are extracted from the raw table This operation results in 4 polynomial factors from degree included between 0 and 3 that are combined to get the final equivalent function As for instance 4 points coordinates are extracted from the first buck curve p1 5 13605 p2 8 8521 p3 11 6285 p4 15 4731 Please notice that all duty values are expressed for a whole PWM period equal to 18432 units This number corresponds to 4 us multiplied by the timer frequency equivalent to 144 MHz X 32 The corresponding duty cycle for 13605 is indeed 13605 18432 73 After Lagrange s interpolation is computed the equation of the interpolated curve is 13513 130918 4 7199839 695647 L x xXx xXx EKKE 1260 315 1260 21 Finally these factors are arranged and simplified to limit the amount of data stored in software tables with a slight loss of accuracy for the last constant term This gives L x 10 725x x 415 612xx 5714 157x x 33126 047 The data stored in table for the equation curve corresponding to Vour 3 V for the buck mode will be 10725 415612 5714157 33126 From these data the curve equation can be retrieved easily and the last required operations will be performed by the MCU to calculate the corresponding duty from an input value of Viy It s now p
9. SE SS SE SS SE eee ee 10 Step up operation signals boost mode EES ESE ee eee 10 Buck boost operation mixed mode 0 0 0 ccc eee eee 11 Buck boost cascaded transfer functions SEE SE SS SS es 12 Operating modes according to Vin level EE SE ee 12 Buck boost operation signals mixed mode 0 000 eee eee eee 13 ADC trigger event configuration in buck and boost modeS SESSE es see 16 DC DC converter characterization ESE SE SS ES ee ee eee 17 Duty cycle value vs Vin for a given V our in buck mode 0 00 2 eee eee 19 Duty cycle value vs Vin for a given V our in boost mode 0 00 eee 20 Duty cycle value vs Vin for a given Vour in mixed mode is see ee ee se 20 PI software controller ici anda ta HE et di RR SR RED wed aw RE EME baw ei es 22 Signal LEDs during standard operation 0 0 0 0 ES SS SE SS SS ee ees 24 Signal LEDs during limited operation SESSE SS SS SS es 24 Signal LEDs during fault Condition SESSE SS SS SS ees 25 Mame eien OE EE na EO So oe EO Be ORE oe EK 28 HRTIM1 TIMA IROHandler flowchart SS SS SE SS SS eee 29 DoclD025970 Rev 1 AN4449 1 1 1 Caution Note 1 2 Application description Application description Required hardware This application uses STM32F334 Discovery kit on board buck boost DC DC converter and 4 signal LEDs LD3 to LD6 An external DC power supply 0 15 Vpc 1 A max is required for t
10. and TB2 In this application example during buck boost operation the buck duty cycle is maintained fixed while the boost duty cycle is variable according to Vin and Vour conditions Figure 8 Buck boost operation mixed mode MS35818V1 In the buck boost mode both operations are cascaded Considering the buck mode as a transfer function f1 with D1 as an input parameter and the boost mode as a transfer function f2 with D2 as an input parameter the equivalent scheme shown in Figure 9 can be applied DoclD025970 Rev 1 11 34 Application description AN4449 12 34 Figure 9 Buck boost cascaded transfer functions BUCK f1 BOOST f2 Di D2 MS35819V1 Now applying the consecutive equations for buck and boost converters V0 f D1 xVin and Vout f2 D2 xV0 then the global transfer function f is Vout _ ADI D2 f D x f2 D2 Vin As the transfer functions based on the converter duty cycles for buck and boost have been mentioned above in this document this finally gives for the buck boost converter mode Vout l DI Dlx Vin 1 D2 1 D2 As an example setting D1 buck duty cycle to 0 8 fixed with a variation of D2 boost duty cycle between 0 05 and 0 45 allows to have a Voyt Vin ratio varying from 0 85 to 1 45 thus covering the entire range of VouTr close to Viy The purpose is to ha
11. at makes this buck boost converter application example easier to develop It also demonstrates its ability to setup and switch from one running configuration to another in one PWM cycle time This demonstration firmware combined with the low cost and high performance STM32F334 Discovery kit are the easiest ever distributed tools on how to get started with STM32F334xx microcontroller and to experience its power oriented solutions based on the brand new high resolution timer 7 DoclD025970 Rev 1 AN4449 Revision history 2 Revision history Table 7 Document revision history owe lees ee 08 Sep 2014 Initial release DoclD025970 Rev 1 33 34 d AN4449 IMPORTANT NOTICE PLEASE READ CAREFULLY STMicroelectronics NV and its subsidiaries ST reserve the right to make changes corrections enhancements modifications and improvements to ST products and or to this document at any time without notice Purchasers should obtain the latest relevant information on ST products before placing orders ST products are sold pursuant to ST s terms and conditions of sale in place at the time of order acknowledgement Purchasers are solely responsible for the choice selection and use of ST products and ST assumes no liability for application assistance or the design of Purchasers products No license express or implied to any intellectual property right is granted by ST herein Resale of ST products with provisions differen
12. clD025970 Rev 1 21 34 Application description AN4449 1 4 6 22 34 has targeted Vour 5 7 V then the duty cycles from adjacent curves or lines for 5 and 6 V are computed with Vj value and a linear interpolation is performed to find the nearest approximation of maximum duty cycle Basically for a given mode the application uses the corresponding equation to evaluate the maximum duty cycle admissible for the running operation Subsequently the value of the duty cycle applied into the converter is compared with the value of the computed duty cycle limit If the duty cycle applied into the converter exceeds the value of the theoretical limit for a given time then the converter is stopped and the overload is detected As a drawback there is no possibility to change the overload limit as the data entered into tables then the interpolation functions have been characterized for a defined current value Nevertheless this method does not use external hardware that would degrade converter efficiency such as current sense resistors but can be easily used for current limitation purpose This allows stopping the converter and anticipating any hardware damages if an external output load is forcing the converter beyond its capability PI software regulation This DC DC converter uses the measured and the target Vour voltages to set the converter duty cycle in the corresponding operating mode As mentioned earlier the ADC peripheral is regularl
13. e N and P MOS switches of H bridge converter The P MOSFE Ts are not directly connected to the high resolution timer but interfaced with level shifters while the logic level N MOSFE Ts are directly controlled by the MCU These level shifters are made up of a bipolar totem pole driver Please refer to UM1 735 for further details on converter schematics The buck leg left side of H bridge is driven by TA1 for the PMOS and TA2 for the NMOS signals from HRTIM high resolution timer and the boost leg right side of H bridge is driven by TB1 for the NMOS and TB2 for the PMOS signals from HRTIM This converter structure uses 4 MOSFET switches to allow synchronous rectification that improves converter efficiency and thermal performance This consists to replace the rectification diodes commonly used in buck or boost converter stages by MOSFET transistors ensuring the current rectification and providing better efficiency in low output voltage and high current power supplies The conduction losses in the freewheeling diodes can represent a significant part of the power losses of switching converters The internal HRTIM PWM switching frequency is 250 kHz Both Vin and VouTr signals are sensed by the ADC peripheral and the varying error vs the Vour target is evaluated This mode is called voltage mode control as the output regulation is based on voltage measurement The PWM duty is then computed internally by a proportional integral controller PI
14. er D is also used to highlight ADC conversion trigger event on TD1 DEBUG variable in firmware header must be set accordingly A HR TIM DLL calibration is performed at the beginning of HRTIM initialization function duration 14 us The HRTIM frequency is set to 250 kHz period t 4 us and determines the main switching frequency of the buck boost converter The repetition counter for HRTIM Timer A is set to have an ISR every 8 PWM periods 4 us x 8 32 us It can be easily lowered up to 4 if the overload protection is removed this is freeing some MCU activity during interrupt routine The converter uses 4 different modes that need special initialization functions such as Idle Buck Mixed and Boost By these dedicated functions the HRTIM outputs are configured to select the set and reset sources combined with related events As a requirement of this application example HRTIM Timer A and B use dead time configuration to set rising and falling dead times This prevents overlap of switching command from MOSFET transistors from a same leg 7 DoclD025970 Rev 1 AN4449 2 1 1 d Firmware description Please refer to Section 1 4 4 Setting the STM32F334 High resolution timer for further information Interrupts As a major process of this application firmware the HRTIM Timer A interrupt HRTIM1 TIMA IROHandler manages all relative tasks to the converter The PI functions are called from this interrupt routine and the conver
15. ering that the average voltage across the inductor L is zero during a whole PWM period and to prevent any saturation into the coil the relation between Vin and Vour for the step down converter buck mode is Dx Vin Vout 1 D x Vout 0 DxVin D x Vout Vout Dx Vout 0 This sums up to V out oo Vi Step up operation boost mode This mode operates when Vin lt lt Vour target and when the converter raises the input voltage level As shown in Figure 6 TB1 and TB2 are two PWM signals generated by the HRTIM and are working together as complementary signals As it was the case in the buck mode and for the same H bridge leg Q3 and Q4 cannot be turned ON at the same time as shown in Figure 7 When Q3 is closed the inductor charge phase takes place When Q4 is closed the inductor discharge phase starts On the left side of the H bridge Q1 is maintained closed and Q2 open during all boost operating phase DocID025970 Rev 1 9 34 Application description AN4449 Note In figures 6 and 7 the same color scheme has been used to indicate current flows Figure 6 Step up operation boost mode Idischarge Icharge MS35816V1 Figure 7 Step up operation signals boost mode dead time dead time d T ripple MS35817V1 During charge phase Q3 is closed and the Vin voltage is applied on the inductor through the gr
16. esents a curve for each Vour value chosen where other functions for respectively boost Figure 15 and mixed Figure 16 modes as f2 D2 and f D1 D2 are equivalent to simple lines Figure 14 Duty cycle value vs Vin for a given Vour in buck mode Buck mode Vouts 3v Vout dy oe Vout BY Vout BV Vout TY out BY Vout SUT TOUL j Vout 11V Wout j DocID025970 Rev 1 19 34 Application description AN4449 Figure 15 Duty cycle value vs Vin for a given Vour in boost mode Boost mode Wout BV Wout 4y Vout SV Vout GV Vout 7V Vout BV Vout SV Vout 10 Vout 11 Vout 12 Wout 13 Vout 14y Vout 15 Figure 16 Duty cycle value vs Vin for a given Vour in mixed mode Mixed mode UY The goal is to have all these data stored in three different tables by keeping as information only the curve or line equations needed to calculate the corresponding duty cycle for the running Vin Vout pair For the buck mode the equations of these curves are computed with polynomial interpolation while for both boost and mixed modes only regression lines calculation is necessary Vout SV TM GUL S AV Yout SV Vout BV Vout 7V Vout BV Vout 9y Vout 10V Vout 11V Vout 12 Vout 13 Vout 14y Ss Vout 15 20 34 DoclD025970
17. he demonstration The external power supply will be connected to CNS Vin connector while the Voyr signal will be present on CN7 The user will manage externally the current limitation to approximately 500 mA even if an internal protection against overload is included in this firmware demonstration Please comply with Vin polarity when connecting the power supply as well for Voy7 when connecting an external load or metering tools as shown in Figure 1 Figure 1 Connecting the external power supply FROM EXTERNAL POWER SUPPLY BUCK BOOST DC DC CONVERTER MS35811V 1 This example and its hardware are totally independent from high brightness LED features described in other documents Hardware settings of the STM32F334 Discovery kit The SBx solder bridges should be set in their initial factory configuration The user will possibly connect an external current probe on CN6 pads to observe the inductor L3 current during operation In that case SB22 must be removed on the board bottom side Refer to STM32F334 Discovery kit user manual UM1735 for further information related to hardware DoclD025970 Rev 1 5 34 Application description AN4449 1 3 1 4 1 4 1 6 34 Application schematics Figure 2 shows the description of STM32F334 Discovery kit hardware Figure 2 Overview of STM32F334 Discovery kit Push buttons Signal Reset LEDs Buck Boost DC DC Conver
18. he different modes The input range Vj is included between 3 to 15 Vpc as well as for the output range For each Vin Vout pair the converter applies the function f1 D1 or f2 D2 or f D1 D2 f1 D1 X f2 D2 according to the Vij Vour ratio and the selected operating mode buck boost or mixed The results are represented graphically in Table 3 Table 4 and Table 5 related to the three operating modes In each table cells in green allow to easily identify the operating area for the concerned mode for readability purposes duty cycles values have been removed In these tables Vin and Vour are both expressed in Volts As an example the duty cycles values YO to Y12 are obtained by f1 function y0 NA yl f1 4 3 y2 f1 5 3 etc y12 f1 15 3 DoclD025970 Rev 1 17 34 Application description AN4449 Table 3 Collection table for buck mode The same duty cycle collections are gathered for boost and mixed modes Table 4 and Table 5 respectively All these modes are indeed slightly overlapped together Table 4 Collection table for boost mode VIN 18 34 DoclD025970 Rev 1 yy AN4449 Application description Table 5 Collection table for mixed mode Going further if the duty cycle values extracted from a same row table YO Y1 Y2 etc up to Y12 are represented into a graph it can be observed a corresponding curve or line for any row of the table As shown in Figure 14 every buck function f1 D1 repr
19. in mV is mentioned define REAL 3V3 uint16 t 3300 For accuracy purpose this variable can be replaced by the current value of 3V3 voltage of the STM32F334 Discovery kit A small variation on the 3V3 regulator can be detected this parameter is used to account for it and must be replaced by the actual value of the 3V3 that can be measured with a voltmeter connected in parallel with C19 capacitor Otherwise this value must be left as default There are 2 remaining constants in main h file that can be precisely set for compensation of Vin and Vour resistors bridges The user has to measure respectively Vin and R45 voltages and Vour and R46 voltages The VIN RESISTOR RATIO is obtained by computing VR45 VIN 10000 similarly the VOUT RESISTOR RATIO uses VR46 VOUT 10000 For instance the user sets precisely Vin voltage to 10 V and reads the voltage value on R45 e g VR45 2 010 V In this case VIN RESISTOR RATIO is 2 010 10 10000 2010 For Vour the user reads both V our and R46 voltage and computes similarly the VOUT RESISTOR VALUE New computed values are replaced in constants definition otherwise these values must be leit as default ones as shown below qderine VIN RESISTOR RATIO uintl6 t 2012 define VOUT RESISTOR RATIO uint16 t 1988 DoclD025970 Rev 1 23 34 Application description AN4449 24 34 A load or any electrical component complying with converter output characteristics can be connected to Voyrt
20. ing and using the product please accept the Evaluation Product License Agreement from http www st com epla For more information on the STM32F334 Discovery board and for demonstration software visit www st com stm32f3discovery September 2014 DoclD025970 Rev 1 1 34 www st com Contents AN4449 Contents 1 Application description lt lt e e 5 1 1 Required hardware SS SS SE SE eee ee eee 5 1 2 Hardware settings of the STM32F334 Discovery kit 5 1 3 Application schematics 0 0 0 cc ee eee 6 1 4 Application principles EES ESE ee eee 6 1 4 1 OVCIVICW wos TER EE OR E oa Son hee ee ee be R E T EE N 6 1 4 2 Non inverting buck boost converter basics SS ESE SS see 8 1 4 3 Sizing the inductor of the buck boost converter ss ss 14 1 4 4 Setting the STM32F334 High resolution timer 14 1 4 5 Software overload protection 0000 eee ees 16 1 4 6 PI software regulation SESSE SS SE ee eee 22 1 4 7 Getting started with the application EE EE EE es ee ee 23 2 Firmware description 0000 EE EE EE EE ees 26 2 1 STM32F334xx peripherals used by the application 26 2 1 1 Setting define constants EE EE SE Es eee 21 2 2 Application flowcharts description EE SE EE EE EE EE eee 28 2 2 1 Application main c flowchart 0 0 0 0 ccc ee eee 28 2 2 2 Application HRTIM1_TIMA_IRQHandler flowchart
21. iption Therefore the application cannot anticipate itself the approximate value of the output current based on the running mode and the duty cycle applied during operation The idea is to have this information available and stored into the microcontroller memory by anticipating the efficiency based on the real case operation For this purpose the following configuration is set as in Figure 73 Figure 13 DC DC converter characterization DC DC Vin converter ne A f1 D1 Tf2 D2 MS35823V 1 This DC DC converter has been designed to have a typical current of 0 5 A for both lin and lout The idea is to characterize the application in the different operating modes according to various Vin Vour ratios different Vin Vout pairs are applied to the converter and two ammeters inserted on input and output lines For each pair of voltage values the variable Zload Impedance is adjusted so that lin and lout are always within the desired range As an example an input voltage of 10 Vpc is applied on Vin and Vour target is set to 5 Vpc The impedance load is tuned to obtain lout 0 55 A The duty cycle is recorded for the operating point Vin 10 V Vour 5 V Similarly for another Vin Vout pair this time in boost mode the impedance load is tuned to have lin not exceeding 0 55 A Thus a raw table containing duty cycles D1 or D2 is reported for each Vin Vout pair This allows determining the functional mapping for t
22. low value and then the converter may be stopped immediately DoclD025970 Rev 1 yy AN4449 1 4 7 9 Application description This method ensures fast response from converter and shuts it down as for instance when a short circuit is present on V our signal output These counters are also used to detect that one operating mode has reached its own operating limits and to accordingly manage the converter mode changes Getting started with the application As soon as the buck boost firmware has been programmed into the microcontroller the application is ready to start As mentioned in Section 1 1 Required hardware an external power supply is needed for the demonstration and the mini B USB cable connected on the PC side In order to start the converter follow the steps 1 connect the mini B USB cable 2 connect the external power supply to CNS connector Viy 3 press the B2 button to reset the microcontroller The Vour target value is set by the firmware and can be modified manually for all other values included from 3 to 15 Vpc This modification has to be performed in main h file containing the V our target parameter as shown below define VOUT TARGET uint16 t 5000 Please notice that this value is expressed in mV There is an optional update of the firmware that can be done which consists in entering the real value of application 3V3 reference voltage In the same main h file the following parameter always expressed
23. mer A or Timer B are controlled there is one state configured for the timer period event and another one configured for a compare event or a few ones The PWM period is selected to 4us fpwyy 250 KHz Each 4 us the timer period event occurs Since both timer A and timer B are synchronized together the period event is common for the 2 timers To activate the related outputs to timer A and B one or more compare events is are created as shown in Table 2 Table 2 Event settings through operating modes Converter mode ALL BUCK MIXED BOOST CMP1 CMP2 CMP4 CMP1 CMP2 CMP4 CMP1 CMP2 CMP4 TimerA 4 US DutyA ae DutyA oe AUG trigger trigger trigger DutyB T B 4 DutyB Sliding ADC trigger event Switching converters generate noise on the power lines due to the fast switch of the power MOSFETs Nevertheless the application has to measure regularly the values of Vin and Vout voltages during operation and potentially during switching time periods According to the different operating modes buck mixed and boost modes there are various switching events on the timers outputs that can degrade the ADC measure when performed at a regular time without looking at conditions on HRTIM outputs For instance if the ADC measure is defined at the half of the PWM period while the duty cycle of an HRTIM output signal reaches 0 5 both ADC and switching event are performed at the same time To ensure that the ADC meas
24. nd boost modes ADC trigger event ton 2 ADC trigger event tpwy tore 2 t t ON a B OFF Duty cycle gt 0 5 Duty cycle lt 0 5 MS35822V1 1 4 5 Software overload protection Buck boost converters generally use different methods to evaluate the load current sourced by the converter There are several means but the most common method is to sense the load current with a current sense resistor inserted serially into the output circuitry This allows controlling the maximum inductor current and to prevent any overload conditions The drawback is to introduce power losses caused by the inserted resistor and resulting in a lower converter efficiency Even if there are lossless current sensing methods here a different approach has been used for this application example As described above in step up or step down operations in buck boost basics chapter the theoretical duty cycle is known for a given operating mode buck boost etc and can be calculated by the Vin Vour ratio applied onto the converter As for instance a 10 Vpc input voltage can be converted into 5 Vpc output voltage with a duty cycle equal to 0 5 buck mode This basic assumption does not take into account the DC DC converter efficiency for a given output load current The relation for buck mode is actually where n is the efficiency factor V out in xn D 7 16 34 DoclD025970 Rev 1 AN4449 Application descr
25. o rise at a minimum level This is to distinguish a situation where the maximum duty cycle is requested to reach the target rapidly but also when the maximum duty cycle is applied and unfortunately Vour signal does not show any variation In the first situation the buck mode will change to the mixed mode while for the second one the converter will be stopped as a fault has appeared Basically the duty cycle high and low limits for each mode are defined as main variables into the firmware based on the performances of this converter As the 3 converter modes have adjacent operating area the converter has to move from one mode to another when it reaches the operating limits of its own mode precisely when counters CTMax and CTMin inform that a maximum or minimum duty cycle order is permanently returned by the PI controller Any converter mode change is actually triggered by the overflow of CT Max or CTMin Regarding fault detection the overload limit which is computed by the interrupt software is performed in two steps The first step consists to collect the data from the relevant table and applying the right calculation according to the interpolation type The second step is a common part of the interrupt task and checks for any duty cycle value that would exceed the overload limit If the applied duty cycle operates near limits then users are alerted by a display If the applied duty cycle exceeds the overload limit for a specified time then the con
26. ossible to calculate any duty cycle for the buck mode for the Vin range 3 15 Voc Which would be the duty cycle for Vin 9 V to obtain Vour 3 V in buck mode This means for the MCU to extract the 4 factors and to calculate L 9 10 725x 9 415 612 9 5714 157x 9 33126 This finally gives L 9 7544 Thus if Vin 9 V and Vour 3 V then 7544 corresponds to 41 represents the duty cycle register value that application shouldn t exceed to keep the output or input current below typical value If the duty cycle order is set beyond therefore the output current will raise over it In that case overload conditions on the converter are reached As well for boost and mixed modes the regression line is computed based on the coordinates of all different points collected in the raw data tables In that case only 2 factors a and b will result from the regression line such as f x ax b All these data are stored in 3 tables the first one for buck mode including the 4 polynomial factors x to x for each of the 0 to 12 rows 3 to 15 V The second and third one respectively assigned to boost and mixed mode contain the 2 regression line factors a and b for each of the 0 to 12 rows If user has chosen an intermediate value for V our not an integer one e g Vour 5 7 V the MCU computes the value for two adjacent curves or lines and performs a linear interpolation between these 2 curves As an example if the user Do
27. ound If the voltages across Q1 and Q3 are ignored ideal switches the relation between Vin L and the current flowing through L can be expressed by the formula below During discharge phase Q3 is open and the current continues to flow through the inductor and Q4 now closed and finally through the output capacitor In this condition and with Q1 and Q4 drop voltages ignored as well the formula between Vin the current L and VouT becomes eee or Lie dt 7 10 34 DoclD025970 Rev 1 AN4449 ky Application description For the charge phase toy and the discharge phase torr the same formula can be applied ton torr TPWM The PWM duty cycle is the ratio of time when Q3 is turned ON over the total T pwp period It can be expressed with D always included between 0 and as LON D TPwM When Q3 is turned OFF the OFF time is equivalent to torr 1 D xXTpwau For the boost mode the following formula can be applied DX Vin ld D Vin Vout 0 DxVin Vin Vout D x Vin DXVout 0 Vin Vout l D That finally gives V out l Va 1 D Buck boost operation mixed mode This mode occurs when Vin is near Vour Vin Vout and none of the buck or boost modes can independently achieve Vour target regulation It uses both buck and boost sides of the H bridge converter and the 4 HRTIM outputs TA1 TA2 TB1 and TB2 generate PWM signals where TA1 and TB1 are still complementary respectively to TA2
28. resis over operating ranges The current waveform can be broken down into 3 regions as shown in Figure 11 Figure 11 Buck boost operation signals mixed mode The first phase is equivalent to the boost time when phases 2 and 3 correspond to the buck time This curve is represented when Vin is very close to Vour due to the horizontal line observed in section 2 If Vij is slightly lower than Vourn the line slope located in section 2 DoclD025970 Rev 1 13 34 Application description AN4449 1 4 3 1 4 4 14 34 becomes negative and the current decreases through the inductor during this time slot On the opposite if Vin is slightly higher than Vour the line slope located in section 2 is positive and the current through the inductor increases for this same time slot Equations previously defined for buck and boost modes can be applied for the required period Sizing the inductor of the buck boost converter Objectives of this buck boost converter are to have an input voltage range from 3 Vpc to 15 Vpc maximum and the same parameters for the output voltage For the converter the typical output current is 500 mA The HRTIM switching frequency is selected to have a PWM frequency of 250 kHz A relevant estimation for the inductor ripple current is 30 typical of the output current value For the buck mode with a maximum of 15 Vpc in input and a minimum of 3 Vpc on the output the value of
29. rmware description 2 2 2 Application HRTIM1_TIMA_IRQHandler flowchart As shown in Figure 22 the major process is performed during HRTIM Timer A interrupt routine Once the interrupt has been serviced the related IT is cleared immediately The process identifies which is the running converter mode Any change of the converter occurs in interrupt routine This is to ensure smooth transitions between modes and applying the new waveforms in synchronization with the timer period For each active mode such as buck boost or mixed a different display is managed and a dedicated PI function is called to compute the value of duty cycle This duty cycle is updated at each interrupt and the ADC trigger event is set as well Figure 22 HRTIM1_TIMA_IRQHandler flowchart HRTIM1_TIMA_ IROHandler Toggle LD5 and LD6 DutyB Mixed Update DutyB PI_Mixed Set Buck Update ADC trigger Mogg ad Set DutyA fixed 80 Set Boost Mode Update DutyB Mixed Update ADC trigger End Interrupt MS35832V1 Then the converter checks for any information returned by the PI software controller that would overflow CTMax or CTMin counters In these situations a specific action is performed DoclD025970 Rev 1 29 34 s Firmware description AN4449 30 34 according to the current context As for instance in the buck mode converter the application checks the CTMax counter overflow but also checks if the VouTr output signal has started t
30. t from the information set forth herein shall void any warranty granted by ST for such product ST and the ST logo are trademarks of ST All other product or service names are the property of their respective owners Information in this document supersedes and replaces information previously supplied in any prior versions of this document 2014 STMicroelectronics All rights reserved 7 34 34 DoclD025970 Rev 1
31. ter OUT High brightness LED MS35812V 1 Application principles Overview The STM32F334 Discovery embeds a buck boost DC DC converter that allows efficient conversion of a DC voltage from one level to another The user can apply an input DC voltage from a range of 3 to 15 V maximum and use the converter to get this voltage converted into a DC voltage ranging from 3 to 15 V maximum The Vour target is set prior with a target constant defined into the firmware Due to the inductor size and the input output varying conditions the allowed output current is given for 0 5 A typical The input voltage can be converted to a lower voltage level using a step down mode or converted to a higher level using a step up mode These 2 modes are supported with a single H bridge converter using a non inverting buck boost topology The STM32F334 microcontroller is interfaced to the power switches with a minimum hardware some acting as level shifters especially to adapt the low level voltage of microcontroller supply to the power stages connected to the external source The buck boost converter topology is sketched in Figure 3 DoclD025970 Rev 1 yy AN4449 Application description Caution s Figure 3 STM32F334 Discovery Buck Boost converter topology H Bridge Power switching p stage L LEVEL LEVEL SHIFTER SHIFTER MS35813V1 As shown above the high resolution timer controls th
32. ter duty cycles are updated accordingly Depending on the ongoing operating mode the converter also updates the ADC trigger at each interrupt As soon as the converter reaches the limits of its operating mode the mode change is performed during the interrupt A state machine is managing the LEDs display during the interrupt to highlight modes and other features If the overload detection is ON define OVERLOAD ON is set the duty cycle limit is computed into the interrupt every 1 6ms which correspond to 50 x 32 us repetition period of HRTIM1_TIMA interrupt This task has been limited to avoid overloading the MCU at each repetition periods As mentioned earlier in this document the duty cycle limit is calculated with functions based on polynomial interpolation or regression lines This is the major consuming task in terms of MCU resources even if this operation does not exceed 30 of MCU activity only every 1 6 ms Setting define constants There are 3 defined constants in header of the application firmware 1 define DEBUG this constant is used to enable HRTIM Timer D and allowing the ADC trigger conversion event visible on TD1 This is only for debug purpose and to highlight interaction between timers events 2 define RANGE MONITORING ON this constant is used to enable the detection on Vin and Vour voltages when one of these two voltages exceeds range limits 3 to 15 Vpc If the application detects such eventuality for a given
33. time then the converter is stopped and the LED display is updated 3 define OVERLOAD ON this constant is used to enable the detection of any overload in the converter The current duty cycle has reached the limit value for a given time overload and the converter must be stopped due to fault detection The LED display is also updated DoclD025970 Rev 1 27 34 Firmware description 2 2 2 2 1 28 34 Application flowcharts description Application main c flowchart AN4449 The main c software sketched in Figure 21 is limited to the initialization of the different peripherals used during this demonstration example Mainly ADC and HRTIM peripherals are set at startup Then the application firmware checks roughly what is the appropriate converter mode to start and puts a request mode change that will be serviced inside the interrupt routine The application waits for any stop of the converter in case of fault detection If any fault is detected during the HRTIM interrupt then the converter stop request is set immediately but this stop is managed in the main sequence once the interrupt has been serviced and has ended Different LEDs displays are performed Figure 21 main c flowchart HAL Init Clocks Init Reset PI LEDs Init J ADC Config HRTIM Config INITIALIZATION Vout check Converter mode change request Converter stop request Stop Converter DoclD025970 Rev 1 MS35831V1 7 AN4449 Fi
34. ure is not polluted by the noise during a MOSFET transition the ADC trigger event has to be determined according to the current duty cycle value and also depending on the various switching events due to the considered mode To improve Vin and Vour ADC measurement accuracy and to carry out the sampling in a non transition period the ADC trigger event is adapted every time the duty cycle changes DocID025970 Rev 1 15 34 Application description AN4449 There are 2 conditions that are checked before applying the ADC trigger event time 1 Buck or Boost mode operation In this case only one group of complementary outputs is active TAx or TBx The time value of the ADC trigger event depends essentially on the value of the running duty cycle The ADC trigger time is assigned on the opposite sector of the signal transition and its event also slides with the value of the duty cycle It depends upon toy or torr value therefore the ADC trigger position varies with duty cycle as shown in Figure 12 2 Mixed buck boost mode operation In this case both groups TAx and TBx are active see Figure 17 As the buck mode is set with a fixed duty cycle of 0 8 and the boost mode duty cycle cannot exceed 0 45 therefore the ADC trigger time event is set to a fixed value corresponding to a free measuring window located in between The value of ADC trigger time is typically 60 of the overall PWM period Figure 12 ADC trigger event configuration in buck a
35. ve 3 operating modes that are slightly overlapped between adjacent ranges as graphically shown in Figure 10 Figure 10 Operating modes according to Vin level MS35820V1 DoclD025970 Rev 1 yy AN4449 s Application description This overlap prevents from sporadic switching from one mode to another especially when the converter operation is located at the threshold of the maximum or minimum operating duty for the current mode It acts like a hysteresis and improves application stability Consequently if a Vour target is set the converter can operate in the 3 areas for the cases Vin lt lt Vout Vin Vout Or Vin gt gt Vout Concerning the buck boost operating signals the buck operation is achieved with a fixed PWM waveform on TAT TA2 as complementary and the boost one with a variable PWM duty cycle on TB1 TB2 as complementary as shown in Figure 17 where the same color scheme of figures 4 to has been used for currents In this example the PWM duty cycle D1 applied on buck side is fixed to 0 8 and the PWM duty cycle D2 applied on the boost side may vary from 0 05 up to 0 45 Theoretically if Viy Vout D1 and D2 should be complementary as for instance if D1 is fixed to 0 8 then D2 should be 0 2 referring to the relation between Vin Vour D1 and D2 seen above In real application case D2 needs some margins to introduce more flexibility between the conversion modes and ensure a minimum hyste
36. verter is stopped For further information on the firmware refer to the complete firmware package available at http www st com 7 DoclD025970 Rev 1 AN4449 DC DC converter main electrical characteristics 3 DC DC converter main electrical characteristics Table 6 Main electrical characteristics ame ee S oe Ee Your aaaea E e Keane O o er C a owatonna Oe oe EER RS eea penan ee EEN EEN EE EES Voorts bet roe MANNE WEE mu Conereronennateneney 0 ee pnn raeno e pranan s e lout 400 MA Vin 12 Voc Vout 5 Voc NEE EE N Efficiency out 180 MA Vin 7 Vae Vout 12 Voc a ar Ne If overload detection is ON the maximum current is detected for this value 10 DoclD025970 Rev 1 31 34 d Conclusions AN4449 4 32 34 Conclusions DC to DC converters are widespread in industrial consumers or automotive applications They require high integration efficiency reliability but also more and more flexibility that analog solutions cannot always offer Digital power conversions systems are taking the lead to address this market by offering a wide combination of technical solutions based on high efficient digital timers This example around the STM32F334xx advanced ARM based 32 bit MCUs highlights some of the benefits of this microcontroller and especially the embedded high resolution timer mainly designed for digital power conversions applications It includes a very high range of settings th
37. y triggered by the HRTIM to sample Vin and Vour values Based on this information a software based PI controller proportional integral is used to apply the optimized value of duty cycle according to Vour target value As shown in Figure 17 the application set point which is the Vour target of the converter is compared with the Vour fed back by ADC conversion Figure 17 PI software controller Set Point Proportional Kp Integral Ki Feedback signal MS35827V 1 The error is computed by the difference between the target value and the ADC measured value This error is then amplified with Kp and Ki gain parameters from respectively Proportional and Integral terms and summed together to set the new duty cycle order Depending on the considered converter mode buck boost or mixed the PI controller setting value is limited to the maximum or minimum duty cycle value allowed for the related mode by a saturation method This saturation can take place for very low or very high values of duty cycle Every time the saturation point is reached during a PI request one of the two counters CTMax or CTMin respectively assigned to maximum and minimum duty cycle is incremented If the system does not reach the set point for an unknown reason the PI order tends to return maximum or minimum duty cycle values along the consecutive PI computation In that case the counters for maximum or minimum duty cycle reach their overf
Download Pdf Manuals
Related Search
Related Contents
取扱説明書 R-NET (PG DT) Mini Power Pack PS300T user manual (English) VOX MARK lll Bass/VOX MARK V Bass Owner's manual Manual de usuario manualmente PX Enterprise Pentesting Appliance (PX-EPA) User Manual Preparazione del televisore Rhône-Alpes Copyright © All rights reserved.
Failed to retrieve file