# Patent

## Title
Cable voltage drop compensation for battery chargers

## Abstract

A battery charger may be configured to charge a battery by way of a charging cable. A DC gain of a voltage control loop of the battery charger may be limited to a predetermined value to compensate for voltage drop on the charging cable. For example, a DC gain of an error amplifier on the voltage control loop may be limited to a predetermined value for cable voltage drop compensation. The error amplifier may use a reference signal that is generated as a function of the error signal. The DC gain of the error amplifier may be limited by connecting a resistor to form an RC circuit on an output node of the error amplifier.

## Background
BACKGROUND OF THE INVENTION
1. Field of the Invention
The present invention relates generally to electrical circuits, and more particularly but not exclusively to battery chargers.
2. Description of the Background Art
Battery chargers may be used to charge batteries of portable electrical devices including cell phones, power tools, digital cameras, MP3 players, and personal digital assistants, to name a few examples. A battery charger may be implemented using a commercially-available PWM (pulse width modulation) controller integrated circuit (IC), such as the FAN102 primary-side-regulated (PSR) PWM controller from Fairchild Semiconductor. When employed in a battery charger, a PWM controller IC is configured to compensate for voltage drop on a charging cable connecting the battery charger to the battery. In a conventional PWM controller, such as the FAN 102 controller, the cable voltage drop necessitates the use of a dedicated cable compensation circuit and an extra, dedicated IC pin to attach additional electrical components for cable compensation to meet particular application specifications, such as output current, output voltage, and cable resistance.
SUMMARY
A battery charger may be configured to charge a battery by way of a charging cable. A DC gain of a voltage control loop of the battery charger may be limited to a predetermined value to compensate for voltage drop on the charging cable. For example, a DC gain of an error amplifier on the voltage control loop may be limited to a predetermined value for cable voltage drop compensation. The error amplifier may use a reference signal that is generated as a function of the error signal. The DC gain of the error amplifier may be limited by connecting a resistor to form an RC circuit on an output node of the error amplifier.
These and other features of the present invention will be readily apparent to persons of ordinary skill in the art upon reading the entirety of this disclosure, which includes the accompanying drawings and claims.



DESCRIPTION OF THE DRAWINGS
FIG. 1 schematically shows a battery charger in accordance with an embodiment of the present invention.
FIG. 2 schematically shows a reference voltage generator in the PWM controller of the battery charger of FIG. 1 in accordance with an embodiment of the present invention.
FIG. 3 shows a timing diagram for signals in the battery charger of FIG. 2 in accordance with an embodiment of the present invention.
FIG. 4 shows plots of battery voltage and output voltage as a function of output current in the case where the reference voltage is constant and the gain of the error amplifier is theoretically infinite.
FIG. 5 shows plots of battery voltage and output voltage as a function of output current of a battery charger in accordance with an embodiment of the present invention.
FIG. 6 shows a plot of gain of an error amplifier versus frequency in a voltage control loop of a battery charger in accordance with an embodiment of the present invention.
FIG. 7 show plots of output voltage versus output current of a battery charger in accordance with an embodiment of the present invention.
FIG. 8 shows plots of battery voltage versus output current of a battery charger in accordance with an embodiment of the present invention.



The use of the same reference label in different drawings indicates the same or like components.
DETAILED DESCRIPTION
In the present disclosure, numerous specific details are provided, such as examples of circuits, components, and methods, to provide a thorough understanding of embodiments of the invention. Persons of ordinary skill in the art will recognize, however, that the invention can be practiced without one or more of the specific details. In other instances, well-known details are not shown or described to avoid obscuring aspects of the invention.
FIG. 1 schematically shows a battery charger 100 in accordance with an embodiment of the present invention. In the example of FIG. 1, an input AC line voltage VAC is rectified by a full-wave rectifier 101. The rectified voltage is coupled to the primary windings of a transformer 112 through an input capacitor C1. The voltage developed on the secondary windings of the transformer 112 is coupled to the output capacitor C2 by way of a diode D1. The voltage across the output capacitor C2 is presented as the output voltage VO generated by the charger 100. The nodes 121 and 122 represent connectors to which a charging cable 102 is connected to charge a rechargeable battery 104. The battery voltage VO.BAT is the resulting voltage developed across the battery 104 by the output voltage VO.
The operation of the battery charger 100 is controlled by a PWM (pulse width modulation) controller 130, which is implemented as an IC (integrated circuit) chip. In the example of FIG. 1, the PWM controller 130 comprises an error amplifier 106, a PWM comparator 107, an oscillator 108, an SR (set-reset) flip-flop 109, and a driver circuit 110. The use of an IC chip is advantageous for a variety of reasons including small form factor and low manufacturing cost.
In the example of FIG. 1, the PWM controller 130 is in an IC packaging with pins 131-134. The pins 131-134 are schematically shown as nodes in the battery charger 100. Pin 131 provides a control signal to drive the gate of a transistor M1, pin 132 is used to sense the drain-to-source current flowing through the transistor M1 when ON, pin 133 is used to sense the output voltage Vo by way of an output detection circuit 105, and pin 134 allows for attachment of additional components (resistor Rc and capacitor Cc in this example) for compensation on the voltage control loop. The PWM controller 130 may also have a pin for receiving a power supply, a pin for ground, and another pin for attaching additional components for compensation on the current loop, for a total of seven pins. For reasons that will be more apparent below, the PWM controller 130 does not require a separate pin to couple electrical components to the PWM controller 130 for configuring cable voltage drop compensation. This advantageously provides savings in manufacturing cost, complexity, and size. Components for configuring cable voltage drop compensation are typically external to the PWM controller IC to allow the IC to be adapted to different charging cables for different applications. Such a pin for cable voltage drop compensation is not necessary with the PWM controller 130, so the PWM controller 130 may be embodied in an IC with less than 8 pins, which is a typical pin count of conventional PWM controllers.
In the example of FIG. 1, the battery charger 100 is a primary-side-regulated (PSR) battery charger in that the coupling of the primary winding of the transformer 112 to ground (or other circuit) is controlled to generate the output voltage VO. More specifically, the PWM controller 130 drives the transistor M1 ON and OFF depending on the error voltage VEA, which reflects the difference between a reference voltage VO.REF and the output voltage VO. Generally speaking, the PWM controller 130 is configured to control the duty cycle of the conduction of the transistor M1 such that the duty cycle is decreased when the error voltage VEA increases and is increased when the error voltage VEA decreases. The PWM controller 130 controls the duty cycle of the transistor M1 conduction time so that the error between a target voltage (i.e., the desired value of the output voltage) and the output voltage VO can be minimized. In one embodiment, the PWM controller 130 uses peak current-mode PWM to control the duty cycle of the transistor M1 conduction time so that the output voltage can follow the target voltage.
An output detection circuit 105 with a gain of KS samples the output voltage to generate a sampled output voltage VO.SAMPLE indicative of the of the output voltage VO. As shown in FIG. 1, the output detection circuit 105 may sample the output voltage VO at a secondary winding other than that connected to the battery 104. In the example of FIG. 1, the output detection circuit 105 samples the output voltage VO at an anode of an output diode D2 that accepts a power supply VDD. The power supply VDD may be connected to a node connecting the cathode of the output diode D2 to an output capacitor C3. As will be more apparent below, an RC circuit 201 comprising a resistor Rc and a capacitor Cc limits the DC gain of the error amplifier 106 for charging cable voltage drop compensation.
FIG. 2 schematically shows the use of a reference voltage generator 202 internal to the PWM controller 130 in accordance with an embodiment of the present invention. In the example of FIG. 2, the PWM controller 130 performs peak-current mode control PWM to control the duty cycle of the transistor M1 conduction time so that the output voltage can follow the target voltage. Once the transistor M1 is turned ON, a drain-to-source current IDS linearly increases and flows through the primary winding of the transformer 112 and the transistor M1. The current IDS is converted into a sense voltage on the pin 132 using the sense resistor Rs. The error amplifier 106 generates the error voltage VEA on its output node at the pin 134 by subtracting the sampled output voltage VO.SAMPLE on the pin 133 from the reference voltage VO.REF. The transistor M1 is turned OFF by the PWM comparator 107 when the sense voltage reaches the error voltage VEA. Thus, the transistor M1 has more conduction time as the error voltage VEA increases.
The reference voltage generator 202 may be configured to generate the reference voltage VO.REF as a function of the error voltage VEA. For example, the reference voltage VO.REF may be generated to be directly proportional to the error voltage VEA. In one embodiment, the reference voltage generator 202 is configured to increase the reference voltage VO.REF when the error voltage VEA increases and to decrease the reference voltage VO.REF when the error voltage VEA decreases. In the example of FIG. 2, the reference voltage generator 202 is configured to increase or decrease with the error voltage VEA (see plot 203) substantially in a linear fashion. It is to be noted, however, that this is not necessarily the case as the reference voltage generator 202 may also use a non-linear function to generate the reference voltage VO.REF as a function of the error voltage VEA.
In the example of FIG. 2, the output detection circuit 105 is schematically shown as being across the output capacitor C2 for ease of illustration. As shown in FIG. 1, the output detection circuit 105 may sample the output voltage VO at another node on the secondary side of the transformer 112 without detracting from the merits of the present invention.
As shown in FIG. 2, the output detection circuit 105 samples the output voltage VO to generate a sampled output voltage VO.SAMPLE. The sampled output voltage VO.SAMPLE may be described as

VO.SAMPLE=KSVO  EQ. 1

where KS is the gain of the output detection circuit 105.

In the example of FIG. 2, the error amplifier 106 comprises a transconductance amplifier with a transconductance gain of KVI. The error amplifier 106 compares the sampled output voltage VO.SAMPLE to the reference voltage VO.REF to generate an error amplifier output current IEA indicative of the level of the output voltage VO. The error amplifier output current IEA may be described as

IEA=KVI(VO.REF−VO.SAMPLE)  EQ. 2

The error amplifier 106 generates the error amplifier output current IEA at its output node to feed the RC circuit 201 comprising the resistor Rc and capacitor Cc. The RC circuit 201 introduces finite DC gain to the output of the error amplifier 106 to generate an error voltage VEA, which is also indicative of the level of the output voltage.

The inductance of the primary winding of the transformer 112 is represented by the inductor Lm. When the transistor M1 is switched ON, the electrical current flowing through the inductor Lm, i.e., primary winding of the transformer 112, is the drain-to-source current Ids through the transistor M1. The current Ids develops a sense voltage across the resistor Rs. As can be appreciated, the sense voltage across the resistor Rs is indicative of the inductor current, which flows through the inductor Lm. The PWM comparator 107 compares the error voltage VEA to the sense voltage developed across the resistor Rs to reset the SR flip-flop 109, and thus switch OFF the transistor M1, in accordance with peak-current mode control PWM. Generally speaking, the PWM comparator 107 initiates turning OFF of the transistor M1 when the sense voltage on the resistor Rs rises to the same level as the error voltage VEA.
The driver circuit 110 is configured to switch ON the transistor M1 when the output Q of the SR flip-flop 109 is at a logical HIGH and to switch OFF the transistor M1 when the Q output of the SR flip-flop 109 is at a logical LOW. The oscillator 108 provides a clock signal that periodically sets the SR flip-flop 109 to switch ON the transistor M1. The PWM comparator 107 resets the SR flip-flop 109, and thus switches OFF the transistor M1, when the inductor current increases such that the sense voltage across the sense resistor Rs rises to the same level as the error voltage VEA. The timing relationship between the oscillator clock output of the oscillator 108 (“OSC CLK”), the gate-to-source voltage VGS of the transistor M1 as a result of driving by the driver circuit 110, the sense voltage on the sense resistor Rs (“Rs*Ids”), and the error voltage VEA is summarized in FIG. 3.
Referring back to FIG. 2, the output voltage VO is presented by the cable 102 as the battery voltage VO.BAT across the battery 104. Because of the voltage drop on the cable 102, the output voltage VO will be typically higher than the battery voltage VO.BAT during normal operation. Unless some form of cable voltage drop compensation is employed, the battery voltage VO.BAT will vary as the output current IO generated by the battery charger 100 changes.
In a conventional PWM controller, such as the FAN102 PWM controller by Fairchild Semiconductor, cable voltage drop compensation is performed using a dedicated cable compensation circuit to generate the reference voltage for the error amplifier on the voltage control loop. That scheme not only requires a dedicated cable compensation circuit but also needs a separate IC pin to configure the cable compensation circuit. In marked contrast, the PWM controller 130 does not require a dedicated cable compensation circuit and requisite cable compensation pin. For example, in the battery charger 100, the way the reference voltage VO.REF is generated may be predetermined in the factory and remain the same in the field, regardless of the charging cable employed. Cable compensation is thus performed by fixing the cable compensation gain and using the DC (direct current) loop gain of the output voltage control loop to adjust cable compensation to meet particular application requirements, such as output current, output voltage, and cable resistance. In the example of FIG. 2, the RC circuit 201 acts as low pass filter and shows constant gain characteristics below the critical frequency of the RC circuit 201 formed by resistor Rc and capacitor Cc (see EQ. 12).
In the example of FIG. 2, the DC loop gain of the output voltage control loop may be set by the DC gain of the error amplifier 106. By fixing the DC loop gain of the output voltage control loop according to the system specification such as output voltage, output current and cable resistance, a steady state error is introduced in the output voltage VO. The steady state error depends on the DC loop gain and may be used as an adjustable cable voltage drop compensation. This feature of the invention is further explained with reference to FIGS. 4 and 5.
FIG. 4 shows plots of the battery voltage VO.BAT and the output voltage VO as a function of output current IO (i.e., current delivered to the battery 104; see FIG. 2) in the case where the reference voltage VO.REF is constant and the gain of the error amplifier 106 is theoretically infinite (i.e., not limited; without the integrator formed by the resistor Rc and Cc). Notice how the voltage drop on the cable 102 increases as the output current increases, resulting in a non-regulated battery voltage VO.BAT.
FIG. 5 shows plots of the battery voltage VO.BAT and the output voltage VO as a function of the output current IO in the case of the battery charger 100. In the battery charger 100, the reference voltage VO.REF is configured such that the reference voltage VO.REF increases as the error voltage VEA increases. The error voltage VEA increases as the load current increases, which occurs when the load resistor (which includes the resistance of the cable 102) decreases.
Unlike in conventional battery chargers, the gain of the error amplifier 106 in FIG. 2 is not theoretically infinite, but instead limited by the RC circuit 201 formed by the resistor Rc and capacitor Cc. The value of the resistor Rc may be adjusted to change the DC gain of the error amplifier 106. This results in a steady state error that increases as the output current increases, compensating for the voltage drop on the cable 102. This is illustrated in FIG. 5 where the resulting voltage drop on the cable 102 varies with changing output current IO, delivering a regulated (i.e., relatively constant or within a limited voltage range) battery voltage VO.BAT across the battery 104.
Referring back to FIG. 2, the output power PO of the battery charger 100, the input power PIN of the battery charger 100, and the DC gain KEA.DC of the error amplifier 106 may be described as follows.




  
    
      
        
          P
          o
        
        =
        
          
            V
            o
            2
          
          
            R
            L
          
        
      
    
    
      
        EQ
        .
        
          
        
        ⁢
        3
      
    
  
  
    
      
        
          P
          
            i
            ⁢
            
              
            
            ⁢
            n
          
        
        =
        
          
            
              1
              2
            
            ⁢
            
              L
              m
            
            ⁢
            
              
                
                  f
                  s
                
                ⁡
                
                  (
                  
                    I
                    ds
                    
                      p
                      ⁢
                      
                        
                      
                      ⁢
                      k
                    
                  
                  )
                
              
              2
            
          
          =
          
            
              1
              2
            
            ⁢
            
              L
              m
            
            ⁢
            
              
                
                  f
                  s
                
                ⁡
                
                  (
                  
                    
                      V
                      EA
                    
                    
                      R
                      S
                    
                  
                  )
                
              
              2
            
          
        
      
    
    
      
        EQ
        .
        
          
        
        ⁢
        4
      
    
  
  
    
      
        
          K
          
            
              EA
              .
              D
            
            ⁢
            
              
            
            ⁢
            C
          
        
        =
        
          
            K
            VI
          
          ⁢
          
            R
            C
          
        
      
    
    
      
        EQ
        .
        
          
        
        ⁢
        5
      
    
  




where fS is the switching frequency dictated by the oscillator 108, IDSPK is the peak inductor current (i.e., peak of the current Ids through the inductor Lm), and RL is the effective load resistance (Vo/Io). Setting the output power PO equal to the input power PIN and solving for the steady state error voltage VEA.DC,





  
    
      
        
          P
          o
        
        =
        
          
            
              P
              
                i
                ⁢
                
                  
                
                ⁢
                n
              
            
            ⇒
            
              
                V
                o
                2
              
              
                R
                L
              
            
          
          =
          
            
              1
              2
            
            ⁢
            
              L
              m
            
            ⁢
            
              
                
                  f
                  s
                
                ⁡
                
                  (
                  
                    
                      V
                      EA
                    
                    
                      R
                      S
                    
                  
                  )
                
              
              2
            
          
        
      
    
    
      
        EQ
        .
        
          
        
        ⁢
        6
      
    
  
  
    
      
        
          V
          o
        
        =
        
          
            
              
                1
                2
              
              ⁢
              
                L
                m
              
              ⁢
              
                f
                s
              
              ⁢
              
                R
                L
              
            
          
          ⁢
          
            (
            
              
                V
                EA
              
              
                R
                S
              
            
            )
          
        
      
    
    
      
        EQ
        .
        
          
        
        ⁢
        7
      
    
  
  
    
      
        
          V
          
            
              EA
              .
              D
            
            ⁢
            
              
            
            ⁢
            C
          
        
        =
        
          
            
              K
              VI
            
            ⁢
            
              
                R
                C
              
              ⁡
              
                (
                
                  
                    V
                    
                      o
                      .
                      ref
                    
                  
                  -
                  
                    V
                    
                      o
                      .
                      sample
                    
                  
                
                )
              
            
          
          =
          
            
              K
              
                
                  EA
                  .
                  D
                
                ⁢
                
                  
                
                ⁢
                C
              
            
            ⁡
            
              (
              
                
                  V
                  
                    o
                    .
                    ref
                  
                
                -
                
                  V
                  
                    o
                    .
                    sample
                  
                
              
              )
            
          
        
      
    
    
      
        EQ
        .
        
          
        
        ⁢
        8
      
    
  




The output voltage VO in steady state may be obtained as follows.





  
    
      
        
          V
          o
        
        =
        
          
            
              
                
                  1
                  2
                
                ⁢
                
                  L
                  m
                
                ⁢
                
                  f
                  s
                
                ⁢
                
                  R
                  L
                
              
            
            ·
            
              
                K
                
                  
                    EA
                    .
                    D
                  
                  ⁢
                  
                    
                  
                  ⁢
                  C
                
              
              
                R
                S
              
            
          
          ⁢
          
            (
            
              
                V
                
                  o
                  .
                  ref
                
              
              -
              
                
                  K
                  S
                
                ⁢
                
                  V
                  o
                
              
            
            )
          
        
      
    
    
      
        EQ
        .
        
          
        
        ⁢
        9
      
    
  
  
    
      
        
          ∴
          
            V
            o
          
        
        =
        
          
            
              
                
                  
                    1
                    2
                  
                  ⁢
                  
                    L
                    m
                  
                  ⁢
                  
                    f
                    s
                  
                  ⁢
                  
                    R
                    L
                  
                
              
              ·
              
                
                  
                    K
                    
                      
                        
                          EA
                          .
                          D
                        
                        ⁢
                        
                          
                        
                        ⁢
                        C
                      
                      ⁢
                      
                        
                      
                    
                  
                  ·
                  
                    K
                    S
                  
                
                
                  R
                  S
                
              
            
            
              1
              +
              
                
                  
                    
                      1
                      2
                    
                    ⁢
                    
                      L
                      m
                    
                    ⁢
                    
                      f
                      s
                    
                    ⁢
                    
                      R
                      L
                    
                  
                
                ·
                
                  
                    
                      K
                      
                        
                          EA
                          .
                          D
                        
                        ⁢
                        
                          
                        
                        ⁢
                        C
                      
                    
                    ·
                    
                      K
                      S
                    
                  
                  
                    R
                    S
                  
                
              
            
          
          ·
          
            
              V
              
                o
                .
                ref
              
            
            
              K
              S
            
          
        
      
    
    
      
        EQ
        .
        
          
        
        ⁢
        10
      
    
  
  
    
      
        
          V
          o
        
        =
        
          
            
              M
              ·
              
                
                  R
                  L
                
              
              ·
              
                K
                
                  
                    EA
                    .
                    D
                  
                  ⁢
                  
                    
                  
                  ⁢
                  C
                
              
            
            
              1
              +
              
                M
                ·
                
                  
                    R
                    L
                  
                
                ·
                
                  K
                  
                    
                      EA
                      .
                      
                        
                      
                      ⁢
                      D
                    
                    ⁢
                    
                      
                    
                    ⁢
                    C
                  
                
              
            
          
          ·
          
            
              V
              
                o
                .
                ref
              
            
            
              K
              S
            
          
        
      
    
    
      
        EQ
        .
        
          
        
        ⁢
        11
      
    
  




where, KS is the gain of the output detection circuit 105 (see FIG. 2).

EQ. 11 shows that if the DC gain KEA.DC of the voltage control loop is infinite, the output voltage VO will be same as its target value (i.e., VO.ref/Ks). When the DC gain KEA.DC of the voltage control loop is not infinite, steady state error is generated and the output voltage VO will no longer be same as its target value. EQ. 11 further shows that the steady state error decreases as the load resistor RL increases (i.e. as the output current IO decreases) and the steady state error becomes zero when the load resistor RL is infinite (i.e. when the output current IO is zero). Therefore, the output voltage VO may be adjusted by adjusting the DC gain KEA of the error amplifier 106, which in turn may be adjusted by appropriate selection of the value of the resistor Rc (see EQ. 5). This advantageously allows the designer to select a value of the resistor Rc to generate an output voltage VO that results in a desired battery voltage VO.BAT for a given charging cable and other load characteristics, such as desired or application-specific output current and output voltage.
FIG. 6 shows a plot 401 of the gain of an error amplifier versus frequency in a voltage control loop of a PWM controller in accordance with an embodiment of the present invention. In the example of FIG. 6, the error amplifier is the error amplifier 106 of the battery charger 100 (see FIG. 2).
As shown in FIG. 6, the steady state or DC gain KEA of the error amplifier 106, and thus the voltage control loop, is limited to a predetermined value by the RC circuit formed by the resistor Rc and capacitor Cc. The DC gain KEA of the error amplifier 106 is for a range of switching frequencies below a critical frequency FC dictated by the values of the resistor Rc and capacitor Cc as follows,




  
    
      
        Fc
        =
        
          1
          
            
              R
              C
            
            ⁢
            
              C
              c
            
          
        
      
    
    
      
        EQ
        .
        
          
        
        ⁢
        12
      
    
  




Without the resistor Rc (i.e., without the RC circuit), the DC gain KEA of the error amplifier 106 would not be limited, which is noted in FIG. 6 as a dash line. With the RC circuit in place to limit the DC gain KEA, the designer may adjust the resistor Rc to adjust the DC gain KEA to a predetermined value to compensate for different charging cable characteristics. This advantageously allows for cable voltage drop compensation without the need for a dedicated and complex cable compensation circuit. As can be appreciated, an RC circuit at the output of the error amplifier of the voltage control loop can be readily implemented without using a separate circuit block. Furthermore, an additional pin for cable voltage drop compensation is not required. The resistor Rc may be coupled to the pin of the output of the error amplifier; such a pin is typically provided anyways for frequency compensation on the voltage control loop.

FIG. 7 show plots of the output voltage VO versus the output current IO in accordance with an embodiment of the present invention. As shown in FIG. 7, the output voltage VO may be adjusted by adjusting the DC gain KEA of the voltage control loop error amplifier. One way of adjusting the DC gain KEA is by adjusting the value of the resistor Rc on an RC circuit coupled to the output of the error amplifier. The DC gain KEA affects the steady state error, which affects the output voltage VO.
FIG. 8 shows plots of battery voltage VO.BAT versus output current in accordance with an embodiment of the present invention. As shown in FIG. 8, the DC gain KEA may be adjusted to achieve a regulated, target battery voltage VO.BAT across the rechargeable battery. Adjusting the DC gain KEA changes the output voltage VO to compensate for the voltage drop on the charging cable.
Circuits and methods for charging cable voltage drop compensation in battery chargers have been disclosed. While specific embodiments of the present invention have been provided, it is to be understood that these embodiments are for illustration purposes and not limiting. Many additional embodiments will be apparent to persons of ordinary skill in the art reading this disclosure.

## Claims

1. A battery charger comprising:
a transformer having a primary winding and a secondary winding;
a transistor coupled to the primary winding of the transformer, the transistor being configured to couple the primary winding to ground when the transistor is ON and to decouple the primary winding from ground when the transistor is OFF, the transistor being configured to receive an inductor current through the primary winding when the transistor is ON;
a comparator having a first input node and a second input node, the first input node of the comparator being coupled to receive a sense signal indicative of the inductor current, the second input node of the comparator being coupled to receive an error signal, the comparator being configured to generate at an output node of the comparator a control signal for controlling switching of the transistor by comparing the sense signal to the error signal; and
an error amplifier having a first input node and a second input node, the first input node of the error amplifier being coupled to receive a reference voltage that changes as a function of the error signal, the second input node of the error amplifier being coupled to receive a sampling of an output voltage generated by the battery charger to charge a battery by way of a charging cable, the error amplifier being configured to generate the error signal at an output node of the error amplifier by comparing the sampling of the output voltage to the reference voltage, the error signal being indicative of a level of the output voltage, the error amplifier being configured to compensate for voltage drop on the charging cable by having a predetermined and limited DC gain.

2. The battery charger of claim 1 wherein the error amplifier comprises a transconductance amplifier.

3. The battery charger of claim 1 further comprising an RC circuit coupled to an output node of the error amplifier to limit the DC gain of the error amplifier to a predetermined value.

4. The battery charger of claim 1 wherein the comparator comprises a PWM (pulse width modulation) comparator configured to turn OFF the transistor when the inductor current rises to a threshold level.

5. The battery charger of claim 4 wherein the error signal is an error voltage and the sense signal is a sense voltage developed on a sense resistor by the inductor current, and the PWM comparator turns OFF the transistor when the sense voltage rises to a same level as the error voltage.

6. The battery charger of claim 4 further comprising an SR flip-flop, and wherein the PWM comparator resets the SR flip-flop to turn OFF the transistor when the inductor current rises to a threshold level.

7. The battery charger of claim 1 further comprising a sense resistor coupled to receive the inductor current to develop the sense signal comprising a sense voltage when the transistor is ON.

8. The battery charger of claim 1 further comprising an oscillator configured to periodically set an SR flip-flop to turn ON the transistor.

9. The battery charger of claim 1 further comprising an output detection circuit configured to generate the sampling of the output voltage.

10. An electrical circuit for charging a battery, the circuit comprising:
an error amplifier in a voltage control loop of a battery charger that is configured to charge a battery by way of a charging cable, the error amplifier having a first input node and a second input node, the error amplifier being configured to generate an error signal at an output node of the error amplifier by comparing a sampled output voltage indicative of an output voltage of the battery charger at the first input node of the error amplifier to a reference voltage at the second input node of the error amplifier, a DC gain of the voltage control loop being limited to a predetermined value to compensate for voltage drop on the charging cable and develop a regulated battery voltage to charge the battery;
a reference voltage generator coupled to the second input node of the error amplifier, the reference voltage generator being configured to generate the reference voltage as a function of the error signal; and
a comparator having a first input node and a second input node, the comparator being configured to generate at an output node of the comparator a control signal to control switching of a transistor and generation of the output voltage by comparing the error signal at the first input node of the comparator to a sense signal at the second input node of the comparator, the sense signal being indicative of inductor current flowing through a primary winding of a transformer of the battery charger.

11. The circuit of claim 10 wherein the error amplifier comprises a transconductance amplifier, the error signal is an error voltage developed across an RC circuit by an error current output of the error amplifier, and the sense signal comprises a sense voltage developed by the inductor current on a sense resistor.

12. The circuit of claim 10 further comprising:
a transistor coupled to receive the inductor current when the transistor is ON, and wherein the sense signal comprises a sense voltage developed by the inductor current on a sense resistor coupled to the transistor.

13. The circuit of claim 10 wherein the DC gain of the voltage control loop is limited by a DC gain of the error amplifier.

14. The circuit of claim 13 wherein the DC gain of the error amplifier has a predetermined value set by a resistor coupled to an output node of the error amplifier.

15. The circuit of claim 10 further comprising an output detection circuit configured to sample the output voltage to generate the sampled output voltage.

16. The circuit of claim 10 wherein the comparator comprises a PWM comparator.

17. A method of compensating for voltage drop on a charging cable coupling a battery charger to a rechargeable battery, the method to be performed by an electrical circuit and comprising:
sensing an output voltage of the battery charger to generate a sampled output voltage;
comparing the sampled output voltage to a voltage reference to generate an error voltage using an error amplifier, the error amplifier having a limited DC gain;
adjusting the voltage reference as a function of the error voltage, the error voltage being indicative of a level of the output voltage;
comparing the error voltage to a sense voltage indicative of inductor current on a primary winding of a transformer to control generation of the output voltage; and
charging the rechargeable battery with a battery voltage presented by the output voltage through the charging cable, the DC gain of the error amplifier being configured to generate the battery voltage to compensate for voltage drop on the charging cable.

18. The method of claim 17 wherein the error amplifier has a DC gain limited by an RC circuit coupling an output of the error amplifier to ground.

19. The method of claim 18 wherein the comparison of the error voltage to the sense voltage is performed by a PWM comparator.

20. The method of claim 17 wherein the error amplifier comprises a transconductance amplifier and the method further comprises:
outputting an error amplifier output current from the error amplifier to an RC circuit coupled to an output node of the error amplifier.