Embedded Target for Texas Instruments C6000 DSPs    

Configuring ADC Blocks

To drive and test your DSP application on a C6701 EVM or C6711 DSK, you use signals from external sources, such as signal generators, audio equipment, or microphones. In some cases, you may generate your input data in code using Simulink blocks in your model or from a source block, such as a signal generator; configuring the ADC block remains the same.

The ADC and DAC blocks provide physical pathways from and to external sources and displays. They behave like source and sink blocks. They differ from sources and sinks in that they exchange data with external devices through analog input and output connectors, not the MATLAB workspace, and they work only for the C6000 boards.

You add ADC blocks to a model in the same way that you add other DSP Blockset blocks, or Simulink blocks. You can add at most one ADC block to a model. When you add C6000 blocks to your Simulink model, you set parameters that determine how each block handles data.

Adding the ADC block to your Simulink model enables the codec on the target to accept input from your external source. By connecting your source to the LINE IN connector on the board mounting bracket, you introduce signals to the board. Your ADC block defines the signal format the codec uses to sample, digitize, and send signals to the digital signal processor. When you build your Simulink model, the build process includes the software to implement the ADC-defined codec operation into the code downloaded to the board.

Configuring an ADC block includes setting as many as nine parameters on the Block Parameters dialog.

Choosing and setting these parameters are covered in the following sections. To help you select the settings, this section provides some guidelines for common DSP uses and applications for each parameter. While the examples are not exhaustive, the suggestions may help you select settings that work well for your application.

Most of the configuration options for the block affect the codec. However, the Output data type, Samples per frame, and Scaling options relate to the model you are using in Simulink, the signal processor on the board, or direct memory access (DMA) on the board. In the following table, you find each option listed with the target board hardware affected.

Option
Affected Hardware
ADC Source
Codec
Codec data format (C6701 EVM ADC only)
Codec
Mic
Codec
Output data type
TMS320C6xxx digital signal processor
Sample rate (Hz) (C6701 EVM ADC only)
Codec
Samples per frame
Direct memory access functions
Scaling
TMS320C6xxx digital signal processor
Source gain (dB)
Codec
Stereo (C6701 EVM ADC only)
Codec

Selecting the ADC Source

When you set up your target to accept input for your model, you tell the hardware where the input to the codec comes from. Selecting Line in and Mic in on the C6701 EVM corresponds to the two different input connectors on the board, with different input signal levels expected. On the DSK, the Line in and Mic in options use the same connector, but generate different signal levels to the codec. Both boards include the Loopback option that feeds the output from the DAC back to the ADC input.

Choosing the Sample Rate (C6701 EVM ADC Block Only)

To open the Block Parameters dialog, right-click the C6701 EVM ADC block in your Simulink model and select Block Parameters from the context menu. You see the dialog presented in Figure 2-2, Block Parameters for C6701 EVM ADC Dialog.

Figure 2-2: Block Parameters for C6701 EVM ADC Dialog

Select your sample rate from the list. 5521 Hz is the lowest rate and 48000 Hz is the highest. You cannot set a sample rate that is not on the list. The available rates are derived from the clocks on the codec and cannot be changed.

The C6711 DSK uses a fixed sample rate of 8 KHz.

For many applications, your sample rate should reflect the standards for the industry. For example, if you are developing a professional audio application, working with digital audio tape (DAT) processes, or developing applications for high fidelity audio use, consider using 48000 Hz sampling rate in your model. In addition, choose double-precision, fixed-point arithmetic format when you select the Codec data format.

For applications used by CD players and sound cards in personal computers, the standard sampling rate is 44.1 KHz, and some of the lower rates such as 22.05 or 16 KHz. Moving Picture Expert Group (MPEG) audio applications often select a 32 KHz sampling rate.

When you are developing an application for speech, telephony, or "toll quality" speech processing, the 8 KHz sampling rate, paired with one of the 8-bit data formats that use a compressed format such as A-law, best matches current standards.

Choosing the Codec Data Format (C6701 EVM ADC Only)

When the codec performs A/D conversion, the output data format is partly determined by the setting for Codec data format in the Block Parameters dialog. Codec data format offers five choices:

You will probably use 16-bit linear codec data format when you begin developing your model. If you do not care about, or do not expect, negative data values, as would be the case where you are measuring a voltage that varies from 0 volts to 5 volts, you could use 8-bit unsigned math. If appropriate for your application, choose one of the compression data formats for your model.

Selecting the Data Type

You must select the data type when you include the ADC block in your DSP simulation. The data type you use in the simulation is likely not to be the one you use when you build and download the application to the target. Your choice of data type depends on a number of factors related to how the application runs on the target DSP and what limitations apply. Four factors can influence your choice:

When you have developed and tested your signal processing application in Simulink, you are ready to use the Real-Time Workshop and your Embedded Target for TI C6000 DSP to build and download your model to the C6701 EVM or C6711 DSK. Your Simulink model should represent a general purpose implementation of your application, without specific features that depend on the target DSP. For instance, use floating-point arithmetic and single- or double-precision format to develop your simulation. Select DSP target-specific data and format requirements when you prepare your model for the board.

To ease model development on the target, start by selecting floating-point data format when you build and download your application to the board. You could choose either single-precision or double-precision at this time to ensure that your model runs on the target processor. Often, normalized floating-point arithmetic is the best choice during development. As you tune your model for the processor, consider whether such features as calculation time and memory use are important in your application environment. If time is a critical parameter, use either less precise math, such as single-precision instead of double, or switch from floating-point to fixed-point or integer. These changes both speed up your process and reduce the memory and power the processor consumes to complete its calculations.

For accuracy without regards to time, use floating-point arithmetic.

Selecting the Scaling

Both the single-precision and double-precision data types are available as floating point or normalized values. During development, it is a good idea to start with normalized values to relieve you from worrying about overflows and underflows in the calculations performed in the algorithm. When you are happy that the process is under control, change the data type to the one you need for the deployed executable code.

Selecting a floating-point data type can reduce your algorithm processing overhead slightly.


  Using the C6000lib Blockset Configuring DAC Blocks