This article originally appeared as a How-To article in EDN Magazine.
General 8-bit MCU
Reducing bill of materials (BOM) cost and footprint area are among the top design considerations for microcontroller (MCU)-based embedded designs. One way to achieve these design goals in 8-bit MCU designs with switching converters is to drive these switching converters with a high-frequency clock output rather than with a traditional pulse-width modulation (PWM) output at lower frequencies. This technique enables a reduction in the switching converter inductor size, resulting in reduced BOM cost and board space requirements.
Switching converters are commonly used to efficiently step-up or step-down voltages within embedded systems. These converters use an inductor to store and then transfer energy to the load in the system. The inductor is periodically switched on to transfer energy from the supply into the magnetic field of the inductor. When the supply is switched off, the inductor transfers its energy into the load. These converters are generally switched on and off by a PWM signal, and the signal characteristics can influence the output characteristics of the converter.
Let’s consider, for example, a boost converter, which is a switching converter that generates an output voltage that is greater than the input voltage.
Generally, boost converters are operated in "continuous" mode. This means that the inductor in the converter is not fully discharged (i.e., current in the inductor does not reach zero) between switching cycles.
The formula for determining the output voltage of a continuous mode boost converter is rather simple:
Where Vo equals the output voltage, Vi equals the input voltage, and D equals the duty cycle percentage. In this case, the output voltage can be varied by simply changing the duty cycle of the PWM of the switching element. However, this mode comes with one caveat: the inductor must be large enough to store the energy required by the system during its charge and discharge cycles. This means the slower the switching frequency, the longer the inductor has to charge and discharge, and thus the larger the inductor must be. Larger inductors are, of course, more expensive, so generally switching converter designs favor higher switching frequencies over lower switching frequencies.
There is an upper limit to the benefits of a higher switching frequency, however. As switching frequencies increase, losses also increase within the switching element of the circuit (usually a MOSFET), and inside the inductor, so there is an upper limit on switching frequency once these losses become prohibitively large.
Some 8-bit MCUs, such as Silicon Labs’ C8051 and EFM8 devices, have the ability to generate PWM outputs with varying duty cycles using the programmable counter array (PCA) module, which means they are well-equipped to drive boost converters in continuous mode. However, the maximum PWM frequency is often as low as 95.7 kHz (the fastest internal oscillator is usually 24.5 MHz, which is then divided by 256 for 8-bit PWM), which is rather slow by switching converter standards. This means that, generally, 8-bit MCUs operating switching converters in continuous mode will require relatively large, and thus expensive, inductors.
Online calculators are available to help developers determine the required components in a continuous mode boost converter, such as DIY DC/DC boost calculator. For example, let’s use the following design requirements:
Vin = 3 V
Vout = 12 V
Iout = 20 mA
Switching Frequency = 95.7 kHz
We will need to run our switching converter at 75 percent duty cycle with a 147 µH inductor.
An alternative to continuous mode is "discontinuous" mode in which the inductor current is allowed to reach zero during the discharge period of the switching cycle. This approach has the side effect of complicating the formula for the output voltage:
Where L is the inductor value, Io is the output current, and T is the switching period (the inverse of the switching frequency). As you can see, the formula is more complicated, and it still contains the duty cycle percentage as a dependency, but it has introduced additional dependencies that we can use to generate the desired output, even with a fixed duty cycle. For example, with everything else fixed, if we decrease both T and the inductor size L proportionally, the output characteristics will remain the same. This means that we can use an arbitrary duty cycle, and then increase the switching frequency as needed to reduce the inductor size and cost.
The PCA, once again, has a feature that can be useful in this mode: frequency output generation. In this mode, a 50 percent duty cycle frequency output can be generated, up to SYSCLK divided by 2, or 12.25 MHz in the normal case. Due to the previously mentioned switching losses, switching converters are not usually operated at frequencies as high as this, typically operating in the range of 100 kHz to 4 MHz. At a more reasonable switching frequency of 3.062 MHz (a 24.5 MHz SYSCLK divided by eight), we can repeat our previous example, this time using discontinuous mode with a fixed 50 percent duty cycle:
Vin = 3 V
Vout = 12 V
Iout = 20 mA
Switching Frequency = 3.062 MHz
Duty Cycle = 50%
With this, the required inductor size is reduced to 2.04µH! That's approximately 1/72nd the size of the continuous mode with PWM example, for the same output characteristics.
Comparing inductors at ~2.2 µH vs ~150 µH, that are otherwise comparable:
SRN4026-151M : 150 µH, 220 mA: $0.18 @1000 : 4×4mm
MLZ2012A2R2M : 2.2 µH, 210 mA: $0.058 @1000 : 2×1.25mm
As you can see, this smaller inductor results in a BOM cost reduction of 12.2 cents, or a 68 percent reduction. The footprint is also reduced by 11.5mm2, or 72 percent.
Example circuit and firmware
As a proof of concept, we have developed a circuit and associated firmware. In the previous example, the characteristics of the circuit are static. As long as Vin is 3V, and the load continues to draw 20 mA at 12V, the MCU merely needs to output a 3.062 MHz square wave to the switching circuit to maintain a stable output. If the load draws less than 20 mA at 12V, the output voltage will continue to increase until equilibrium is reached. Without any sort of feedback mechanism, we cannot be sure of the output voltage if the load varies.
In the following circuit, a voltage divider has been provided to allow the MCU to measure the output voltage, and thus create a feedback loop, enabling us to change the behavior of the output at runtime. Regulating the output voltage can be accomplished by disabling the frequency output when the output voltage is too high, and re-enabling it when the output voltage is too low. Additionally, a dummy load, represented by R4 and the LED, has been attached to the output.
Example Circuit Design
The firmware was written for an EFM8BB1 MCU, though this could be ported to any 8-bit MCU with a PCA module and an analog to digital controller (ADC) with the Window Compare feature. The PCA is configured to output Channel 0 to pin P0.1, with a frequency output of 3.062 MHz. The ADC is configured to sample on pin P0.3 at 300 kHz, using Timer 3 overflows to trigger conversions. The ADC is configured to only trigger an interrupt if an ADC sample falls outside of the expected voltage range, using the Window Compare feature. With everything configured, the entire feedback loop is contained within the ADC ISR:
SI_INTERRUPT (ADC0WC_ISR, ADC0WC_IRQn)
// Clear Window Compare interrupt flag
ADC0CN0_ADWINT = 0;
// Store the ADC sample
sample = ADC0;
if (sample > MAX_COUNTS)
// Disable PWM
P0MDOUT &= ~P0MDOUT_B1__BMASK;
// Set LT Value, Clear GT Value
ADC0LT = MIN_COUNTS;
ADC0GT = 0xFFFF;
else if (sample < MIN_COUNTS)
// Enable PWM
P0MDOUT |= P0MDOUT_B1__PUSH_PULL;
// Set GT Value, Clear LT Value
ADC0LT = 0;
ADC0GT = MAX_COUNTS;
If the ADC takes a measurement that is greater than the ADC0GT value or less than the ADC0LT value, this interrupt will fire. If the measurement is within this range, nothing will happen. Once in the ISR, if the measurement was greater than the expected maximum value, the frequency output is disabled. If it is less than the expected value, the frequency output is re-enabled. The output is effectively disabled by turning the port to open-drain mode, so that the pin is pulled low by the resistor R1, turning off the MOSFET Q1.
The MAX_COUNTS is defined to be the ADC code that represents 9.5V. MIN_COUNTS represents 8.5V. This should effectively limit the output voltage to 8.5-9.5V.
The following oscilloscope image shows the output of the circuit with this code.
Channel 1 is the output voltage. Channel 2 is the frequency output that is applied to the circuit's BOOST pin. As you can see, this firmware activates the frequency output when the voltage is below 8.5V and disables the frequency output when the voltage is above 9.5V.
In practice, the usage of the ADC in Window Compare mode requires very little CPU overhead. In our measurements with this circuit, the CPU is active for approximately 12 µs inside the ISR, twice every 8.9 ms. The total CPU overhead is then approximately 0.14 percent. Decreasing the output capacitance will have the effect of requiring more frequent updates, as the output voltage will take less time to charge to the maximum limit, and less time to discharge to the minimum limit.
Below is the circuit with the BOOST pin connected to the MCU:
And here is with the BOOST pin disconnected:
The output voltage in this case drops back down to Vin, which is less than required to light the LED.
Switching converters are commonly used in embedded applications to efficiently convert one voltage to another. These switching converters are often controlled by a PWM signal with a varying duty cycle to control the converter’s output characteristics. However, for most MCUs, the ability to generate a PWM signal with a varying duty cycle is limited to relatively low frequencies, which necessitates the use of larger inductors. As an alternative, a high-frequency, fixed-duty-cycle clock output can be used to decrease inductor size, reducing BOM costs and board space requirements.
About the author
Brian Lampkin is a microcontroller (MCU) applications engineer at Silicon Labs. He joined the company in 2013 and supports Silicon Labs’ 8-bit and 32-bit MCU products. Brian received a BSEE from Mississippi State University in 2013.