19.5.1 Peak Current-Mode Control

The SMPS topologies, such as Buck, Boost and Buck-Boost, generate subharmonic oscillations when controlled with Peak Current-mode control. These oscillations occur under specific conditions, such as Continuous Current-mode and a duty cycle greater than 50%. The subharmonic oscillations can be damped by using slope compensation. The analog comparator module can be utilized for such applications, eliminating the need for additional external analog circuitry to perform slope compensation. The comparator module is used in conjunction with the PWM module to generate the Current-mode PWM signal. A typical Peak Current Buck mode power supply is illustrated in Figure 19-6.

Figure 19-6. Buck Converter with Peak Current-Mode Control

The analog comparator module is configured to reset the PWM module when the measured inductor current peak reaches the current level determined by the outer control loop. The outer control loop consists of the output voltage, measured by the ADC, and compared with a desired voltage reference. The error counts generated are treated with a compensator gain to arrive at the peak current level for the current PWM cycle. The peak current level is applied to the DAC to generate an equivalent analog signal with which the actual inductor current is compared by the comparator. The waveforms of the Peak Current-mode control are as shown in Figure 19-7. Note that the pulse width is different in the consecutive cycles, even though the current reference, iREF, is constant.

Figure 19-7. Peak Current-Mode Waveform without Slope Compensation

The slope compensation module alters the DAC output voltage slope, hence the reference to the inner current loop. In the absence of the slope compensation module, the output of the DAC is held constant for a given PWM cycle (as shown in Figure 19-8). The slope generation module causes the reference current to slope based on the values set in the register. The slope direction can be set to positive or negative depending on the applications, although negative slope is generally used. The rate of the slope is determined by the SLPxDAT register. DACDAT holds the DAC value at the start of the PWM cycle, and the DAC value at the end of the PWM cycle is held by DACLOW. The waveforms of the Peak Current-mode control with slope compensation are as shown in Figure 19-8. Note that the pulse width is the same in all cycles for a constant current reference, iREF.

Figure 19-8. Peak Current-Mode Waveform with Slope Compensation

Initialize DAC with Slope Compensation shows the settings of the analog comparator module for generating the slope compensated waveforms. In this design, the buck converter operates at an input of 5V and an output of 3.3V, 1A. The operating frequency of the converter is 200 kHz. The period timer for the PWM is set at 200 kHz, and the duty cycle is set at 95%. The clock frequency for the DAC module is set at 500 MHz. The current measurement is connected to the positive input of the comparator. The DAC provides the reference current for the peak current trip and is connected internally to the negative input of the comparator. The reference current is generally the output of the compensator (digital filter), which operates on the outer voltage loop error signal. The PWM cycle is terminated when the measured input current exceeds the DAC reference current, iREF, as shown by Point A in Figure 19-8. This is due to configuration of the SLPSTOPBx trigger in Figure 19-6.The dashed curve shows the reference current, iREF, if SLPSTOPBx is not triggered. In this case, iREF continues until the SLPSTOPAx signal is triggered and is indicated by Point B in Figure 19-8.

Initialize DAC with Slope Compensation

	// PWM Configuration
    PCLKCONbits.MCLKSEL = 1;    // AFVCO/2 as clock source (500 Mhz)
    PG1CONLbits.CLKSEL = 1;     // Clock selected by MCLKSEL
    PG1PER = 2499;              // PWM frequency is 200 kHz, 5 uS period
    PG1DC = 2375;               // 95% duty cycle, 4.75 uS on time     
    PG1IOCONHbits.PENH = 1;     // PWM Generator controls the PWMxH output pin
    PG1IOCONHbits.PENL = 1;     // PWM Generator controls the PWMxL output pin    
    // PWM PCI setup, use CLDAT when comparator 1 trips
    PG1CLPCILbits.PSS = 27;     // PCI source is Comparator 1 
    PG1CLPCILbits.AQSS = 2;     // LEB active as Acceptance Qualifier   
    PG1CLPCILbits.AQPS = 1;     // Invert Acceptance Qualifier (LEB not active)
    PG1CLPCILbits.TERM = 1;     // Auto terminate as Termination Event
    PG1CLPCIHbits.ACP = 3;      // Latched PCI Acceptance Criteria
    PG1IOCONLbits.CLDAT = 0b01; // PWM1L = 1 and PWM1H = 0 if CL event is active
    PG1LEBHbits.PHR = 1;        // Rising edge of PWMxH triggers the LEB counter
    PG1LEBL = 30;               // 500 nS LEB timer   
    // PWM to DAC Trigger setup   
    PG1TRIGA = 750;             // ADC Trigger 1 at 1.5 uS, used as SLPSTRT
    PG1EVTLbits.ADTR1EN1 = 1;   // PGxTRIGA as trigger source for ADC Trigger 1
    PG1TRIGB = 2000;            // ADC Trigger 2 at 4 uS, used as SLPSTOPA
    PG1EVTHbits.ADTR2EN2 = 1;   // PGxTRIGB as trigger source for ADC Trigger 2
    PG1CONLbits.ON = 1;         // Enable PWM
    // DAC Configuration
    DACCTRL2bits.SSTIME = 0x8A; // Default value 552 nS @ 500MHz
    DACCTRL2bits.TMODTIME = 0x55;// Default value 340 nS @ 500MHz
    DAC1DATbits.DACDAT = 2703;  // 2.17v steady state value
    DAC1DATbits.DACLOW = 1113;  // 0.89v, value at the end slope
    SLP1DATbits.SLPDAT = 41;    // Slope = (2703-1113)*16/((4u-1.5u)/4n)
    SLP1CONbits.SLOPEN = 1;     // Enable Slope compensation 
    SLP1CONbits.SLPSTRT = 1;    // PWM1 ADC Trigger 1
    SLP1CONbits.SLPSTOPA = 1;   // PWM1 ADC Trigger 2
    SLP1CONbits.SLPSTOPB = 1;   // Comparator 1
    DAC1CONbits.CBE = 1;        // Enable comparator blanking
    DAC1CONbits.TMCB = 125;     // 125 * 4 nS = 500 nS blanking time
    DAC1CONbits.DACOEN = 1;     // Enable DAC output    
    DAC1CONbits.DACEN = 1;      // Enable DAC 1
    DACCTRL1bits.DACON = 1;     // Enable DAC system