Professional Documents
Culture Documents
Wania Anoosh
Experiment 08
Equipment required:
• C6713 DSK
• Power Cable
• USB Cable
• Code Composer Studio v5.1.0
• Function Generator
• Oscilloscope
Background Knowledge:
AIC23 Codec:
The DSK uses a Texas Instruments AIC23 (part #TLV320AIC23) stereo codec for input and output of
audio signals. The codec samples analog signals on the microphone or line inputs and converts them
into digital data so it can be processed by the DSP. When the DSP is finished with the data processing,
it uses the codec to convert the samples back into analog signals on the line and headphone outputs
so the user can hear the output. The codec, located on DSK, interfaces the DSP chip to the analog
environment, such as signal generator, oscilloscope, or stereo headphones. The codec contains an
analog-to-digital converter (ADC), and a digital-to-analog converter (DAC). The ADC circuitry on the
codec converts the input analog signal to a digital representation to be processed by the DSP.
The codec communicates using two serial channels, one to control the codec’s internal configuration
registers and one to send and receive digital audio samples. McBSP0 is used as the unidirectional
control channel. It should be programmed to send a 16-bit control word to the AIC23 in SPI format.
The top 7 bits of the control word should specify the register to be modified and the lower 9 should
1|Page
Instructor Manual Designed by Engr. Wania Anoosh
contain the register value. The control channel is only used when configuring the codec, it is generally
idle when audio data is being transmitted, McBSP1 is used as the bi-directional data channel.
Many data formats are supported based on the three variables of sample width, clock signal source
and serial data format. The DSK examples generally use a 16-bit sample width with the codec in
master mode, so it generates the frame sync and bit clocks at the correct sample rate. The preferred
serial format is DSP mode which is designed specifically to operate with the McBSP ports on TI DSPs.
The codec has a 12MHz system clock. The 12MHz system clock corresponds to USB sample rate mode,
named because many USB systems use a 12MHz clock and can use the same clock for both the codec
and USB controller. The internal sample rate generate subdivides the 12MHz clock to generate
common frequencies such as 48KHz, 44.1KHz and 8KHz. The sample rate is set by the codec’s
SAMPLERATE register. The figure below shows the codec interface on the C6713 DSK.
Once the digital signal is processed, a DAC is used which performs the reverse operation of ADC. An
output filter smooths out or reconstructs the output analog signal. ADC, DAC, and all required filtering
operations are performed by the single-chip codec AIC23 on the DSK. The coder and decoder support
data word lengths of 16b, 20b, 24b, and 32b. The ADC converts an input signal into discrete output
in a 2’s complement format which corresponds to the analog signal value. The DAC includes an
interpolation filter and a digital modulator. A decimation filter reduces the digital data rate to the
sampling rate. The DAC’s output is first passed through an internal lowpass reconstruction filter to
produce an output analog signal.
Sampling:
Internally, the sampler is over-sampling at 250-384 times fs, depending on fs. This is a common
practice when using delta-sigma modulators. A delta-sigma modulator takes the current sample and
compares it with the previous sample. If the current sample is larger (or smaller) than the previous
sample, it makes the current sample the previous sample plus (or minus) some fixed amplitude δ. In
our case, we have a 1-bit delta-sigma modulator which means that the current sample (16-bit finite-
length word) will be the previous sample plus (or minus) a binary 1, assuming that the current
sample is larger (or smaller) than the previous sample. By over-sampling, a good representation of
2|Page
Instructor Manual Designed by Engr. Wania Anoosh
the original signal is captured at each sample point, since the signal, which is essentially band-limited,
will not change by more than 1 bit, or quantization level, between each sample point.
An additional advantage of over-sampling is that images of the input signal spectrum created by
sampling are shifted to very high frequencies. For example, with fs = 8KHz and an oversampling ratio
of 250, the first image occurs at 2MHz, so the anti-aliasing filter need only roll-off at 90% of 1MHz,
which is much easier to implement than a filter for a Nyquist-rate converter (sampling ratio=1),
which would require a 4KHz roll-off. Only every 250th to 384th sample point is needed to accurately
represent the bandlimited signal, so a decimation filter (LPF running at 8KHz) is used to decrease the
word rate to the desired rate of 8KHz. These 16-bit finite-length words are then transmitted to the
CPU via serial port 0 on the DSP chip. The CPU will treat these 16-bit finite length words as 16-bit
signed integers (-32768 to +32767).
Reconstruction:
The discrete-time signal is artificially increased in rate by a factor of M (zero-filled up-sampling).
Here M = 250 to 384, just as with the coder (ADC). A high rate discrete-time LPF is used to interpolate
the M −1 newly inserted samples. The up-sampled signal is then converted from a discrete-time
signal to a continuous-time signal by a DAC and finally, a smoothing filter (anti-imaging filter) is used
to create a continuous-time signal. As with the ADC, the higher output rate of the DAC, combined with
the interpolating filter, considerably simplifies the analog LPF on the output of the DAC.
The figure given below shows the generic input/output DSP system:
Codec Connectors:
Four connectors on the board provide input and output capabilities:
3|Page
Instructor Manual Designed by Engr. Wania Anoosh
Polling:
The polling technique uses a continuous procedure of testing when the data is ready. Although it is
simpler than the interrupt technique, it is less efficient since the input and output data need to be
continuously tested to determine when they are ready to be received or transmitted.
Interrupts:
Interrupts are another way of handling asynchronous events on the DSP chip and may be generated
either internally through software or externally by other components on the DSK. Interrupt handling
requires extra hardware that operates autonomously from the CPU. The C6713 chip is equipped with
this hardware (timers, McBSP, etc.) and is the preferred way to time events on the DSP chip. When
interrupts are used to establish the real-time link between the on-board codec and the CPU, the
interrupt registers in SP0 are configured to handle interrupts. When the codec sets the transmit ready
bit in the SPCR, the McBSP will generate an interrupt. When an interrupt occurs, the following events
happen:
On the C6713 DSP chip, there are thirty-two possible interrupt sources, but only twelve may be
assigned by the programmer, namely INT4 through INT15. These twelve interrupts are prioritized
by the ‘Interrupt Selector’. Using interrupts requires that each interrupt be mapped to an interrupt
service routine (ISR). This is done by a Vectors file that, in our case, maps INT11 to the C coded ISR
c_int11(). In addition, INT11 must be selected to handle interrupts from XINT0, and the DSP chip
must be set up to accept programmer assigned interrupts. These tasks will be done by the C coded
function comm_intr().
4|Page
Instructor Manual Designed by Engr. Wania Anoosh
5|Page
Instructor Manual Designed by Engr. Wania Anoosh
Lab Tasks:
1. Write a code in CCS to read analog input from the function generator, converts it to digital
signal and then converts it back to analog signal. Display the results on oscilloscope.
The input signal from function generator should be a 1Vpp sine wave with frequency of 1 kHz.
Note: Using sampling rate = 16 kHz.
6|Page