2 Closed Loop Voltage Control using Core Independent Peripherals
A buck converter uses periodic switching to step down the input voltage, Vin. This is achieved by controlling a power MOSFET using a PWM signal. The duty cycle of this signal decides the output voltage of the regulator, but, as the output voltage of the buck converter would naturally vary based on differences in load current, the PWM signal needs some kind of feedback regulated switching controller to compensate for this.
Figure 2-1 shows the basic layout of such a controller. It is implemented using an error amplifier, analog comparator and a ramp signal to adjust the duty cycle of the switch on the buck converter based on feedback from the output. With the introduction of the op amp peripheral of the AVR® DB family of microcontrollers, it is possible to implement this control system using only core independent peripherals with some external resistors and capacitors. By combining the voltage regulation of a system with the microcontroller, the cost of the system, as well as complexity, can be reduced by eliminating the need for a dedicated controller IC. The controller also adds the ability to adjust the output voltage in software, making it a practical solution for digitally adjustable power supplies and fine adjustment to compensate for tolerances in external components.
Figure 2-2 shows the internal and external connections on the AVR DB to implement this controller. The code for the configuration of the peripherals is available through Atmel START. Additional components, as seen in Figure 2-3, are needed to achieve proper amplification and phase compensation through the error amplifier, as well as a simple RC-filter, which is used to shape the square wave output of the timer to be used as the ramp voltage for PWM-generation.