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:

Gallagher Security releases OneLink
Gallagher Animal Management Products & Solutions Access Control & Identity Management
Gallagher Security has announced OneLink, a cloud-based solution that makes it faster, easier and more cost-effective to deploy security anywhere in the world, transforming how security can be delivered to remote sites and distributed infrastructure.

Read more...
Adaptive optics’ power solution
Altron Arrow Opto-Electronics
Vicor power-dense adaptive optical modules enable colossal telescopes to look into the past for deep space discoveries.

Read more...
First NVMe SSD Built with 8th-gen BiCS FLASH
EBV Electrolink Computer/Embedded Technology
KIOXIA recently announced the development and prototype demonstration of its new KIOXIA CM9 Series PCIe 5.0 NVMe SSDs, which incorporates CMOS directly Bonded to Array technology.

Read more...
MCU for low-power, IoT applications
NuVision Electronics DSP, Micros & Memory
Silicon Labs recently announced the PG26, a general-purpose microcontroller with a dedicated matrix vector processor to enhance AI/ML hardware accelerator speeds.

Read more...
Wide input voltage buck-boost converter
Altron Arrow Power Electronics / Power Management
The MAX77859 from Analog Devices is a high-efficiency, high-performance buck-boost converter targeted for systems requiring a wide input voltage range of between 2,5 and 22 V.

Read more...
IMU with dual-sensing capability
EBV Electrolink Analogue, Mixed Signal, LSI
ST’s 6-axis inertial measurement unit integrates a dual accelerometer up to 320g and embedded AI for activity tracking and high-impact sensing.

Read more...
High-density power module for AI at the edge applications
Altron Arrow Power Electronics / Power Management
The MCPF1412 power module from Microchip has integrated I2C and PMBus interfaces for flexible configuration and monitoring.

Read more...
EEPROMs for industrial and military markets
Vepac Electronics DSP, Micros & Memory
Designed to ensure the data retention and the secure and safe boot of digital systems, the memory product line includes small and medium density EEPROMs from 16 kb to 1 Mb.

Read more...
When it comes to long-term reliability of RF amplifier ICs, focus first on die junction temperature
Altron Arrow Editor's Choice Telecoms, Datacoms, Wireless, IoT
When considering the long-term reliability of integrated circuits, a common misconception is that high package or die thermal resistance is problematic. However, high or low thermal resistance, by itself, tells an incomplete story.

Read more...
PLCnext – Open, IIoT-ready industrial platform
IOT Electronics DSP, Micros & Memory
PLCnext can be used alongside an existing PLC system, collecting control system data via EtherNet/IP, PROFINET, or MODBUS, and can push this information to a cloud instance.

Read more...