The Secret mixed-signal Life of PWM Peripherals

Source: Internet
Author: User

The Secret mixed-signal Life of PWM Peripherals

Pulse-width modulation (PWM) peripherals has enjoyed a long association with microcontrollers and power control, starting With the motor control and power conversion. For the more part, these applications use traditional digital PWM designs, with the PWM peripheral driving a MOSFET driver , which drives the Mosfet-which, in turn, drives the Motor/inductor. The basic design elements of a counter, the Digital-magnitude comparators and a flip flop stereotypically have been Digita L, placing the PWM peripheral in the same category as Universal Asynchronous Receiver/transmitters (Usarts), serial periph eral Interface (SPI) ports and general-purpose digital I/O.

Recently, however, some analog have slipped into the mix, which have changed the PWM peripheral from an upstanding member of The purely digital community into a mixed-signal module that seemingly have a secret double life-showing a digital face To the microcontroller, while secretly handling analog functions when the other digital peripherals aren ' t looking.

This all started innocently enough and the inclusion of a simple shutdown function driven by a voltage comparator. Initially, this change is intended to merely add a emergency overcurrent shutdown, only to is used in the direst of over Current conditions. However, once included in the design, the change slowly morphed the peripheral into a true mixed-signal, Cycle-by-cycle cu Rrent-limiting PWM module. Once the occurred, the former purely digital PWM peripheral became the mixed-signal peripheral that we know today.

So, what types of mixed-signal designs LEDs to this? Quite a surprising number of them, actually, with power conversion being the initial step. Let's review this design.

A true "Level 4" Switch-mode power supply (SMPS) involves full digital feedback and a PWM, outputs voltage with an ANA Log-to-digital Converter (ADC), filters the resulting values through a proportional integral differentiator (PID) software Routine and then outputs the result of a standard all-digital PWM peripheral. The result is a fully digital version of a Voltage-mode switching power supply. Fig. 1 shows a representative block diagram.

Although the advantages of a fully digital feedback path is impressive-including elimination of temperature and comp Onent-tolerance problems in the Error-amplifier/loop filter, and the ability to switch the response characteristics on the Fly-limitations still exist to the this design. These limitations is primarily in the pulse-frequency restrictions imposed by the purely digital PWM. (Remember a PWM peripheral with a resolution of 8 bits running at a requires a 128-mhz clock.)

In fact, improving the PWM peripheral ' s resolution/frequency is one of the main drivers behind the introduction of PWM Modules clocked by high-frequency, phase-locked loops. Further complicating the problem is the need for high resolution over a fairly restricted duty-cycle range. Unfortunately, this doesn ' t translate to a simpler circuit-it just adds the requirement for higher resolution over the PWM ' s entire duty-cycle range. The result is a predictably higher current draw and a correspondingly higher cost for the microcontroller.

Although higher clock frequencies is the purely digital solution, a mixed-signal design based upon the Voltage-comparator Shutdown solution have become popular for cost-sensitive applications. Using The combination of the PWM peripheral and a comparator-based shutdown, a cycle-by-cycle current limiting system is P Ossible. This enables a current-mode design, does not require either a high-frequency clock or greater PWM resolution. A lower resolution PWM module can provide the maximum duty cycle required while the comparator terminates the PWM pulse a Synchronously in response to the inductor current feedback. The set point for the comparator could is generated by either an analog-loop filter or by a moderate resolution DIGITAL-TO -analog Converter (DAC) and the PID algorithm, described above. Fig. 2 illustrates the digital form of the resulting topology.

This step into mixed-signal design established the PWM peripheral as a mixed-signal device. Since Then, designers has quickly jumped on the bandwagon, wondering if there is other mixed-signal jobs the PWM periphe RAL can perform. The answer is, of course, a resounding "yes."

By combining a purely digital PWM with a low-pass filter, the A low-frequency DAC can be created. The variable duty cycle of the digital PWM output is averaged by the Low-pass filter to produce a variable voltage A percentage of the digital supply voltage, with the duty cycle of the PWM setting the percentage. The challenge is to set the RC filter corner frequency such that it adequately filters the ripple from the resulting OUTPU T. Fig. 3 shows an example circuit.

To keep the output ripple at less than one-half LSB of the PWM, the corner frequency for the filter must be greater than 1 /nth of the PWM frequency; Where N is the maximum count of the PWM. For example, to adequately filter a 10-bit PWM, the filter must attenuate the 0 VDD swing of the PWM output down to less t Han 1/1,024th of VDD. Given a single-pole RC attenuates a signal 10-to-1 for every decade of frequency; This means, the PWM pulse frequency must be 1,024xthe filter ' s corner frequency. Thus, a 10-khz, 10-bit PWM needs a 10-hz filter.

Of course, going to more Poles in the filter would raise the corner frequency 10-to-1 per pole, per decode of frequency, MO Ving Tsun the minimum corner frequency for the filter appropriately upward.

While this sounds simple, remember it has a couple of limitations. First, the lower the filter ' s corner frequency, the slower the slew rate of the DAC. Secondly, the more poles with the filter, the greater the leakage due to the capacitors and the more of the offset in the OUTPU T. Typically, the practical limit is a-three poles, generating a 100-to-1 to 1000-to-1 attenuation per decade in freq Uency. That gives a 10-bit pwm-based DAC with a 10-khz pulse rate, and a 2-pole filter a maximum output slew rate of 1 ms to 2 ms For a 0 VDD shift.

Obviously, the PWM peripheral ' s mixed-signal life does not end here-countless variations has followed, including a pwm- Driven attenuator. For this circuit, the PWM drives a simple RC filter as before, but a second input was introduced for the signal of Be atten Uated. Fig. 4 is an example circuit.

The PWM pulse shorts the incoming signal to ground during the active portion of each pulse, and then releases the incom ing signal to pass unattenuated during the inactive portion. The resulting chopped waveform is then filtered by the RC network to remove the PWM switching frequency. The output is a attenuated version of the input, in which the attenuation were set by the PWM peripheral ' s duty cycle.

The challenge in the circuit design are to choose an appropriate corner frequency for the RC filter and a sufficiently h IgH frequency for the PWM. The RC filter ' s corner frequency must is high enough to allow the incoming signal to pass without attenuation, or a signif Icant phase shift at 0% attenuation. The corner frequency must also is low enough to sufficiently attenuate the PWM signal, chopping the signal. To meet both requirements, the incoming signal usually can is limited to only very low frequencies-typically, less than to + Hz. Also, keep in mind that a significant number of the incoming signal ' s harmonics must pass the filter as well, if the Signa L was to retain its original waveform.

Another factor influencing, the design is, the filter's corner frequency, from the input point of view, was based on R1 Plus R2; The corner frequency for the PWM is based upon R2 alone. However, as mentioned previously, going to a higher-order filter increases the PWM signal ' s attenuation, which allows a hi Gher Corner Frequency while still attenuating the PWM chop.

Another interesting circuit proposal is to combine the PWM peripheral ' s Comparator-driven auto shutdown with the Attenuato R Circuit discussed earlier. Remember that part of the reason for a transition-to-current mode in the switching power supply example are to allow an Inc Rease in resolution without increasing the PWM ' s clock frequency. The proposal is to apply a similar idea to the attenuator ' s frequency problem.

By adding a second open-collector output to the existing Attenuator PWM and using it to short an RC network, a synchronize D ramping voltage (similar to the ramping current in the Current-mode switcher) can be created. The ramping voltage and is fed to the voltage comparator, with a control voltage driving the other comparator input. The result is a voltage-controlled PWM output. Given the duty cycle of the PWM also determines the attenuation of the circuit, the final result is a Voltage-control Led Attenuator with the ability to use a higher PWM frequency without losing resolution. Fig. 5 is the example circuit.

So, the PWM peripheral have begun participating in circuits for driving MOSFETs, creating DACs and attenuating ac WAVEFO Rms. Does this really constitute a complete fall from digital grace? If This were the extent of the PWM module's cross into the gray area of mixed-signal design, it could probably be forgiven and pulled back into the digital fold. However, once the PWM took its first steps to the seductive, low-cost nature of mixed-signal designs, other steps follow Ed. Since then, the PWM peripheral have been firmly painted as a mixed-signal peripheral. Because of this, new fringe power-supply designs has come along.

For example, a hot-wire anemometer design was based on the principal so any object warmer than the ambient temperature Would lose heat to any airflow. More importantly, the object would lose heat at a-proportional to the airflow. If We build a circuit that heats an object to a few degrees warmer than the ambient air and then measure the heat loss, we Can determine the airflow over the object. If The feedback circuit is designed such and the object in the airflow are always heated to just above ambient and then the O Ngoing Energy requirement to keep it heated are equal to the heat loss to the airflow and proportional to the airflow Itsel F.

To build this circuit, a few simple building blocks is needed:two temperature sensors (one for ambient and one for the H Eated object), a difference amplifier with an offset, a heater driven by the output of the amplifier and an integrator to Sum the energy dumped into the heater. For the sake of simplicity, assume the heater are the warm object in the airflow.

The temperature sensors is easy-just a few positive temperature coefficient thermistors. The amplifier is simply a op-amp configured as a difference amplifier, and the driver for the heater are a PWM peripheral With the comparator shutdown feature. Together, they create a circuit that keeps the heated thermistor slightly warmer than the unheated thermistor (Fig. 6< /c0>).

The system for accumulating the amount of energy dumped into the heater are just a counter with their clock gated by the P WM output. When the PWM output was high (heating the sensor), the counter increments. When the PWM output was low, the counter stops. A fixed sample period for the accumulation results in a counter value, a percentage of full power to the heater. Scaled, with a subtraction of any fixed offsets, the value represents the airflow value in whatever units is needed.

Although the accumulation function of the counter is purely digital, the feedback and control of the Pwm/comparator Combin ation Forever branded the PWM a mixed-signal peripheral. No longer a member of the purely black-and-white world of digital peripherals, today's PWM walks both sides of the line. It operates interchangeably as either purely digital control of an analog function or with analog feedback that places it Into the Mixed-signal camp. Whatever the future holds, for now the PWM peripheral's movement in the mixed-signal arena have given embedded designers an Other tool for monitoring and controlling we world.

The Secret mixed-signal Life of PWM Peripherals

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.