DSP, Micros & Memory


DSP applications: blurring the line between simulation and implementation

16 July 2003 DSP, Micros & Memory Access Control & Identity Management

You are a DSP engineer tasked with designing and implementing a 15-band digital audio equaliser on a Texas Instruments DSP. You use MATLAB to start the design process. From there, you can design your filters, test their frequency responses against performance requirements, and then simulate the entire equaliser system. You might assume that you must then switch from MATLAB to Code Composer Studio, TI's realtime implementation environment.

In this article, we show how MATLAB Link for Code Composer Studio Development Tools makes this switch unnecessary because it connects MATLAB with TI Code Composer Studio and all supported TI DSPs, including C2800, C5000, and C6000.

Hardware set-up

* TI TMS320C6711 DSK evaluation board.

* TI TMDX326040A stereo daughter card with ADC and a DAC operating at 48 kHz.

* PC connected to the DSK via TI XDS-560 emulator, providing data transfer between the host and the C6711 DSP at rates approaching 2 Mbps.

Equaliser specifications

* 15-bands compliant with the two-thirds octave ISO frequency specifications.

* 20-20 000 Hz range.

* ±12 dB boost/cut per sub-band.

* 12 dB/octave out-of-band rollover.

* Nominal 5% centre frequency accuracy.

Sub-band filter design

With our own requirements and those of the two-thirds octave ISO frequency specifications in mind, we assess digital filter designs using the filter design and analysis tool (FDATool) in the signal processing toolbox (see Figure 1).

Figure 1. FDA Tool
Figure 1. FDA Tool

Using the FDATool GUI, we test a number of design methods, including Hamming-windowed and Kaiser-windowed finite impulse response (FIR), and Butterworth and Chebyshev Type II infinite impulse response (IIR). After fine tuning, we save a number of filter design coefficients sets generated by the FDATool.

Hybrid simulation

Traditionally, DSP software development involves iterations of algorithm simulations followed by prototyping candidate designs on the DSP. If, however, portions of the DSP implementation could be integrated into the PC simulation, hardware constraints may be considered earlier in the design phase - leading to better decisions and fewer design candidates. Figures 2 and 3 show the execution paths of two hybrid simulations built for the equaliser application. The red switches indicate that any component of the design may be run either in MATLAB or on the DSP.

Figure 2. Frame-based, realtime simulation
Figure 2. Frame-based, realtime simulation

Figure 3. Entire data set, non-realtime simulation
Figure 3. Entire data set, non-realtime simulation

We create a project for Code Composer Studio by writing DSP code that transfers data to and from the host using realtime data exchange (RTDX), TI's realtime communications protocol. Then, by calling RTDX read-and-write functions of MATLAB Link for Code Composer Studio, we execute equaliser algorithms in MATLAB in frame-based, realtime streaming mode (Figure 2). We assess the fourth-order IIR designs in this fashion:

The computational burden of the 100-plus taps of the FIR equaliser designs could not meet the realtime requirements of the streaming mode on our PC. We needed to define another simulation scheme, depicted by Figure 3. In this batch mode, ADC frame data sent by the DSP is concatenated and saved as a WAV file. The entire recorded data set is then read and processed by the equaliser simulation in non-realtime. But when the output of the equaliser is played through the speakers, it sounds as if it were being streamed in realtime.

After evaluation, one FIR and two IIR designs meet our specifications. Of the three, the IIR designs are preferable because they correspond more closely to their traditional analog filter counterparts constructed of op amps and require fewer multiply-accumulate operations than FIRs.

Since the target is a 32-bit DSP, it is natural to implement the equaliser in single precision for best possible floating-point performance. However, Chebyshev and Butterworth IIR designs became unstable with the application of single-precision coefficients. We return to the FDATool and redesign each IIR as cascaded second-order sections (SOS), which are less susceptible to quantisation effects. Subsequent analysis with the filter design toolbox reveals that the SOS filters are stable.

Implementation and verification

Once we have written and inserted equaliser code into the project for Code Composer Studio created earlier, we can apply MATLAB Link for Code Composer Studio to automate testing and verification.

We write a MATLAB script to invoke the DSP function call capability of MATLAB Link for Code Composer Studio to test the IIR filters. From there, we follow these steps:

1. Select a known signal.

2. Process the signal using IIR functions from the signal processing toolbox, and simultaneously run the signal through IIR filters on the DSP.

3. Compare the results.

If the IIR filters are implemented correctly on the DSP, the difference in results is merely the effect of quantisation, as shown in Figure 4. Since MATLAB Link for Code Composer Studio provides DSP memory-write operations, we can change IIR filter coefficients without recompiling. We test both IIR implementations in a consistent, automated way with a single MATLAB script by simply exchanging coefficient sets.

Figure 4. Simulation vs DSP implementation plots
Figure 4. Simulation vs DSP implementation plots

After isolated filter testing, we verify the entire equaliser design by stringing DSP function calls and comparing them with the simulation results. Finally, we insert RTDX instrumentation code, which runs on the DSP, to send intermediate results to MATLAB, where they are displayed while the DSP is running. Figure 5 shows the equaliser.

Figure 5. Graphic equaliser user interface with options for MATLAB-only simulation, MATLAB and DSP hybrid simulation, and DSP-only implementation
Figure 5. Graphic equaliser user interface with options for MATLAB-only simulation, MATLAB and DSP hybrid simulation, and DSP-only implementation

In this example, we have shown that when design tools are integrated with DSP implementation tools, we can select the best design before prototyping, thus minimising the implementation of designs whose performance is compromised by embedded hardware limitations.

For more information on The MathWorks, contact the representative, Opti-Num Solutions, 011 325 6238, or for distributors of Texas Instruments: Arrow Altech Distribution (AAD), 011 923 9600, Avnet Kopp, 011 809 6100, or EBV-Electrolink, 021 421 5350.



Credit(s)



Share this article:
Share via emailShare via LinkedInPrint this page

Further reading:

Is your entrance security secure?
SMART Security Solutions Centurion Systems Technews Publishing News & Events Access Control & Identity Management Smart Home Automation
While Centurion Systems may be known as a leader in gate and door motors in 72 countries, the company has developed more than hardware and now offers an automation ecosystem for access control security.

Read more...
Converter power modules for 48 V networks
Altron Arrow Power Electronics / Power Management
The economic and quality-of-life benefits of electrification is driving the adoption of HV to 48 V DC-DC conversion across many markets with 48 V power modules becoming more common.

Read more...
How a vision AI platform and the STM32N6 can turn around an 80% failure rate for AI projects
Altron Arrow AI & ML
he vision AI platform, PerCV.ai, could be the secret weapon that enables a company to deploy an AI application when so many others fail.

Read more...
Memory for asset tracking
Altron Arrow DSP, Micros & Memory
The Page EEPROM, ST’s latest memory, has been designed for efficient datalogging and fast firmware upload/download in battery-operated devices.

Read more...
Engineered for high-reliability applications
Future Electronics DSP, Micros & Memory
The MCX E series of Arm Cortex-M4F and Arm Cortex-M7 microcontrollers from NXP are engineered for demanding industrial and IoT environments.

Read more...
NXP’s development platform guide
DSP, Micros & Memory
Choosing between the FRDM i.MX 93, FRDM i.MX 91 and FRDM i.MX 91S development platforms can be intimidating, but once designers understand how each platform aligns with their application’s requirements, the decision becomes straightforward.

Read more...
Continuum launches centralised access and identity management
News & Events Access Control & Identity Management Facilities & Building Management
Continuum Identity is a newly launched company in the identity management and access control sector, targeting the complexity of managing various Access and Identity Management (AIM) systems.

Read more...
Microchip and AVIVA Links collaboration
Altron Arrow News
Microchip and AVIVA Links have achieved groundbreaking ASA-ML interoperability, accelerating the shift to open standards for automotive connectivity.

Read more...
XJTAG launches two new Flash programmers
ASIC Design Services DSP, Micros & Memory
XJTAG has announced XJExpress and XJExpress-FPGA, a pair of Flash programmers perfect for development, debug and in-service applications.

Read more...
Expanded STM32WL3x line for IoT sensors
Altron Arrow Telecoms, Datacoms, Wireless, IoT
The STM32WL31x and STM32WL30x are more tailored versions of the STM32WL33x for designers who wish to focus on specific features, while lowering their bill of materials.

Read more...









While every effort has been made to ensure the accuracy of the information contained herein, the publisher and its agents cannot be held responsible for any errors contained, or any loss incurred as a result. Articles published do not necessarily reflect the views of the publishers. The editor reserves the right to alter or cut copy. Articles submitted are deemed to have been cleared for publication. Advertisements and company contact details are published as provided by the advertiser. Technews Publishing (Pty) Ltd cannot be held responsible for the accuracy or veracity of supplied material.




© Technews Publishing (Pty) Ltd | All Rights Reserved