# Patent

## Title
Control methods for switching power supplies

## Abstract

An embodiment provides a control method capable of controlling a switching-mode power supply to provide an output power source. The switching-mode power supply has a winding coupled to an input power source and controlled by a switch to be energized or de-energized. The maximum current peak through the winding is set to be a predetermined value. A discharge time of the winding in a switching cycle period is detected. The switching cycle period of the switch is controlled to keep the ratio of the discharge time to the switching cycle period as a constant.

## Background
CROSS REFERENCE TO RELATED APPLICATIONS
This is a continuation application of U.S. patent application Ser. No. 12/786,373, filed on May 24, 2010.


BACKGROUND OF THE INVENTION
1. Field of the Invention
The present invention is related to a switching-mode power supply (SMPS) and the operation method thereof.
2. Description of the Prior Art
SMPS is utilized extensively in the current consumer electronic devices. SMPS controls the windings to be energized and de-energized through a power switch for providing an output power source of desired specification. For instance, when at light load or no load, SMPS may operate in constant voltage mode, providing a substantial constant voltage source independent to the output current; alternatively, when at heavy load, SMPS may operate in constant current mode, providing a roughly constant current source independent to the output voltage.
FIG. 1 is a diagram illustrating conventional SMPS 10 of a flyback topology, capable of operating in the constant voltage mode or the constant current mode using primary side control. Bridge rectifier 12 roughly rectifies alternating-current (AC) power source VAC to input power source VIN. Primary winding 24 of transformer 20, power switch 15, and current detection resistor 36 are coupled in series between input power source VIN and a ground terminal. When switch controller 18 turns on power switch 15, primary winding 24 energizes; when switch controller 18 turns off power switch 15, transformer 20 de-energizes through secondary winding 22 and auxiliary winding 25. Rectifier 16 and capacitor 13 roughly rectify the electrical energy released from secondary winding 22 and provide output power source VOUT to output load 38. Rectifier 28 and capacitor 34 roughly rectify the electrical energy released from auxiliary winding 25 and thus provide operation power source VCC to switch controller 18. Startup resistor 26 provides the current required to build up voltage of operation power source VCC during a startup period of time. Voltage dividing resistors 30 and 32 forward to switch controller 18 divided voltage by dividing the reflective voltage across auxiliary winding 25, which, when transformer 20 de-energizes, corresponds approximately to the voltage across secondary winding 22. By detecting the reflective voltage through pin FB, switch controller 18 is able to monitor the voltage across secondary winding 22 and accordingly controls power switch 15.
FIG. 2 is a diagram illustrating a partial circuitry of conventional switch controller 18a in constant voltage mode. When power switch 15 is turned off, sample/hold circuit 42 samples the voltage of pin FB and generates feedback voltage VFB. Error amplifier 44 compares feedback voltage VFB with reference voltage VREF1 to generate compensation voltage VCOM. Comparator 50 compares compensation voltage VCOM with detection voltage VCS on pin CS. Comparator 52 compares current limiting voltage VCS-LIMIT with detection voltage VCS. The outputs of comparators 50 and 52, as well as the clock output of oscillator 46, are all coupled to gate logic controller 48, which accordingly controls power switch 15 via pin GATE. In addition, if voltage of output power source VOUT is well regulated, feedback voltage VFB is virtually equal to reference voltage VREF1 due to the negative feedback loop.
Circuitries relative to constant current mode are not shown in FIG. 2, as various SMPS of constant current mode and the control method thereof are already disclosed in the known art, such as U.S. Pat. No. 7,016,204 “Close-loop PWM Controller for Primary-side Controlled Power Converters”, U.S. Pat. No. 7,388,764 “Primary Side Constant Output Current Controller”, U.S. Pat. No. 7,110,270 “Method and Apparatus for Maintaining a Constant Load Current with Line Voltage in a Switch Mode Power Supply”, and U.S. Pat. No. 7,505,287 “On-time Control for Constant Current Mode in a Flyback Power Supply” etc.
SUMMARY OF THE INVENTION
The present invention discloses a control method for controlling an output power source of a switching power supply. The switching power supply comprises a winding coupled to an input power source, the winding controlling by a switch for charging or discharging. The control method comprises controlling a peak current flowing through the winding to be a predetermined value; detecting a discharge time of the winding within a switching cycle period; and controlling a switching cycle period of the switch to make a ratio between the discharge time and the switching cycle period of the switch approximately equal to a constant value.
The present invention further discloses a constant current and constant voltage power converter. The constant current and constant voltage power converter comprises a constant current feedback loop; and a constant voltage feedback loop; wherein the constant current feedback loop and the constant voltage feedback loop share one compensation capacitor.
The present invention further discloses a switch controller for a switching power supply. The switching power supply comprises a transformer coupling to an input power source, the transformer controlled by a switch for charging or discharging to generate an output power source. The switch controller comprises a capacitor; a real current source, for generating a real electric charge quantity; an expected current source, corresponding to an expected current, for discharging the capacitor, and thus generating an expected electric charge quantity within a switching cycle period; and a feedback device, for varying the real electric charge quantity or the expected electric charge quantity according to a voltage of the capacitor, so the expected electric charge quantity is nearly equaled to the real electric charge quantity in a subsequent switching cycle period.
The present invention further discloses a switch controller for a switching power supply. The switching power supply comprises a switch and a winding coupling in series to an input power source, the switching power supply providing an output power source. The switching power supply comprises a first negative feedback loop, for detecting a winding current which flows through the winding, and generating an expected average current which corresponds to an average current flowing through the winding ; and a constant current controller for forming a second negative feedback loop, for making an average output current of the output power source substantially equal to a predetermined average output current according to the expected average current.
The present invention further discloses an average voltage detector for a switching power supply. The switching power supply comprises a winding and a current detector. The current detector detects a current flowing through the winding for generating a detection voltage. The average voltage detector comprises a capacitor; a charging current source, for charging the capacitor; a discharging current source, for discharging the capacitor; and an updating device, for generating an average voltage according to a voltage of the capacitor; wherein when the detection voltage is higher than the average voltage, the capacitor is charged, and when the detection voltage is lower than the average voltage, the capacitor is discharged.
The present invention further discloses a method, for controlling a peak voltage across a detection point to approximately equal to a predetermined value. The method comprises enabling a voltage level of the detection point to periodically increase from a lowest level; providing a charging current to charge a capacitor when the voltage level of the detection point is higher than the predetermined value; and providing a discharging current for discharging the capacitor, wherein the charging current is greater than the discharging current.
These and other objectives of the present invention will no doubt become obvious to those of ordinary skill in the art after reading the following detailed description of the preferred embodiment that is illustrated in the various figures and drawings.



BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1 is a diagram illustrating conventional SMPS.
FIG. 2 is a diagram illustrating a partial circuitry of conventional switch controller in constant voltage mode.
FIG. 3 is a diagram illustrating switch controller according to the present application.
FIG. 4 is a diagram illustrating discharge time detector.
FIG. 5 is a diagram illustrating constant current controller.
FIG. 6 is a timing diagram illustrating the embodiments in FIG. 1 and FIG. 3.
FIG. 7 is a diagram illustrating another embodiment of constant current controller.
FIG. 8 is a diagram illustrating another embodiment of constant current controller.
FIG. 9 is a diagram illustrating another embodiment of switch controller according to the present invention.
FIG. 10 is a diagram illustrating an embodiment of peak voltage detector according to the present invention.
FIG. 11 is a diagram illustrating an embodiment of constant current controller according to the present invention.
FIG. 12 is a diagram illustrating an embodiment of voltage-to-current converter.
FIG. 13 is a diagram illustrating an embodiment of switch controller 18d according to the present invention.
FIG. 14 is a diagram illustrating another embodiment of switch controller according to the present invention.
FIG. 15 is a diagram illustrating an embodiment of switch controller according to the present invention.
FIG. 16 is a diagram illustrating an embodiment of constant current controller according to the present invention.
FIG. 17 is a diagram illustrating an embodiment of average voltage detector.
FIG. 18 is a diagram illustrating another embodiment of average voltage detector.
FIG. 19 is a diagram illustrating another embodiment of current sense peak value controller.
FIG. 20 is a diagram illustrating an embodiment of switch controller according to the present invention.



DETAILED DESCRIPTION
Further objects of the present invention and more practical merits obtained by the present invention will become more apparent from the description of the embodiments which will be given below with reference to the accompanying drawings. For explanation purposes, components with equivalent or similar functionalities are represented by the same symbols. Hence components of different embodiments with the same symbol are not necessarily identical. Here, it is to be noted that the present invention is not limited thereto.
FIG. 3 is a diagram illustrating switch controller 18b according to the present application. Switch controller 18b is meant to replace conventional switch controller 18 illustrated in FIG. 1 for implementing constant current/constant voltage operations. The following description is based on the assumption that switch controller 18b of FIG. 3 is disposed in setups similar to or the same with FIG. 1, and SMPS 10 of FIG. 1 operates in discontinuous conduction mode (DCM), meaning that transformer 20 de-energizes completely every switching cycle period.
The operation of constant voltage control for switch controller 18b is similar to that of switch controller 18a in FIG. 2, and can be inferred according to FIG. 2 by those skilled in the art; the relative description is omitted hereafter.
The difference between FIGS. 3 and 2 is that switch controller 18b in FIG. 3 comprises current sense (CS) peak voltage controller 108, discharge time detector 102, constant current controller 104, and voltage-controlled oscillator (VCO) 106, the cooperation of which can make current output load 38 effectively be supplied with a predetermined constant current IOUT-SET. CS peak voltage controller 108 effectively controls the SEC peak current flowing through secondary winding 22 to be at most a predetermined value ISEC-SET. By detecting through pin FB the falling of induced voltage VAUX across auxiliary winding 25, discharge time detector 102 generates discharging signal SDIS, which implies discharge time TDIS of secondary winding 22. Based on discharge time TDIS indicated by discharging signal SDIS and the switching cycle period T received from pin Gate, constant current controller 104 identifies, during the present switching cycle period T, if the electrical charge outputted from secondary winding 22 is equal to the expected electrical charge generated from the predetermined constant current IOUT-SET. If variations exist, control voltage VCTL is altered so that the clock frequency outputted by VCO 106 is accordingly adjusted. The adjusted clock frequency influences the subsequent switching cycle period T, consequently affecting the expected electrical charge in the subsequent switching cycle period T. A negative feedback loop formed therein soon makes the total estimated electrical charge in one switching cycle period approximately converge to the electrical charge output from secondary winding 22 in the same switching cycle period. Therefore, such negative feedback loop allows the average output current of secondary winding 22 to approximately converge to the predetermined constant current IOUT-SET, achieving the purpose of constant current control.
CS peak voltage controller 108 controls the CS peak current, which flows through current detection resistor 36 and also primary winding 24 in FIG. 1, to be at most a predetermined value IPRI-SET. Since the ratio of the CS peak current to the SEC peak current equals the winding ratio between secondary winding 22 and primary winding 24, CS peak voltage controller 108 equivalently controls the maximum SEC peak current to be the predetermined value ISEC-SET. For instances, CS peak voltage controller 108 can restrain the CS peak voltage of the detection voltage VCS to be not more than limiting voltage VCS-LIMIT, which, for example, is 0.85V. Embodiments of CS peak voltage controller 108 are disclosed by U.S. patent application Ser. No. 12/275,201, Taiwan patent application No. 097129355 and China patent application number No. 200810131240, all of which are here incorporated by reference. In the above-mentioned applications, CS peak voltage controller 108 determines the difference between the CS peak voltage of detection voltage VCS of present and the current limiting voltage VCS-LIMIT, and then adjusts comparison voltage VCS-USE used to compare with the detection voltage VCS so that the CS peak voltage changes and gradually converges to current limiting voltage VCS-LIMIT in the subsequent switching cycle periods. Accordingly, the SEC peak current (of secondary winding 22) will be approximately equal to the predetermined value ISEC-SET.
FIG. 19 is a diagram illustrating another embodiment of CS peak voltage controller 500, by which the CS peak voltage is restrained approximately to peak voltage limiting voltage VREF-LIMIT. When utilized as CS peak value controller 108 in FIG. 3, CS peak voltage controller 500 in FIG. 19 may receive current limiting voltage VCS-LIMIT of FIG. 3 as peak voltage limiting voltage VREF-LIMIT. In another embodiment, CS peak voltage controller 500 in FIG. 19 may receive current limiting voltage VCS-LIMIT of FIG. 3 as peak voltage limiting voltage VREF-LIMIT 
In FIG. 19, if detection voltage VCS in FIG. 19 is greater than peak voltage limiting voltage VREF-LIMIT in a switching cycle period, capacitor 508 is charged by current source 510 and voltage VBIAS is pulled up accordingly. Since higher voltage VBIAS corresponds to higher current IBIAS flowing through resistor RBIAS, comparator 502, in the next switching cycle period, earlier turns off the current through primary winding 24 and the CS peak voltage becomes lower. If the CS peak voltage in FIG. 19 is lower than peak voltage limiting voltage VREF-LIMIT in a switching cycle period, capacitor 508 is discharged with a very little current through BJT and resistor RLEAKAGE, slightly lowering the voltage VBIAS so as to slightly pull up the CS peak voltage in the next switching cycle period. Current IR of current source 510 could be designed much greater than the leakage current of capacitor 508 caused by the BJT, thus the CS peak voltage approximately equals peak voltage limiting voltage VREF-LIMIT after a few switching cycle periods.
FIG. 4 is a diagram illustrating discharge time detector 102a. When discharging signal SDIS is of a high logic level, transformer 20 in FIG. 1 is still discharging to capacitor 13 and output load 38 through rectifier 16. When transformer 20 has completed discharging, the voltage at pin FB drops abruptly, and the drop can be detected as an indication to identify the completion of discharging of transformer 20, so the duration of discharge time TDIS can then be determined. In FIG. 4, comparator 110 compares the voltage at pin FB and threshold voltage VTH. Moreover, discharge time TDIS is present only when power switch 15 is turned off, therefore in FIG. 4, the two input ends of AND gate 114 are coupled individually to the output of comparator 110 and the output of inverter 112. The input of inverter 112 is coupled to pin GATE.
FIG. 5 is a diagram illustrating constant current controller 104a. The current ratio (IREAL/IEXP) of real current source 118 and expected current source 120 is a predetermined value NRATIO. When discharging signal SDIS is of a high logic level (i.e. the discharge time TDIS is present), real current source 118 charges capacitor 122. And the electric charge charged into charge capacitor 122 during the discharge time TDIS is called real electric charge QREAL. On the other hand, during the switching cycle period T, the electric charge discharged from charge capacitor 122 through current source 120 is called estimated electric charge QEST. Pulse generator 116 is triggered, for example, at the rising-edge of the voltage at pin GATE, to transmit pulse signal SSMP for capacitor 124 sampling voltage VCC-CAP of sampling capacitor 122 through switch 126, so as to generate control voltage VCTL.
In one embodiment of the present invention, the oscillation frequency of VCO 106 in FIG. 3 decreases, or switching cycle period T increases as the voltage level of control voltage VCTL increases.
Since CS peak voltage controller 108 restrains the SEC peak current (flowing through secondary winding 22) to be not more than predetermined value ISEC-SET, when constant current control is activated, the SEC peak current can be assumed to be predetermined value ISEC-SET. During a switching cycle period T, the electric charge QSEC outputted by secondary winding 22 can be calculated by formula (1) below:

QSEC=0.5*ISEC-SET*TDIS   (1)

Desired constant current LOUT-SET, which constant current control would like to achieve, is expected to drain in a switching cycle period T from secondary winding 22 expected output electric charge QOUT, which can be calculated by formula (2) below:

QOUT=IOUT-SET*T   (2)

The purpose of the constant current control is to make electric charge QSEC (outputted by secondary winding 22) equal to expected output electric charge QOUT, in other words;

0.5*ISEC-SET*TDIS=IOUT-SET*T. 

As illustrated in FIG. 5, if the current value ratio NRATIO (equivalent to IREAL/IEXP) is designed to equal to (0.5*ISEC-SET/IOUT-SET), so the variation of voltage VCC-CAP, defined as ΔVCC-CAP, after one switching cycle period can be inferred from the formula below:




  
    
      
        
          
            
              
                Δ
                ⁢
                
                  
                
                ⁢
                
                  V
                  
                    CC
                    ⁢
                    
                      -
                    
                    ⁢
                    CAP
                  
                
              
              =
              
              ⁢
              
                
                  (
                  
                    
                      Q
                      REAL
                    
                    -
                    
                      Q
                      EXP
                    
                  
                  )
                
                /
                
                  C
                  
                    CC
                    ⁢
                    
                      -
                    
                    ⁢
                    CAP
                  
                
              
            
          
        
        
          
            
              =
              
              ⁢
              
                
                  (
                  
                    
                      
                        I
                        REAL
                      
                      *
                      
                        T
                        DIS
                      
                    
                    -
                    
                      
                        I
                        EXP
                      
                      *
                      T
                    
                  
                  )
                
                *
                
                  K
                  1
                
              
            
          
        
        
          
            
              =
              
              ⁢
              
                
                  (
                  
                    
                      0.5
                      *
                      
                        I
                        
                          SEC
                          ⁢
                          
                            -
                          
                          ⁢
                          SET
                        
                      
                      *
                      
                        T
                        DIS
                      
                    
                    -
                    
                      
                        I
                        
                          OUT
                          ⁢
                          
                            -
                          
                          ⁢
                          SET
                        
                      
                      *
                      T
                    
                  
                  )
                
                *
                
                  K
                  2
                
              
            
          
        
        
          
            
              =
              
              ⁢
              
                
                  (
                  
                    
                      Q
                      SEC
                    
                    -
                    
                      Q
                      OUT
                    
                  
                  )
                
                *
                K
                ⁢
                
                  
                
                ⁢
                2
                ⁢
                
                  (
                  4
                  )
                
              
            
          
        
      
    
    
      
        (
        3
        )
      
    
  




wherein K1 and K2 are constants, QREAL the charge contributed by current source 118, QEXP the charge contributed by current source 120, and CCC-CAP the capacitance of capacitor 122. If voltage VCC-CAP increases after present switching cycle period T, i.e. ΔVCC-CAP greater than zero, it can be concluded that electric charge QSEC outputted by secondary winding 22 exceeds expected output electric charge QOUT in present switching cycle period T according to formula (4), implying the actual output current is greater than desired constant current IOUT-SET. Moreover, the increasing of voltage VCC-CAP induces control voltage VCTL to increase, further increasing the period of a subsequent switching cycle, making ΔVCC-CAP in the subsequent decrease. In this way, a negative feedback loop is formed. With appropriate designs, the negative feedback loop prompts the result of formulae (4) and (5) to converge to 0 over time. By adjusting switching cycle period T, the negative feedback loop converges T/TDIS to approximately equal to NRATIO (equivalent to IREAL/IEXP), making QSEC−QOUT=0 and achieving the purpose of outputting constant current.
FIG. 6 is a timing diagram of the embodiments in FIG. 1 and FIG. 3, showing the waveforms of, from top to bottom, gate voltage VGATE at pin GATE, detection voltage VCS at pin CS, induced voltage VAUX, current ISEC flowing through secondary winding 22, discharging signal SDIS, pulse signal SSMP control voltage VCTL, and voltage VCC-CAP of capacitor 122. At time t1, gate voltage VGATE goes high, so power switch 15 is turned on, and transformer 20 starts charging accordingly, resulting in the rising of detection voltage VCS. The rising edge of gate voltage VGATE also triggers pulse signal SSMP to sample voltage VCC-CAP and generate control voltage VCTL. At the same time, capacitor 122 is discharged gradually, causing voltage VCC-CAP to drop steadily. At time t2, gate voltage VGATE drops, causing CS peak voltage as high as the current limiting voltage VCS-LIMIT, so correspondingly the CS peak current flowing through primary winding 24 is a predetermined value IPRI-SET. Coupling from primary winding, SEC peak current flowing through secondary winding 22 is predetermined value ISEC-SET, accordingly. During discharge time TDIS between time t2 and t3, transformer 20 de-energizes, hence discharging signal SDIS is of the high logic level. During discharge time TDIS, the charging current of capacitor 122 (of FIG. 7) is larger than the discharging current, resulting in a gradual increase of voltage VCC-CAP. At time t3, current ISEC becomes zero, causing sensed current VAUX to drop abruptly, discharge time TDIS is concluded and capacitor 122 is terminated from being charged. Between time t3 and the start of the next discharge time, capacitor 122 is discharged steadily, causing voltage VCC-CAP to drop gradually. At time t4, the next cycle of switching cycle period begins, so gate voltage VGATE increases, repeating similar steps as from time t1. According to FIG. 6 and the above-mentioned description, the increasing of control voltage VCTL increases the next switching cycle period T, further causing control voltage VCTL to increase less or decrease in the next switching cycle. Such negative feedback loop allows control voltage VCTL to approximately stabilize to a steady value.
FIG. 7 is a diagram illustrating another embodiment of constant current controller 104b, which is similar to constant current controller 104a in FIG. 5 and achieves comparable purposes. The difference is that constant current controller 104b in FIG. 7 comprises comparator 140, which compares voltage VCC-CAP of capacitor 122 and reference voltage VREF-CC within the pulse period defined by pulse signal SSMP so as to generate charging or discharging current to adjust control voltage VCTL accordingly. For instances, if voltage VCC-CAP is observed to be higher than reference voltage VREF-CC within the pulse period defined by pulse signal SSMP, comparator 140 charges capacitor 124 during the pulse period so as to slightly increase the voltage level of control voltage VCTL, and then slightly increase the next switching cycle period T. Outside the pulse period defined by pulse signal SSMP, control voltage VCTL is sustained by capacitor 124.
FIG. 8 is a diagram illustrating another embodiment of constant current controller 104c which is similar to constant current controller 104a in FIG. 5 and achieves comparable purposes. The difference is that constant current controller 104c in FIG. 8 comprises comparator 142, counter 144 and digital -to-analog converter (DAC) 146. Counter 144 is triggered by the rising edge of gate voltage VGATE to count up or down according to the output of comparator 142. DAC 146 converts digital output of counter 144 to control voltage VCTL. For instances, if voltage VCC-CAP is observed to be higher than reference voltage VREF-CC at the rising edge of gate voltage VGATE, counter 144 is incremented by 1, so the voltage level of control voltage VCTL is increased slightly and the next switching cycle period T is also increased slightly. Most of time, control voltage VCTL is sustained by DAC 146.
All the embodiments illustrated in FIG. 5, FIG. 7 and FIG. 8 utilize single capacitor 122 to record the difference between the real electric charges QREAL and the estimated electric charges QEST, bringing the advantage that the increasing/decreasing trend of control voltage VCTL is not affected by varying the capacitance of capacitor 122. Therefore, capacitance of capacitor 122 can be varied in these embodiments.
FIG. 9 is a diagram illustrating an embodiment of switch controller 18c according to the present invention, which can replace switch controller 18 in FIG. 1 to realize operations of constant current and constant voltage control. Descriptions below are based on the assumptions that switch controller 18c in FIG. 9 is disposed in setups similar to FIG. 1 and SMPS 10 in FIG. 1 is operated in discontinuous conduction mode (DCM).
In addition, switch controller 18c illustrated in FIG. 9 and switch controller 18b illustrated in FIG. 3 have at least the following differences. 1) Switch controller 18c does not comprise CS peak voltage controller 108, but utilizes the same comparator 52 in FIG. 2 to roughly restrain the CS peak voltage of detection voltage VCS. However, due to issues such as signal propagation delay, when power switch 15 is turned off according to the output of comparator 52, the CS peak voltage VCS-PEAK of detection voltage VCS is slightly higher than the current limiting voltage VCS-LIMIT. 2) Switch controller 18c illustrated in FIG. 9 further comprises CS peak voltage detector 206 for detecting CS peak voltage VCS-PEAK. 3) Constant current controller 202 adjusts control signal VCTL according to discharging signal SDIS and CS peak voltage VCS-PEAK.
FIG. 10 is a diagram illustrating an embodiment of CS peak voltage detector 206a according to the present invention, applicable to the embodiment illustrated in FIG. 9. As shown in FIG. 10, the pulse generator and the switch reset the capacitor at the rising edge of gate voltage VGATE. After then, CS peak voltage detector 206a acts as a peak holder for detection voltage VCS. The operation of CS peak voltage detector 206a in FIG. 10 should be obvious to those skilled in the art; the detailed operation is omitted hereafter.
FIG. 11 is a diagram illustrating an embodiment of constant current controller 202a according to the present invention, applicable to the embodiment illustrated in FIG. 9. Constant current controller 202a in FIG. 11 utilizes voltage-to-current converter 204 to replace real current source 118 of constant current controller 104a in FIG. 5. Voltage-to-current converter 204 converts CS peak voltage VCS-PEAK to corresponding peak current ICCS-PEAK. Peak current ICSS-PEAK corresponds to SEC peak current ISEC-PEAK in the present switching cycle period. In other words, peak current ICSS-PEAK is proportional to ISEC-PEAK. The operation of constant current controller 202a in FIG. 11 should be obvious to those skilled in the art according to the embodiment of FIG. 5 mentioned above; the detailed description is omitted hereinafter.
Constant current controller 202a illustrated in FIG. 11 is designed to allow ICSS-PEAK/ISEC-PEAK=IEXP/IOUT-SET. Therefore, ΔVCC-CAP, the variation of voltage VCC-CAP after switching cycle period T, can be obtained from the formula below:




  
    
      
        
          
            
              
                Δ
                ⁢
                
                  
                
                ⁢
                
                  V
                  
                    CC
                    ⁢
                    
                      -
                    
                    ⁢
                    CAP
                  
                
              
              =
              
              ⁢
              
                
                  (
                  
                    
                      Q
                      REAL
                    
                    -
                    
                      Q
                      EST
                    
                  
                  )
                
                /
                
                  C
                  
                    CC
                    ⁢
                    
                      -
                    
                    ⁢
                    CAP
                  
                
              
            
          
        
        
          
            
              =
              
              ⁢
              
                
                  (
                  
                    
                      0.5
                      *
                      
                        I
                        
                          CCS
                          ⁢
                          
                            -
                          
                          ⁢
                          PEAK
                        
                      
                      *
                      
                        T
                        DIS
                      
                    
                    -
                    
                      
                        I
                        EXP
                      
                      *
                      T
                    
                  
                  )
                
                *
                
                  K
                  3
                
              
            
          
        
        
          
            
              =
              
              ⁢
              
                
                  (
                  
                    
                      0.5
                      *
                      
                        I
                        
                          SEC
                          ⁢
                          
                            -
                          
                          ⁢
                          PEAK
                        
                      
                      *
                      
                        T
                        DIS
                      
                    
                    -
                    
                      
                        I
                        
                          OUT
                          ⁢
                          
                            -
                          
                          ⁢
                          SET
                        
                      
                      *
                      T
                    
                  
                  )
                
                *
                
                  K
                  4
                
              
            
          
        
        
          
            
              =
              
              ⁢
              
                
                  (
                  
                    
                      Q
                      SEC
                    
                    -
                    
                      Q
                      OUT
                    
                  
                  )
                
                *
                
                  
                    K
                    4
                  
                  (
                  6
                  )
                
              
            
          
        
      
    
    
      
        (
        5
        )
      
    
  




wherein K3 and K4 are two constants. Since the result of formulae (5) and (6) are similar to formulae (3) and (4), it is observed that with an appropriately designed negative feedback loop, control voltage VCTL controls VCO 106 in FIG. 9 to make formulae (5) and (6) are converged towards 0, fulfilling the purpose of constant current control.
FIG. 12 is a diagram illustrating an embodiment of voltage-to-current converter 204a, which is obvious to those skilled in the art so the detailed description is omitted hereinafter.
As constant current controller 104a in FIG. 5 has variation embodiments of FIGS. 7 and 8, constant current controller 202a in FIG. 11 also has similar variations. For instances, constant current controller 202 in FIG. 9 can employ the embodiments of FIG. 7 or 8, with modification that real current source 118 in FIG. 7 or 8 is replaced with voltage-to-current converter 204a of FIG. 12.
As shown in FIG. 9, constant current controller 202 adjusts the oscillation frequency of VCO 106 (i.e. the switching cycle period T in equation (5)) to make formulae (5) converged towards 0.
Besides, in the following embodiments of FIGS. 13, 14 and 20, the oscillating frequency is approximately fixed, but CS peak current VCS-PEAK flowing through primary winding 24 in the next switching cycle period is altered to achieve constant current control.
Switch controller 18d in FIG. 13 is similar to switch controller 18c in FIG. 9, but differs in that control voltage VCTL of constant current controller 202 is transmitted to an input end of error amplifier 302. The higher one between control voltage VCTL and feedback voltage VFB is compared with reference voltage VREF1. When constant current controller 202 determines the present average output current of secondary winding 22 is too high, control voltage VCTL increases, thus lowering compensation voltage VCOM outputted by error amplifier 302. The lower compensation voltage VCOM the less peak voltage VCS-PEAK of the next switching cycle period. Constant current controller 202 in FIG. 13 provides a negative feedback loop, achieving constant current control. This negative feedback loop for constant current control comprises, in view of signal propagation, constant current controller 202, error amplifier 302, comparator 50, gate logic controller 48, power switch 15, and peak voltage detector 206. There is also a negative feedback loop existing in FIG. 13 for constant voltage control, comprising sample/hold circuit 42, error amplifier 302, comparator 50, gate logic controller 48, power switch 15, and auxiliary winding 25, in view of signal propagation. Generally, as shown in FIG. 13, the output of error amplifier 302 is coupled to a compensation capacitor, which is a common part for both negative feedback loops of constant current control and constant voltage control. This compensation capacitor can be built in within, or coupled externally to, the integrated circuit of switch controller 18d. During constant current control operation, the voltage level of feedback voltage VFB is lower than that of control voltage VCTL, so control voltage VCTL controls the compensation capacitor. In other words, during constant current control operation, the compensation capacitor is controlled by the negative feedback loop of constant current control rather than that of constant voltage control. Nevertheless, during constant voltage control operation, the voltage level of control voltage VCTL is lower than that of feedback voltage VFB, so feedback voltage VFB controls the compensation capacitor.
The switch controller 18e in FIG. 14 is similar to switch controller 18c in FIG. 9, but differs in that control voltage VCTL of constant current controller 202 is transmitted to an adder, which provides the sum of control voltage VCTL and detection voltage VCS to comparator 52, for being compared with current limiting voltage VCS-LIMIT. When constant current controller 202 determines the present average output current of secondary winding 22 is too high, the voltage level of control voltage VCTL increases so that comparator 52 will be earlier triggered to seize current flowing through primary winding 24, consequently decreasing CS peak voltage VCS-PEAK in the next switching cycle period. As a result, the average output current of secondary winding 22 is lowered in the next switching cycle period.
Switch controller 18g in FIG. 20 is similar to switch controller 18d in FIG. 13. Constant current controller 203 in FIG. 20 can comprise the same internal circuitry as constant current controller 202 in FIG. 13, while an input end of constant current controller 203 receives compensation voltage VCOM and the corresponding input end of constant current controller 202 peak voltage VCS-PEAK. CS peak voltage controller 51 in FIG. 20 makes CS peak voltage of detection voltage VCS approximately equal to compensation voltage VCOM, as the switching cycle continues. CS peak voltage controller 51 can be the same with the CS peak voltage controller 108 of FIG. 3, an embodiment of which is illustrated in FIG. 19. According to present compensation voltage VCOM and discharging signal SDIS, constant current controller 203 in FIG. 20 determines the result of comparing the real output current and desired constant current IOUT-SET of the present switching cycle period, so as to adjust compensation voltage VCOM of the next switching cycle period. Compensation voltage VCOM affects CS peak voltage and also influences the real output current consequently. The negative feedback loop of the constant current control operation in FIG. 20 comprises constant current controller 203, error amplifier 302, and CS peak voltage controller 51, in view of signal propagation.
The above-mentioned embodiments illustrate the constant current control when SMPS 10 operates in DCM. SMPS 10 can also operate in continuous conduction mode (CCM) to achieve constant current control.
FIG. 15 is a diagram illustrating an embodiment of switch controller 18f to replace switch controller 18 in FIG. 1 for achieving constant current/constant voltage control under CCM.
Similar but different to switch controller 18d in FIG. 13, switch controller 18f in FIG. 15 does not require discharge time detector 102 in FIG. 13; the architecture of constant current controller 310 in FIG. 15 is also tweaked; peak voltage detector 206 in FIG. 13 is replaced with average voltage detector 306 in FIG. 15; and average voltage detector 306 is coupled between pin CS and constant current controller 310 in FIG. 15. Switch controller 18f in FIG. 15 does not require a discharge time detector to determine the discharge time TDIS, since under CCM the turn off time TOFF of switch 15 is equivalent to discharge time TDIS.
In CCM, electric charges QSEC outputted by secondary winding 22 is 0.5(ISEC-PEAK+ISEC-VALLEY)*TDIS=ISEC-AVG*TOFF, wherein ISEC-PEAK, ISEC-VALLEY, and ISEC-AVG are the SEC peak current, the SEC valley current, and the SEC average current of secondary winding 22 in the present switching cycle period, respectively. It can be observed that SEC peak current ISEC-PEAK corresponds to CS peak voltage CS-PEAK from equations (5) and (6), so SEC average current ISEC-AVG corresponds to CS average voltage VCS-AVG, which is the average value of detection voltage VCS. Therefore, average voltage detector 306 in FIG. 15 determines and forwards CS average voltage VCS-AVG to constant current controller 310 so as to achieve constant current control.
FIG. 16 is a diagram illustrating an embodiment of constant current controller 310a, applicable in FIG. 15. As shown in FIG. 16, CS average voltage VCS-AVG is converted to current ICSS-AVG via voltage-to-current converter 360, which can be realized by voltage-to-current converter 204a in FIG. 12. Switch controller 18f in FIG. 16 is designed to fulfill the condition of ICSS-AVG/ISEC-AVG=IEXP/IOUT-SET. Similar to the constant current control operation illustrated in FIG. 13, switch controller 18f in FIG. 15 can provide a negative feedback loop for accomplishing constant current control as long as CS average voltage VCS-AVG is obtained.
As constant current controller 104a of FIG. 5 has alternatives as illustrated in FIG. 7 and FIG. 8, constant current controller 310a also has alternatives which can be inferred according to the above-mentioned description, so relative diagrams and descriptions are omitted hereinafter.
FIG. 17 is a diagram illustrating an embodiment of CS average voltage detector 306a applicable to switch controller 18f in FIG. 15. CS average voltage detector 306a itself provides a negative feedback loop, making voltage on capacitor 368 output CS average voltage VCS-AVG approaching to or approximately equal to the average voltage of detection voltage VCS when power switch 15 is turned on. Capacitor 368 is utilized to store CS average voltage VCS-AVG, which initially may differs from the true average of detection voltage VCS, but is always the initial voltage level of capacitor 366 when power switch 15 is turned on. When power switch 15 is turned on, capacitor 366 is discharged by constant current source 364 with predetermined current ICON if detection voltage VCS is lower than CS average voltage VCS-AVG, and is charged constant current source 362 with the same predetermined current ICON if detection voltage VCS is higher than CS average voltage level VCS-AVG. Accordingly, in case that voltage on capacitor 366 becomes larger than its initial value after the period when power switch 15 is turned on, CS average voltage VCS-AVG on capacitor 368 is lower than what it should be because the time period Tabove when detection voltage VCS is above CS average voltage VCS-AVG is longer than the time period Tunder when it is under. A higher voltage on capacitor 366 increases CS average voltage VCS-AVG when power switch 15 is turned off, due to the effect of charge sharing. No matter what CS average voltage VCS-AVG initially is, as the switching cycle continues, CS average voltage VCS-AVG approaches to what it should represent, making time period Tabove equal to time period Tunder.
FIG. 18 is a diagram illustrating another embodiment of average voltage detector 306b applicable in switch controller 18f in FIG. 15. Average voltage detector 306b also provides a negative feedback loop, making CS average voltage VCS-AVG approximately equal to the average voltage across primary winding 24 when power switch 15 is turned on. Capacitor 382 is utilized to store average voltage level VCS-AVG. Voltage-to-current converter 386 and capacitor 384 are utilized to calculate the integral value SVCS of detection voltage VCS when power switch 15 is turned on. The integral value SVCS corresponds to the real electric charge flowing through primary winding 24 in a switching cycle period. Voltage-to-current converter 388 and capacitor 384 are utilized to calculate the integral value SVCSAVG of average voltage level VCS-AVG when power switch 15 is turned on. The integral value SVCSAVG corresponds to the estimation of the real electric charges flow through primary winding 24 in a switching cycle period. If the integral value SVCS is larger than the integral value SVCSAVG, meaning CS average voltage level VCS-AVG is too low, the voltage level of capacitor 384 is pulled up accordingly. Therefore, when power switch 15 is turned off, average voltage level VCS-AVG of capacitor 368 is pulled up slightly due to the effect of charge sharing. Consequently, the integral value SVCSAVG will close to the integral value SVCS in the subsequent period. CS average voltage VCS-AVG is thus clamped approximately to a predetermined value, for integral value SVCS to approximately equal integral value SVCSAVG, indicating CS average voltage VCS-AVG approximately equal to the average of detection voltage VCS. In other words, the net current for charging capacitor 384 and the net current for discharging capacitor 384 vary with the difference between detection voltage VCS and CS average voltage VCS-AVG.
The charge sharing to adjust CS average voltage VCS-AVG in FIG. 17 and FIG. 18 is similar to the charge sharing to adjust control voltage VCTL in FIG. 5. Analogous to that FIG. 7 is an alternative of FIG. 5, FIGS. 17 and 18 may have alternatives that CS average voltage VCS-AVG, the voltage on capacitor 368 or 382 (in FIG. 17 or 18, respectively), is slightly adjusted based on the comparison result between reference voltage VREF-AVG and the voltage on capacitor 366 or 384. Analogous to that FIG. 8 is an alternative of FIG. 5 and employs counter 144 and DAC 146 to memorize control voltage VCTL, FIGS. 17 and 18 may have alternatives that employ a counter and a DAC to memorize CS average voltage VCS-AVG.
Even the invention is exemplified by flyback converters; it is not limited to and can be applied to converters with other architectures, such as buck converters, boost converters, buck-boost converter, and the like.
Those skilled in the art will readily observe that numerous modifications and alterations of the device and method may be made while retaining the teachings of the invention. Accordingly, the above disclosure should be construed as limited only by the metes and bounds of the appended claims.

## Claims

1. A control method for controlling an output power source of a switching power supply, the switching power supply comprising a winding coupled to an input power source, the winding controlling by a switch for charging or discharging, the control method comprising:
controlling a peak current flowing through the winding to be a predetermined value;
detecting a discharge time of the winding within a switching cycle period;
controlling a switching cycle period of the switch to make a ratio between the discharge time and the switching cycle period of the switch approximately equal to a constant value;
charging/discharging a capacitor with a first current source in the discharge time; and
charging/discharging the capacitor with a second current source in the switching cycle period of the switch;
wherein a current ratio of the second current source to the first current source equals the constant value.

2. The control method of claim 1, further comprising:
comparing a voltage of the capacitor to a reference voltage, and thus varying a control signal to influence a switching frequency of the switch.

3. An average voltage detector for a switching power supply which comprises a winding and a current detector, the current detector detecting a current flowing through the winding for generating a detection voltage, the average voltage detector comprising:
a capacitor;
a charging current source, for charging the capacitor;
a discharging current source, for discharging the capacitor; and
an updating device, for generating an average voltage according to a voltage of the capacitor;
wherein when the detection voltage is higher than the average voltage, the capacitor is charged, and when the detection voltage is lower than the average voltage, the capacitor is discharged;
wherein a current of the charging current source is equaled to a current of the discharging current source.

4. The average voltage detector of claim 3, wherein magnitude of the charging current source corresponds to the detection voltage, and magnitude of the discharging current source corresponds to the average voltage level.