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:

Industrial-grade ESP32-S3 controller
DSP, Micros & Memory
Erqos Technologies has introduced the EQSP32CE, a CE-certified, industrial-grade ESP32-S3 controller designed for developers who want the flexibility of the ESP32 ecosystem in hardware that can be deployed directly into real-world automation.

Read more...
Next-gen smart module powers intelligence at the edge
iCorp Technologies DSP, Micros & Memory
Quectel Wireless Solutions has expanded its smart module portfolio with the SH803FD, a new-generation, high-performance smart module.

Read more...
Compact direct Time-of-Flight 3D LiDAR module
Altron Arrow Opto-Electronics Electronics Technology AI & ML
The VL53L9 from STMicroelectronics is the first direct Time-of-Flight (dToF) 3D LiDAR all-in-one module in ST’s portfolio, offering a resolution of 2,3K zones, wide field of view, on-chip processing, 100 frames per second, and sensing range from 5 centimeters to 9 meters.

Read more...
Balancing secure access control and fire safety
Editor's Choice Access Control & Identity Management Fire & Safety
In modern building management, few topics create as much tension as the intersection between security access control and fire evacuation safety. Nichola Allen of G2 Fire sheds light on this delicate balance.

Read more...
Edge AI improves condition monitoring
EBV Electrolink AI & ML
STMicroelectronics has introduced the IIS3DWB10IS, an intelligent MEMS vibration sensor designed for high-performance industrial condition monitoring applications.

Read more...
Generating negative voltages from a positive supply
Altron Arrow Editor's Choice Passive Components
It is common for IoT devices, industrial sensors, meters, and medical equipment to require both a positive and negative voltage, and this article explains the options available to produce a negative rail from a positive rail supply.

Read more...
Advanced sensing powers modern drones
Future Electronics DSP, Micros & Memory
Allegro MicroSystems has a portfolio of sensors, motor drivers, and power management devices specifically designed to enhance drone efficiency, reliability, and control.

Read more...
Addressing latency and signal integrity challenges
Altron Arrow DSP, Micros & Memory
Strengthening Microchip Technology’s data centre solutions portfolio, its XpressConnect retimers support high-bandwidth architectures, while helping reduce integration complexity.

Read more...
Precision timing in compact package
Altron Arrow Telecoms, Datacoms, Wireless, IoT
Designed for use in harsh environments, the EX-423 incorporates a four-point mounted quartz crystal structure that improves shock resistance and reduces g-sensitivity.

Read more...
EMC limits and levels
Altron Arrow Editor's Choice Circuit & System Protection
As soon as electronics and electrical systems started interfering with each other, the world had to come to some consensus. Considering physics is universal and does not care about what country electrical/electronic products are used in, it should be the same everywhere, right? It is nearly there, but not quite.

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