Introduction
Class D amplifiers have proven a higher power efficiency performance against linear classes such as Class A, B and AB. Power losses on Class D amplifiers are mainly due to non-ideality of the output transistors, operating as switches, controlled by Pulse Width Modulators.
This example describes a method for utilizing both the Enhanced Pulse Width Modulator (ePWM) and the Analog-to-Digital Converter (ADC) of the TMS320F2808™ digital signal controller as D-Class Audio amplifier. The method involves analog full bridge D-class power amplifier and analog low-pass filtering the amplified PWM signal to remove high frequency components, leaving only the audio-frequency content.
Hardware and Software Requirements
This example was originally developed using the following hardware and software:
- MatLab R2008a
- Code Composer Studio (CCS) v3.3
- eZDSP-F2808 board.
Related Files
- Powerpoint Presentation ClassD.ppt
- Simulink Model for Real-Time - eZDSPF2808_ClassD.mdl
Principle of Operation
The amplifier comprises three main blocks (shown in Figure 1):
Input Circuit:
This block interfaces with the audio source, attenuates it DC component and limits the input voltage to the ADC to the range 0 - 3.3V. The circuit contains also a DC-DC converter, for the DSP input buffer.
Digital Signal Controller
The TMS320F2808, converts the analog signal to a pair of PWM signals that feed the output stage (Please refer to section ). It operates with 100 MHz. The ADC samples the input signal at a 97.656.25 Ksps rate. The ePWM, generates PWM signal with a period of 102.4 μs and duty cycle proportional to the input signal level. The ePWM coupled with a D-Class output stage and a second order passive RLC filter, provides a DAC equivalent.
Sampling the Analog Input
The analog signal is converted to PCM values as shown in . The conversion is performed as described in Table 1. The ADC operates in a sampling rate of 97.656 KHz (100 MHz/1024).
Table 1: Analog to Digital Conversion
Input Voltage (Vin) | Digital Value(ADCRESULT) | ||
Vin<0V | 0 | ||
0≤Vin<3V | 4096∗
| ||
Vin≥3V | 4095 |
PCM → PWM
The PCM values are converted to PWM as shown in Figure 4. A period of 102.4 msecs (1024 clock cycles) was chosen. The relation PCM Value/Full Range is translated to the duty cycle of the PWM. A duty cycle of 512 (50 %) corresponds to 50% of the full range, for example. In this example sample values in the range 0-4095 will be mapped to duty cycle values (CMPA) in the range 0-1023, by dividing by 4 (shift right 2 bits), as shown in Figure 5.
The Interrupt Service Routine
The process described in the previous section is executed in the Interrupt Service Routine (ISR). The ADC conversion is triggered by the ePWM block when the PWM period starts (every 102.4 msecs). The ADC generates an interrupt at the end of conversion. The interrupt service routine updates the PWM duty cycle (CMPA value) on the value of this sample. The new duty cycle will be loaded in the beginning of the next PWM period. The process is described in Figure 6.
Output Stage:
This module contains the H-bridge, and a Low Pass Filter to remove high frequency components, leaving only the audio-frequency content. This module basically implements a Digital to Analog Converter using a PWM signal generator and a Low Pass Filter as shown in . This method is described in .
The basic configuration of a D-Class amplifier is the Half-Bridge (H-Bridge) configuration. Two output transistors operate as switches, driven by complementary PWM signals. One of the transistors is off (current through it is close zero), while the remaining one is on (voltage across it is close to zero), keeping the power dissipation very low.
The full-bridge Class D amplifier comprises two half bridges, driven by synchronized PWM signals, having two alternate conduction paths through the load, each one having a pair of transistor conducting while the remaining pair is off.
Implementation
This section will describe the process of building a Simulink model for code generation according to description in chapter .
In the first part the framework for interrupt handling will be created. The second section will describe the creation of the Interrupt Service Routine.
Interrupt
- Create a new Simulink model:
- Add the "F2808 eZDSP" block from the Target Support Package TC2.:
Figure 10: The "F2808 eZDSP" block - Add the "Hardware Interrupt" block from the C2808 DSP Chip Support group of the Target Support Package TC2. :The Interrupt should be generated at the end of conversion of group A, (CPU Values=1 and PIE Values=1) as shown in Figure 12.
Figure 11: The "Hardware Interrupt" Block Figure 12: The "Hardware Interrupt" Selection Table - Double-click the Hardware Interrupt block and configure it as follows::
Figure 13: The Hardware Interrupt Configuration - Add the "Function-Call Subsystem" block from the Ports and Subsystems group of the Simulink blockset.:
Figure 14: The "Function-Call Subsystem" Block - Connect the blocks as shown in Figure 15. Save the model as "eZDSPF2808ClassD".: 1
Figure 15: The Class-D Amplifier Model
PCM to PWM Conversion
- Double-click the Function-Call Subsystem block and delete the "In1" and Out1 blocks.:
Figure 16 - Add the "ADC" block from the C2808 DSP Chip Support group of the Target Support Package TC2.:The block should be configured to use channel 0 of module A, triggered by ePWMxA, and post an interrupt at the end of conversion as shown:
Figure 17: The "ADC" Block Figure 18: The "ADC" Configuration (a) (b) - Add two copies of the "ePWM" block from the C2808 DSP Chip Support group of the Target Support Package TC2. Name them ePWM1 and ePWM2.:The blocks should be configured as shown in the following figures:
Figure 19: The "ePWM" block Figure 20: The "ePWM1" block Configuration (a) (b) (c) Figure 21: The "ePWM2" block Configuration (a) (b) (c) - Add the "Shift Arithmetic" block from the Logic and Bit Operations group of the Simulink blockset, and configure it for shift 2 bits right. :
Figure 22: The "Shift Arithmetic" Block Figure 23: The "Shift Arithmetic" Block Configuration - Connect the blocks as shown in Figure 22.:
Figure 24: The Class D Amplifier Model
Running the model:
- Connect the system as shown in the following figures::
Figure 25: The System Figure 26: Voltage Supply - Build and run the model "CTRL-B".
- The amplifier should start working, connect your audio source, and enjoy the music.
Things to Try
This example's objective was to show the use of the F2808 blocks, it is certainly not the best implementation, but it serves as the basis for additional features and enhancements like:
- Use Oversampling
- Use the High-Resolution PWM
- Add Signal Processing (Filtering, Equalization, Gain Control) features to the amplifier
References
- "eZdspTM F2808 Technical Reference", Spectrum Digital, 2005 http://c2000.spectrumdigital.com/ezf2808/docs/2808_ezdspusb_techref_c.pdf
- David M. Alter, " Using PWM Output as a Digital-to-Analog Converter on a TMS320F280x", TI Application Report SPRAA88 , September 2008 http://www.ti.com/litv/pdf/spraa88a
0 comments:
Post a Comment