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:

Impro announces Primo update
News & Events Access Control & Identity Management Integrated Solutions
Impro Technologies recently held a launch event in which it introduced a series of new products, from new readers through to its updated Primo access management software.

Read more...
Cost-effective microcontroller series
Altron Arrow DSP, Micros & Memory
The STM32C5 series from STMicroelectronics delivers an excellent balance of performance, efficiency, and affordability for embedded designs that require more capability without increasing bill of materials cost.

Read more...
Understanding two key tools for cleaner serial data
Altron Arrow Editor's Choice Analogue, Mixed Signal, LSI
Understanding how pre-emphasis and equalisation works, and when to use one over the other, is critical when designing reliable high-speed systems.

Read more...
Battery-friendly Thread and BLE solution
iCorp Technologies DSP, Micros & Memory
Positioned as an incremental upgrade to the ESP32-H2, Espressif’s ESP32-H21 adds an integrated DC-DC converter that reduces active current draw and helps extend battery life in power-sensitive consumer and industrial devices.

Read more...
Connected without limits: An engineering perspective on Altron Arrow’s wireless ecosystem
Altron Arrow Editor's Choice Design Automation
Wireless connectivity is no longer a supporting technology, but rather, a core design consideration that underpins modern electronic systems across industries.

Read more...
Next-gen robotic systems initiative
EBV Electrolink Design Automation
EBV Elektronik recently introduced MOVE – Driving Robotics Forward, a new initiative designed by EBV Elektronik‘s Embedded Solutions team to support the development of next-generation robotic systems.

Read more...
Next generation HMI processing platform
Future Electronics DSP, Micros & Memory
Microchip’s latest hybrid MCU SiP integrates an Arm926EJ-S processor with 512 Mb of DDR2 SDRAM and is engineered to meet the rising demand for sophisticated HMI solutions in modern vehicles.

Read more...
Compact high-current power inductor
EBV Electrolink Passive Components
Vishay’s IHLP series power inductors deliver high current capability in an ultra-low profile, magnetically shielded design.

Read more...
Analogue reservoir AI chip capable of real-time learning
Altron Arrow AI & ML
TDK Corporation has jointly developed a prototype of a reservoir AI chip using an analogue electronic circuit that mimics the cerebellum with Hokkaido University.

Read more...
Ultra-low jitter clocks
Altron Arrow Telecoms, Datacoms, Wireless, IoT
Skyworks has introduced a new family of ultra-low jitter programmable clocks designed to meet the increasing demands of next-gen connectivity.

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