Application Report SLAA541 – June 2012 PCM512x ROM Code Patrick Galvin ........................................................................................................... Audio Converters ABSTRACT This application note describes the operation of the PCM512x fixed function stereo DAC using PurePath Studio’s Graphical Development Environment (GDE). Set up and configuration of the associated PCM51xxEVM-U is also covered in this application note. The PCM512x provides for embedded signal processing features incorporating multiple programmable biquad filters, mixers, muxes, and a 3-band DRC, as well as zero-crossing volume control for optimizing audio quality for either 2.0 or 2.1 functionality. Audio input is supported via a digital audio interface (that is, I2S) while a high performance DAC implemented with an 8x oversampled digital FIR filter outputs analog signals via the 2.1 Vrms groundcentered outputs. This allows designers to eliminate DC blocking capacitors on the output, as well as external muting circuits traditionally associated with single supply line drivers. On optional subwoofer channel is provided on a digital audio interface. 1 2 3 4 5 6 Contents Introduction .................................................................................................................. 2 PCM512x ROM Overview ................................................................................................. 2 Getting Started .............................................................................................................. 2 3.1 Input Options ....................................................................................................... 3 3.2 Connecting to the EVM ............................................................................................ 4 3.3 Firmware Startup ................................................................................................... 7 Firmware Controls .......................................................................................................... 7 4.1 Input filter bank (Biquad_1 and Biquad_2) ..................................................................... 8 4.2 DRC filter Banks (Biquad_3, Biquad_4, Biquad_5, Biquad_6, Biquad_7 Biquad_8) ..................... 9 4.3 Multi-Band Dynamic Range Compressor (DRC_MB) ......................................................... 9 4.4 Stereo_Mux ....................................................................................................... 12 4.5 Stereo_Mixer ...................................................................................................... 13 4.6 Mono_Mixer ....................................................................................................... 14 4.7 Zero Crossing Volume control .................................................................................. 15 PurePath Studio Additional Features ................................................................................... 15 5.1 PPS Environment ................................................................................................. 15 References ................................................................................................................. 18 List of Figures 1 PurePath Studio Graphical Development Environment (GDE) ....................................................... 3 2 PCM51xxEVM-U Audio Input Options 3 4 5 6 7 8 9 10 11 12 ................................................................................... PCM512x ROM Process Flow ............................................................................................ PCM512x EVM .............................................................................................................. PCM512xEVM-U Configuration Overview ............................................................................... Connecting to the EVM..................................................................................................... Loading Executable ......................................................................................................... Biquad_1 and Biquad_2 control ........................................................................................... Biquad GUI .................................................................................................................. Frequency and Phase Response ......................................................................................... DRC GUI.................................................................................................................... Component Help File ..................................................................................................... SLAA541 – June 2012 Submit Documentation Feedback PCM512x ROM Code Copyright © 2012, Texas Instruments Incorporated 3 4 5 5 6 7 8 8 9 10 11 1 Introduction 13 Mux Select.................................................................................................................. 12 14 Stereo Mix Gain Control .................................................................................................. 13 15 Mono Mixer Channel Gain Control ...................................................................................... 14 16 Volume Control ............................................................................................................ 15 17 PurePath Studio Features ................................................................................................ 16 18 PurePath Studio Sample Rate Control ................................................................................. 16 19 PurePath Studio Tools Help File 17 20 PurePath Studio Configuration File Option 18 21 1 www.ti.com ........................................................................................ ............................................................................ I2C Command Window .................................................................................................... 18 Introduction The PCM512x DAC is a member of Texas Instrument’s widely adopted family of audio codecs that incorporates both analog and digital technologies for a highly integrated single-chip audio system. This application note describes the features, control capabilities, and operating procedures for the PCM512x fixed function stereo DAC development system including PurePath Studio’s Graphical Development Environment (GDE). Set up and configuration of the associated PCM51xxEVM-U is also covered in this application note. The PCM512x provides for imbedded signal processing features incorporating multiple programmable biquad filters, mixers, muxes and a 3 band DRC as well as zero crossing volume control for optimizing audio quality for either 2.0 or 2.1 functionality. These processing features are defined as individual components implemented in a PurePath Studio processing flow supported by various control properties and GUIs. Audio input is supported via a digital audio interface (that is, I2S) while a high performance DAC implemented with an 8x oversampled digital FIR filter outputs analog signals via the 2.1 Vrms ground centered outputs. This allows designers to eliminate DC blocking capacitors on the output, as well as external muting circuits traditionally associated with single supply line drivers. On optional subwoofer channel is output on a digital audio interface. 2 PCM512x ROM Overview The PCM512x is a monolithic CMOS integrated circuit that includes a stereo digital-to-analog converter and additional support circuitry in a small TSSOP package. The PCM512x uses the latest generation of TI’s advanced segment DAC architecture to achieve excellent dynamic performance and improved tolerance to clock jitter. The PCM512x incorporates a set of fixed function processing blocks referred to as components implementing features such as biquad filters (that is, EQ), 3-band dynamic range compression, zero crossing volume control and a separately controlled subwoofer channel. Each of these components is described in this application note. Other features not associated with the programming and control of the processing components are not covered by this application note. 3 Getting Started PurePath Studio is opened by double clicking the PurePath Studio GDE icon: The GDE window opens in Edit Mode with the Properties window shown on the right and the Processing Flow environment empty. To open the PCM512x ROM process flow chose the “Open ROM” option from the file menu. 2 PCM512x ROM Code SLAA541 – June 2012 Submit Documentation Feedback Copyright © 2012, Texas Instruments Incorporated Getting Started www.ti.com Properties Window Process Flow Drawing Area Figure 1. PurePath Studio Graphical Development Environment (GDE) 3.1 Input Options There are three audio input options including input via the EVM’s SPDIF-Coax connector, SPDIF-Optical connector or the USB connector. A window is displayed following when choosing the “Open ROM” option. Figure 2. PCM51xxEVM-U Audio Input Options SLAA541 – June 2012 Submit Documentation Feedback PCM512x ROM Code Copyright © 2012, Texas Instruments Incorporated 3 Getting Started www.ti.com After choosing the input option, click “Open”. The PCM512x ROM process flow appears in the Process Flow environment as shown below with instructions on how to configure your EVM for the chosen input option. Figure 3. PCM512x ROM Process Flow 3.2 Connecting to the EVM Connect your computer to the PCM51xxEVM-U via the USB connector. This allows PurePath Studio to load the program and communicate directly with the PCM512x. This connection also streams audio from your laptop to the EVM if you have chosen the USB input option. Configure the jumpers and switch settings as described by the instructions provided in the process flow. These instructions are duplicated below. These settings configure the EVM for the appropriate clocking configuration and audio routing. Note that the jumper and switch settings are the same for SPDIF-Coax and SPDIF-Optical. 4 PCM512x ROM Code SLAA541 – June 2012 Submit Documentation Feedback Copyright © 2012, Texas Instruments Incorporated Getting Started www.ti.com (1) The silkscreen label shown on the board may be different to indicate a specific device. Otherwise, the EVM is identical to the one shown here. Figure 4. PCM512x EVM SPDIF Input: SW3 is set up with A and C to the right while B is to the left. ______ A-| - | Right (High) B-|| Left (Low) C-| - | Right (High) D - |______| Don’t Care W1 Shunt pins 2/3 W2 Shunt pins 2/3 W3 Shunt all pins except 6.7, and 14. W4 Shunt pins 1/2 W5 Shunt pins 2/3 USB Input: SW3 is set up with A, B, and C to the left. ______ A-|| Left (Low) B-|| Left (Low) C-|| Left (Low) D - |______| Don’t Care W1 Shunt pins 2/3 W2 Shunt pins 2/3 W3 Shunt all pins except 6.7, and 14. W4 Shunt pins 1/2 W5 Shunt pins 1/2 Figure 5. PCM512xEVM-U Configuration Overview SLAA541 – June 2012 Submit Documentation Feedback PCM512x ROM Code Copyright © 2012, Texas Instruments Incorporated 5 Getting Started www.ti.com Connect your output device to the analog RCA connectors (OUTL/OUTR) and your input source to the appropriate connector (SPDIF-Coax (J5), SPDIF-Optical (J4), USB – (J3)). Note that after loading the executable in the next step audio is streamed through the EVM. Set the output amplifier to low, reasonable level before loading the executable. To load the PCM512x executable to the EVM chose the “Connect” option from the Build menu. Figure 6. Connecting to the EVM 6 PCM512x ROM Code SLAA541 – June 2012 Submit Documentation Feedback Copyright © 2012, Texas Instruments Incorporated Firmware Controls www.ti.com 3.3 Firmware Startup PurePath Studio automatically loads the executable and configures the board to input audio from the chosen port. The EVM is now configured to pass audio. The process flow environment is shaded blue when the executable has been completely loaded. Figure 7. Loading Executable 4 Firmware Controls The PCM512x ROM process flow represents the digital audio input port through the I2S_In_1 component and filtered via Biquad_1 and Biquad_2 prior to being split into and being input to the 3-band crossover filters (Biquad_3 through Biquad_8). The signal is processed by a 3-band dynamic range compressor (DRC_MB_1). The subwoofer output can be mixed into the stereo output by the Stereo_Mux_1 component or output separately by the Mono_Mux_1 component. A zero crossing volume control manages the output level which is presented to the DAC following interpolation (Interpolation_1). The optional subwoofer output is presented at the digital audio interface from the D_I2S_Out_1 component. Each of these components is described in the following sections. SLAA541 – June 2012 Submit Documentation Feedback PCM512x ROM Code Copyright © 2012, Texas Instruments Incorporated 7 Firmware Controls 4.1 www.ti.com Input filter bank (Biquad_1 and Biquad_2) The input Biquad GUI can be opened by double clicking on the Biquad_1 icon in the process flow environment. Biquad_2 is aliased to Biquad_1 so it always reflects the same values. Only the values in Biquad_1 need to be adjusted as Biquad_2 automatically adjusts to match. Figure 8. Biquad_1 and Biquad_2 control The Biquad GUI opens displaying various controls as shown below. Several filter parameters are available. Biquads 1 and 2 contain an optimized implementation of 6 IIR filters (Direct Form 1, 2nd order) connected in series. Click on the Frequency Response Graph tab or Phase Response tab and see the corresponding responses displayed. When the filter information is entered the coefficients can be loaded to the PCM512x by clicking on “Apply”. Click “OK” to exit the biquad GUI. Figure 9. Biquad GUI 8 PCM512x ROM Code SLAA541 – June 2012 Submit Documentation Feedback Copyright © 2012, Texas Instruments Incorporated Firmware Controls www.ti.com Figure 10. Frequency and Phase Response 4.2 DRC filter Banks (Biquad_3, Biquad_4, Biquad_5, Biquad_6, Biquad_7 Biquad_8) The input signal is split into three bands via the biquad filters 3 through 8. Biquad 3 and 4 are aliased, biquads 5 and 6 are aliased and biquads 7 and 8 are aliased. Only Biquads 3, 5 and 7 need to be edited. The treble frequencies are filtered via biquads 3 and 4 with a default high pass filter at 8000 Hz. The mid frequencies are filtered via biquads 5 and 6 with band pass filter 250 Hz and 8000 Hz while the low frequencies are low pass filtered at 250 Hz. Each of these filter cut off frequencies a can be adjusted with their respective Biquad GUIs. Each of these respective signals are input to the multiband dynamic range compressor. 4.3 Multi-Band Dynamic Range Compressor (DRC_MB) The 3-band multiband DRC applies DRC to 3 different stereo signals with 3 different time constants. The same DRC curve is applied on all the signals. The DRC is comprised of three main elements: Average Absolute Estimator (AAV) – This DRC element derives an estimate of the average absolute value (AAV) of the audio data stream into the DRC. The DRC can receive input from either one channel (mono) or two channels (stereo). For a stereo DRC, the individual channel estimates are computed and the output of the estimator is compared and the larger value is forwarded to the compression/expansion coefficient computation engine. A time constant, tenergy, is used to control the effective time window over which the AAV estimate is made. From this value, two programmable parameters, ae and (1 – ae), are derived as input to the DRC. The two programmable parameters, ae and (1-ae). apply to both the channels for a stereo DRC. For a given sampling rate (Fs) the time window over which the AAV estimation is defined by: 1 t energy = (sec onds) Fsln (1 - ae ) (1) For energy averaging, two methods can be used which controlled by the EnergyAveragingMethod parameter – Alpha Filter, Peak Detector. Compression/Expansion Coefficient Computation – This DRC element converts the output of the AAV estimator to a logarithmic number, determines the region where the input resides, and then computes and outputs the appropriate gain coefficient to the attack/decay element. Attack/decay control – This DRC element controls the transition time of changes in the gain coefficient computed in the compression/expansion coefficient computation element. User specified parameters tattack and tdecay are used to set the attack and decay time constants used in the gain adjustment. From these, four parameters are computed as input to the DRC to define the operation of the attack/decay behavior of the DRC gain. SLAA541 – June 2012 Submit Documentation Feedback PCM512x ROM Code Copyright © 2012, Texas Instruments Incorporated 9 Firmware Controls www.ti.com Each of these features is controlled by the DRC GUI shown below. After editing the DRC parameters click Apply to load the updated coefficients to the EVM. Click OK to close the DRC GUI. Additional control information is provided in the extensive help file displayed by right clicking on the DRC_MB_1 icon and choosing “Help”. Figure 11. DRC GUI 10 PCM512x ROM Code SLAA541 – June 2012 Submit Documentation Feedback Copyright © 2012, Texas Instruments Incorporated Firmware Controls www.ti.com Figure 12. Component Help File SLAA541 – June 2012 Submit Documentation Feedback PCM512x ROM Code Copyright © 2012, Texas Instruments Incorporated 11 Firmware Controls 4.4 www.ti.com Stereo_Mux The stereo mux is in the subwoofer processing chain and acts as a switch to direct the subwoofer signal to the main stereo output. It may be desirable to mix in the subwoofer channel when a full bandwidth 2.0 audio system is implemented. The mux setting is controlled as a runtime property in the Properties window. The mux setting can only be edited after connecting to the EVM. Setting the mux to 0x1 disconnects the subwoofer channel from the main channel. In this scenario, the main stereo output only mixes the mid and treble signals. The subwoofer signal is directed to the main stereo output when set to 0x2. Figure 13. Mux Select 12 PCM512x ROM Code SLAA541 – June 2012 Submit Documentation Feedback Copyright © 2012, Texas Instruments Incorporated Firmware Controls www.ti.com 4.5 Stereo_Mixer The Stereo mixer sums the three inputs from the treble, mid and subwoofer channels. These signals are each summed at a default level of 0.6. The mix level is controlled as a runtime property in the Properties window. The mix level can only be edited after connecting to the EVM. Figure 14. Stereo Mix Gain Control SLAA541 – June 2012 Submit Documentation Feedback PCM512x ROM Code Copyright © 2012, Texas Instruments Incorporated 13 Firmware Controls 4.6 www.ti.com Mono_Mixer The stereo subwoofer channels are summed together in the Mono_Mixer component for output as a mono subwoofer channel. The default mix level for each channel is 0.5. The mono mix levels are controlled as a runtime property in the Properties window. The mono mix can only be edited after connecting to the EVM. Figure 15. Mono Mixer Channel Gain Control 14 PCM512x ROM Code SLAA541 – June 2012 Submit Documentation Feedback Copyright © 2012, Texas Instruments Incorporated PurePath Studio Additional Features www.ti.com 4.7 Zero Crossing Volume control The volume control for each of the main stereo output channels as well as the separate subwoofer channel (when enabled) is controlled by the zero crossing volume control component. Control is managed by a slider with a default setting of -6 dB. The volume control can only be edited after connecting to the EVM. The volume control can optionally be managed by the Volume property in the Runtime Properties window shown in Figure 16 Figure 16. Volume Control 5 PurePath Studio Additional Features 5.1 PPS Environment The development environment for the noise reduction implementation is based on the PurePath Studio (PPS) tool set which incorporates a drag and drop style Graphical Development Environment (GDE) for simple development of process flows (that is, systems) based on standard and custom components as described in the following sections. PurePath Studio incorporates a Graphical Development Environment (GDE) as shown in the Figure 17. This environment is used to display software. SLAA541 – June 2012 Submit Documentation Feedback PCM512x ROM Code Copyright © 2012, Texas Instruments Incorporated 15 PurePath Studio Additional Features www.ti.com Drag/drop components Properties Window Process Flow Drawing Area Palette of Components Figure 17. PurePath Studio Features The environment defines various system parameters such as the sample rate. These can be viewed in the configuration window by clicking on the Process Flow Drawing area. Figure 18. PurePath Studio Sample Rate Control PurePath Studio help files can be accessed by the help menu. 16 PCM512x ROM Code SLAA541 – June 2012 Submit Documentation Feedback Copyright © 2012, Texas Instruments Incorporated PurePath Studio Additional Features www.ti.com Figure 19. PurePath Studio Tools Help File 5.1.1 PPS Components By right clicking on a component the user can access either a help file describing the operation of the component or view available run time properties and/or design properties which are displayed on the right side of the drawing area. Run time properties can be changed while the processor is running, but design properties can only be changed before building the process flow. To change the value of properties, right click on the component and choose Properties option. The component properties are displayed on the right of the drawing area, and those properties that can be changed are displayed in bold type. 5.1.2 Loading Scripts Once the code has been loaded and is running, changes to the code, coefficients or registers may be made dynamically using scripts. Scripts may be loaded by pulling down the “Tools” menu and choosing the “I2C Command” File option as shown in Figure 6. Scripts are text files formatted to be read by the processor. Script files may be edited using any text editor. SLAA541 – June 2012 Submit Documentation Feedback PCM512x ROM Code Copyright © 2012, Texas Instruments Incorporated 17 References www.ti.com Figure 20. PurePath Studio Configuration File Option The following window opens and the user can browse to locate the desired script file and click on “Execute now”. This loads the script to the target processor. Figure 21. I2C Command Window 6 References 1. PCM512x Preliminary Technical Data Sheet, April 2011. 2. EVM User’s Guide, PCM510xEVM-U, SBAU190A-May 2011 – Revised June 2011. 18 PCM512x ROM Code SLAA541 – June 2012 Submit Documentation Feedback Copyright © 2012, Texas Instruments Incorporated IMPORTANT NOTICE Texas Instruments Incorporated and its subsidiaries (TI) reserve the right to make corrections, enhancements, improvements and other changes to its semiconductor products and services per JESD46, latest issue, and to discontinue any product or service per JESD48, latest issue. Buyers should obtain the latest relevant information before placing orders and should verify that such information is current and complete. All semiconductor products (also referred to herein as “components”) are sold subject to TI’s terms and conditions of sale supplied at the time of order acknowledgment. TI warrants performance of its components to the specifications applicable at the time of sale, in accordance with the warranty in TI’s terms and conditions of sale of semiconductor products. Testing and other quality control techniques are used to the extent TI deems necessary to support this warranty. Except where mandated by applicable law, testing of all parameters of each component is not necessarily performed. TI assumes no liability for applications assistance or the design of Buyers’ products. Buyers are responsible for their products and applications using TI components. To minimize the risks associated with Buyers’ products and applications, Buyers should provide adequate design and operating safeguards. TI does not warrant or represent that any license, either express or implied, is granted under any patent right, copyright, mask work right, or other intellectual property right relating to any combination, machine, or process in which TI components or services are used. Information published by TI regarding third-party products or services does not constitute a license to use such products or services or a warranty or endorsement thereof. Use of such information may require a license from a third party under the patents or other intellectual property of the third party, or a license from TI under the patents or other intellectual property of TI. Reproduction of significant portions of TI information in TI data books or data sheets is permissible only if reproduction is without alteration and is accompanied by all associated warranties, conditions, limitations, and notices. TI is not responsible or liable for such altered documentation. Information of third parties may be subject to additional restrictions. Resale of TI components or services with statements different from or beyond the parameters stated by TI for that component or service voids all express and any implied warranties for the associated TI component or service and is an unfair and deceptive business practice. TI is not responsible or liable for any such statements. Buyer acknowledges and agrees that it is solely responsible for compliance with all legal, regulatory and safety-related requirements concerning its products, and any use of TI components in its applications, notwithstanding any applications-related information or support that may be provided by TI. Buyer represents and agrees that it has all the necessary expertise to create and implement safeguards which anticipate dangerous consequences of failures, monitor failures and their consequences, lessen the likelihood of failures that might cause harm and take appropriate remedial actions. Buyer will fully indemnify TI and its representatives against any damages arising out of the use of any TI components in safety-critical applications. In some cases, TI components may be promoted specifically to facilitate safety-related applications. With such components, TI’s goal is to help enable customers to design and create their own end-product solutions that meet applicable functional safety standards and requirements. Nonetheless, such components are subject to these terms. No TI components are authorized for use in FDA Class III (or similar life-critical medical equipment) unless authorized officers of the parties have executed a special agreement specifically governing such use. Only those TI components which TI has specifically designated as military grade or “enhanced plastic” are designed and intended for use in military/aerospace applications or environments. Buyer acknowledges and agrees that any military or aerospace use of TI components which have not been so designated is solely at the Buyer's risk, and that Buyer is solely responsible for compliance with all legal and regulatory requirements in connection with such use. TI has specifically designated certain components which meet ISO/TS16949 requirements, mainly for automotive use. Components which have not been so designated are neither designed nor intended for automotive use; and TI will not be responsible for any failure of such components to meet such requirements. Products Applications Audio www.ti.com/audio Automotive and Transportation www.ti.com/automotive Amplifiers amplifier.ti.com Communications and Telecom www.ti.com/communications Data Converters dataconverter.ti.com Computers and Peripherals www.ti.com/computers DLP® Products www.dlp.com Consumer Electronics www.ti.com/consumer-apps DSP dsp.ti.com Energy and Lighting www.ti.com/energy Clocks and Timers www.ti.com/clocks Industrial www.ti.com/industrial Interface interface.ti.com Medical www.ti.com/medical Logic logic.ti.com Security www.ti.com/security Power Mgmt power.ti.com Space, Avionics and Defense www.ti.com/space-avionics-defense Microcontrollers microcontroller.ti.com Video and Imaging www.ti.com/video RFID www.ti-rfid.com OMAP Applications Processors www.ti.com/omap TI E2E Community e2e.ti.com Wireless Connectivity www.ti.com/wirelessconnectivity Mailing Address: Texas Instruments, Post Office Box 655303, Dallas, Texas 75265 Copyright © 2012, Texas Instruments Incorporated