T exas Instruments and its subsidiaries (TI) reserve the right to make changes to their products or to discontinue
any product or service without notice, and advise customers to obtain the latest version of relevant information
to verify, before placing orders, that information being relied on is current and complete. All products are sold
subject to the terms and conditions of sale supplied at the time of order acknowledgement, including those
pertaining to warranty, patent infringement, and limitation of liability.
TI warrants performance of its semiconductor products to the specifications applicable at the time of sale in
accordance with TI’s standard warranty. Testing and other quality control techniques are utilized to the extent
TI deems necessary to support this warranty . Specific testing of all parameters of each device is not necessarily
performed, except those mandated by government requirements.
CERTAIN APPLICATIONS USING SEMICONDUCTOR PRODUCTS MAY INVOLVE POTENTIAL RISKS OF
DEATH, PERSONAL INJURY, OR SEVERE PROPERTY OR ENVIRONMENTAL DAMAGE (“CRITICAL
APPLICATIONS”). TI SEMICONDUCTOR PRODUCTS ARE NOT DESIGNED, AUTHORIZED, OR
WARRANTED TO BE SUITABLE FOR USE IN LIFE-SUPPORT DEVICES OR SYSTEMS OR OTHER
CRITICAL APPLICA TIONS. INCLUSION OF TI PRODUCTS IN SUCH APPLICATIONS IS UNDERST OOD TO
BE FULLY AT THE CUSTOMER’S RISK.
In order to minimize risks associated with the customer’s applications, adequate design and operating
safeguards must be provided by the customer to minimize inherent or procedural hazards.
TI assumes no liability for applications assistance or customer product design. TI does not warrant or represent
that any license, either express or implied, is granted under any patent right, copyright, mask work right, or other
intellectual property right of TI covering or relating to any combination, machine, or process in which such
semiconductor products or services might be or are used. TI’s publication of information regarding any third
party’s products or services does not constitute TI’s approval, warranty or endorsement thereof.
Interfacing the TLV1562 Parallel AD-Converter to the TMS320C54x DSP
v
vi
SLAA040
Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP
Falk Alicke and Perry Miller
ABSTRACT
In this application report we discuss the hardware and software interface of the TL V1562,
10-bit parallel-output analog-to-digital converter (ADC) to the TMS320C54x digital signal
processor (DSP).
consists of the TLV1562 10-bit ADC, a THS5651 10-bit parallel output
communication digital-to-analog converter (CommsDAC) and a TLC5618A
serial-output digital-to-analog converter (DAC).
Following the discussion of the ADC we explain the need for both the THS5651
CommsDAC and the TLC5618A serial DAC.
The application report concludes with several software application examples and
recommendations for simplifying the software through modifications of the DSP
hardware interface circuit.
1Introduction
The analog-to-digital (A/D) interface can present a significant design problem
because hardware and software must work together across the interface to
produce a usable, complete design. This application report provides a design
solution for the interface between the TLV1562 10-bit parallel-output
analog-to-digital converter (ADC) and the TMS320C54x digital signal processor
(DSP).
The report describes the hardware and software needed to interface the ’C54x
DSP to the TL V1562 ADC, which is intended for applications, such as industrial
control and signal intelligence in which large amounts of data must be processed
quickly. The first sections describe the basic operation of the TLV1562. For
additional information see the References section at the end of this report.
The hardware interface board, or evaluation module (EVM)
2The Board
The TL V1562 evaluation module (EVM) is a four-layer printed circuit board (PCB)
constructed from FR4 material. The PCB dimensions are 180 mm × 112 mm ×
12 mm. Ribbon cables are used to interface the TLV1562EVM to the
TMS320C54x DSK plus starter kit.
2.1TMS320C54x Starter Kit
The starter kit simplifies the task of interfacing to the ’C54x processor. It comes
with an ADC for voice bandwidth, and GoDSP code explorer as the software tool.
A 10-MHz oscillator provides the clock signal to allow 40-MHz internal DSP clock
cycles generated by the internal DSP PLL. Therefore, the board provides 40
MIPS of processing power.
Ribbon cables are used to connect the DSP with the EVM. Detailed descriptions
of all connections are given later in this report.
CommsDAC is a trademark of Texas Instruments.
1
The Board
2.2TLV1562EVM
The TLV1562EVM gives customers an easy start with employing many of the
features of this converter. A serial DAC (TLC5618A), a parallel DAC (THS5651),
and the ADC (TL V1562) make this EVM flexible enough to test the features of the
TLV1562. It also helps show how this ADC can be implemented.
2.3ADC TLV1562 Overview
The TL V1562 is a CMOS 10-bit high-speed programmable resolution analog-todigital converter, using a low-power recyclic architecture.
The converter provides two differential or four single-ended inputs to interface the
analog input signals.
On the digital side, the device has a chip-select (CS
sample/conversion start signal (CSTART
input (WR
), and 10 parallel data I/O lines (D9:0).
The converter integrates the CSTART
), read signal input (RD), write signal
signal to coordinate sampling and
conversion timing without using the parallel bus. Since the TMS320C542 DSP
has no second general-purpose output, this signal is generated with the signal
(CSTART
) from the address decoder.
2.3.1Suggestions for the ’C54x to TLV1562 Interface
The following paragraphs describe two suggested interfaces between the ’C54x
and the TLV1562.
2.3.1.1The Universal Interface
The schematic in Figure 1 shows the pin-to-pin connections between the
TL V1562 and ’C54x, realized on the EVM. This routing can test the converter in
each mode. One I/O-wait state is required for write operations to the ADC. The
read sequence from the ADC does not require any wait states because the RD
signal is generated with XF.
TLV1562TMS320C54x
INT
CSTART
CS
01
10
11
Address
Decoder
), input clock (CLKIN),
INT
A0
A1
2SLAA040
RD
WR
CLKIN
D(0–9)D(0–9)
≥ 1
1: x
Divider
XF
IOSTRB
R/W
CLOCKOUT
Figure 1. TLV1562 to ’C54x DSP Interface of the EVM,
Using RD or the CSTART Signal to Start Conversion
2.3.1.2Simplification of Software Requirements Through Modified Interface
Of all the TL V1562 modes of operation, only the mono interrupt driven mode uses
the RD
signal to start the conversion. This requires a very flexible handling of the
read signal and therefore has to be performed by a general-purpose output
signal. If the application excludes using the RD
(using CSTART
instead). The TLV1562 RD input signal can be generated with
an OR gate, whose inputs are driven by IOSTRB
signal to start the conversion
and R/W signals from the DSP
(see Figure 2).
Using these connections saves the programming steps of setting/resetting RD
with the XF signal. Another advantage is having XF available to control the
CSTART
signal. This saves busy times on the address bus (in Figure 1, CST ART
was generated through A0/A1.) and simplifies the software code.
CAUTION:
The time t
EN(DATAOUT)
between the RD high-to-low transition
(generated by the DSP) and the arrival of valid ADC output
data on the data bus is related to the capacitive load of the
bus. In most cases, the ADC come out of the 3-state mode
and supplies the correct voltage levels onto the bus lines in
less than 50 ns. Thus, the minimum number of I/O-wait states
becomes two (for t
TLV1562TMS320C54x
INT
CSTART
CS
EN(DATAOUT)
01
10
11
≤50 ns).
Address
Decoder
INT
XF
A0
A1
The Board
CLKIN
D(0–9)D(0–9)
Figure 2. TLV1562 to ’C54x DSP Interface of the EVM,
Using RD
2.3.2Recyclic Architecture
One specialty of this ADC is its recyclic architecture. Instead of limiting the device
power by the highest possible resolution at the fastest speed, this converter is
able to work at three maximum speeds for three resolutions. The highest
resolution runs at 2MSPS maximum throughput rate; 8-bit resolution
corresponds to 3MSPS, and 4-bit resolution to 7MSPS.
RD
WR
≥ 1
&
≥ 1
1: x
Divider
IOSTRB
R/W
CLOCKOUT
or the CSTART Signal to Start Conversion
Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP
3
The Board
This feature fits well into monitoring application. For example, the ADC may have
to trigger on one event out of some channels inside an extremely small time
window and then sample the correct channel with a higher resolution, but lower
throughput to analyze this process. This feature also fits well into home security
applications or applications that must monitor several inputs simultaneously.
2.3.3Note on the Interface, Using an External ADC Clock Drive
The TL V1562data sheet (Figure 9) shows that RD has to fall as close as possible
to the falling edge of the clock signal. The user must adhere to this timing,
otherwise the conversion result may be wrong. The user may not recognize the
erroneous result, since the ADC will signal that the conversion has finished during
the logic low transition of the INT
interface behavior of the ADC whether the timing is correct or not. The following
figure shows what happens when the RD
RD
falls nearly 1/2 of one cycle too late, the conversion result is valid on the 5
clock cycle.
signal. The following timing diagram shows the
falling edge is timed wrong. Although
th
12345678910
CLK
RD
INT
Conversion Starts
Next Sampling Starts
2.4Onboard Components
These sections describe the EVM onboard components.
2.4.1TLC5618A – Serial DAC
This 12-bit DAC has a serial interface that can run at 20-MHz clock; therefore, it
can update the output at 1.21 MSPS. Two outputs are available on the 8-pin
package. The buffered SPI of the DSP provides the DSP interface. Using the
auto-buffer mode, updating the data on the DAC requires only four CPU
instructions/samples.
1
Conversion Finished
4SLAA040
The Board
Serial DAC
SCLK
CS
TLC5618A
DIN
TLV1562 EVM Pin Connector
Figure 3. TLC5618A to ’C542 DSP Interface
2.4.2THS5651 – Parallel Output CommsDAC
This 10-bit data converter has a parallel interface and is able to update its output
with 100 MSPS. The two outputs on the 28-pin package can each drive a current
between 2 mA and 20 mA with an output resistance >100 kΩ (ideal current
source: output impedance → ∞). The data bus and the address decoder provide
the interface to the DSP.
Parallel DAC
DSP
BCLKX
BCLKR
BFSX
TMS320C542
BFSR
BDX
BDR
DSP
CLK
THS5651
D(0–9)
Buffer
CLKOUT
TMS320C542
A(0–1) = 11
D(0–9)
b
Figure 4. THS5651 to C542 DSP Interface
Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP
5
Operational Overview
3Operational Overview
This chapter discusses the software and hardware interface for the TLV1562.
Plus the overall operational sequence of the A/D interface is described.
3.1Reference Voltage Inputs
The voltage difference between the VREFP and VREFM terminals determines
the analog input range, i.e., the upper and lower limits of the analog inputs that
produce the full-scale (output data all 1s) and zero-scale (output data all 0s)
readings, respectively.
For design reasons, this high-speed sampling ADC does not have a groundreferenced input voltage range. Hence, level shifting is required unless the
application allows the signal to be ac coupled. Level shifting could be done with
single-supply op amps.
The absolute voltage values applied to VREFP, VREFM, and the analog input
should not be greater than the A V
input restrictions apply so consult the TL V1562 data sheet for further information.
The digital output is full scale when the analog input is equal to or greater than
the voltage on VREFP , and is zero scale when the input signal is equal to or lower
than VREFM.
supply minus 1 V , or lower than 0.8 V . Other
DD
3.2Input Data Bits
The ADC contains the two user-accessible registers, CR0 and CR1. All user
defined features such as conversion mode, data output format or sample size are
programmed in CR0 and CR1. The data acquisition process must be started by
writing to these two registers. After this initialization, the converter processes
data in the same configuration until these registers are overwritten.
6SLAA040
3.3Connections Between the DSP and the EVM
The following connections provide the interface between the DSP and the EVM:
Signals D[9–0] of the TLV1562 and D[9–0] of the DSP are tied together in this
application to simplify hardware debugging during the development phase.
However, if the 2s complement feature of the DAC is to be used, it is easier to
connect D[15-6] of the DSP with D[9–0] of the ADC. A simple right shift of the
result then evaluates the result when sign extension mode (SXM) is enabled.
Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP
7
Operational Overview
3.3.1Jumpers Used on the TLV1562EVM
Table 2. 3-Position Jumpers
JUMPERGENERAL DESCRIPTIONPIN 1-2PIN 2-3
W1Connects BP/CH3 (ADC) to R45 or GND;Input not in use, grounded to reduce noise Use as single input channel3 or
W2Connects BM/CH4 (ADC) to R44 or GND;Input not in use, grounded to reduce noise Use as single input channel4 or
W3Connects RD to XF or /RD1Logic generator is connected to the ADCDSP is connected to the ADC
W4WR + WR1 is connected with DSP_WR or
W5
W6
W7
W8MCB_CLK is connected to BUFCLK (U14) or
W9CLK input of the Counter (U2) is connected with
W10ADC CLKIN is connected to CLK/2 or CLK/4The ADC clock runs at a quarter of the
W11Connects AP/CH1 (ADC) to R48 or GND;Input not in use, grounded to reduce
W12Connects AM/CH2 (ADC) to R47 or GND;Input not in use, grounded to reduce
W13Connects REFLO (TL V5651) to Vcc or GNDDisable internal referenceEnable internal reference
W14Connects SCLK (TLC5618AA) to BCLKX or J8
W15Connects CLK (TLV5651) to CLKOUT (DSP) or
W23Connects CSTAR T to A0, A1, or XFA0 and A1 used to generate ADC
W24Connects DSP_RD to XF or IOSTRB, ORed with
U12-J9/3
The three Jumpers define the prescaling of the
CLKOUT signal to the MCB_CLK Pin, if W8 is
set to Counter-Mode
(U11)
RD1
CLKOUT or CLKOUT/2
(BNC)
J7 (BNC)
/W from the DSP
R
Logic generator is connected to the ADCDSP is connected to the ADC
Counter-Mode (MCB_CLK signal is
divided by the counter, set-up with
Jumper W(5-7)
The counter is toggled by the DSP
system clock (signal BUFF_CLK)
DSP clock frequency (10 MHz)
noise
noise
Normal DSP modeAn external clock source drives the
Normal DSP modeAn external clock source drives the CLK
signal
CSTART
XF signal connected to ADC RD pinRD pin driven by IOSTRB ORed with R/W
differential input positive channel B
differential input negative channel B
Counter-Mode disabled (MCB_CLK is
synchronize with the CLKOUT signal)
The counter’s clock is prescaled by two
(toggled by half the DSP system clock
(CLKOUT2))
The ADC clock runs at half the DSP
clock frequency (20 MHz)
Use as single input channel 1 or
differential input positive channel A
Use as single input channel 2 or
differential input negative channel A
SCLK pin instead of the DSP
pin instead of the DSP
XF signal connects to CSTAR T pin
Table 3. 2-Position Jumpers
JUMPERGENERAL DESCRIPTIONPINS SHORTEDPINS OPEN
W16Connects Mode input (TLV 5651) to GNDMODE 0 is chosen (binary data input)MODE 1 is chosen (2s complement
W17Connects REFIO (TLV5651) to VREF1 or leaves
the REFIO pin decoupled to GND via a 0.1 µF
capacitor
W18Connects DIR (U19) to GND or leaves the DIR
pin connected to WR
W19Connects OE (U19) to GND or leaves the OE pin
connected to CS
W20Connects BDX to BDR or leaves BDR openDSP BDR pin gets a shortcuted feedback
W21Connects BSFX to BSFR or leaves BCLKR open DSP BSFR pin gets a shortcuted feedback
W22Connects BCLKX backwards with BCLKR or
leaves it open
W28Connect Sleep input (TLV5651/5 GNDNormal mode of operationSleep mode seleted
Use as external reference voltage inputUse as internal reference voltage
ADC can only write but not read to the data
bus
Output driver is isolated and disabled (no
signal can bus trough the data bus)
from the BDX (transmit) pin; normal mode
from the BSFX (transmit) pin; normal mode
DSP BCLKR pin gets a shortcuted feedback
from the BCLKX (transmit) pin; normal mode
8SLAA040
data input)
output with this pin terminated into
GND in series with 0.1 pF
Normal operation mode
Normal operation mode
BDR remains open
BSFR remains open
BCLKR remains open
4The Serial DAC/DSP System
The software configures the buffered DSP serial port to the 16-bit master mode
so that the DSP generates the frame sync signal at BFSX and the data clock at
BCLKX serial port terminals. Table 4 shows the connections between the DSP
and the DAC TLC5618A.
Table 4. DSP/DAC Interconnection
FROM DSPTO DSPTO DAC
BFSXBFSRCS
BCLKXCLKRI/O CLK
BDXBDRDATA IN
The following statements describe the generation and application of the
configuration and control signals.
•The DSP BCLKX output provides a 20-MHz data clock, which is a divide-by-2
of the DSP master clock.
•The DSP BDX output supplies the 16-bit control and data move to the
TLC5618A at DATA IN.
•The DSP BFSX frame synchronization signal, connected to CS, triggers the
start of a new frame of data.
The Serial DAC/DSP System
After the falling edge of FSX, the next 16 data clocks transfer data into the DSP
DR terminal and out of the DX terminal. Since this DSP/DAC interface is
synchronous, the FSX signal is sent to the FSR terminal, and the CLKX is sent
to the CLKR terminal.
Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP
9
The DSP Serial Port
5The DSP Serial Port
The buffered serial port provides direct communication with serial I/O devices and
consists of six basic signals and five registers. The DSP internal serial port
operation section discusses the registers.
The six signals are:
•BCLKX - The serial transmit clock. This signal clocks the transmitted data
from the BDX terminal to the DIN terminal of the TLC5618A.
•BCLKR - The serial receive clock. This signal clocks data into the DSP BDR
terminal. Since the DAC does not send any information back to the DSP, this
signal is not important.
•BDX - Data transmit. From this terminal the DSP transmits 16-bit data to the
DIN terminal of the TLC5618A.
•BDR - Data receive – not in use
•BFSX - Frame sync transmit. This signal frames the transmit data. The DSP
begins to transmit data from BDX on the falling edge of BFSX and continues
to transmit data for the next 16 clock cycles from the BCLKX terminal. The
BFSX signal is applied to the TLC5618A CS
•BFSR - Frame sync receive. This signal frames the receive data. The DSP
begins to receive data on the falling edge of BFSR and continues to recognize
valid data for the following 16 clocks from BCLKR. This signal is not important
for this application.
terminal.
Table 5 lists the serial port pins and registers.
Table 5. DSP Serial Port Signals and Registers
PINSDESCRIPTIONREGISTERSDESCRIPTION
BCLKXTransmit clock signalBSPCSerial port control register
BCLKRReceive clock signalBSPCEextended BSPC
BDXTransmitted serial data signalBDXRData transmit register
BDRReceived serial data signalBDRRData receive register
BFSXTransmit frame synchronization signalBXSRTransmit shift register
BFSRReceive frame synchronization signalBRSRReceive shift register
AXRBuffer start location
BKXBuffer size
For this application the DSP buffered serial port is programmed as the master,
so the BCLKX output is fed to the BCLKR terminal and the BFSX output is fed to
the BFSR terminal.
10SLAA040
6Other DSP/TLV1562 Signals
These paragraphs describe other DSP and TLV1562 signals.
6.1DSP Internal Serial Port Operation
Three signals are necessary to connect the transmit pins of the transmitting
device with the receive pins of the receiving device for data transmission. The
transmitted serial data signal (BDX) sends the actual data. BFSX initiates the
transfer (at the beginning of the packet), and BCLKX clocks the bit transfer. The
corresponding pins on the receive device are BDR, BFSR and BCLKR,
respectively.
The transmit is executed by the autobuffer mode. This means there is no need
to write to the serial port output buffer . Instead, the DSP continuously sends the
data, located in the memory beginning on AXR. When all data are sent (defined
by the buffer length in BXR), the first word (pointed to by AXR) is sent again.
Therefore, the program has only to store the samples into this memory location.
The rest of the task is handled in the background, using no CPU power.
Other DSP/TLV1562 Signals
Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP
11
Conversation Between the TLV1562 and the DSP
7Conversation Between the TLV1562 and the DSP
The complexity of the TLV1562 ADC may be confusing because of the number
of possible modes to drive the protocol between DSP and ADC. The following
paragraphs explain more about the data sheet descriptions for interfacing the
’C54x to the ADC.
7.1Writing to the ADC
Registers CR0 and CR1 must be set to choose any of the modes the TLV1562
offers. Therefore, a write sequence must be performed from the DSP to the ADC.
After selecting the ADC (CS
low), a high-low transition of the WR line tells the
converter that something is to be written to the data port.
Table 6. DSP Algorithm for Writing to the ADC
STEPSTIMING, NOTES
1. Set one DSP I/O waitstateMake timing between 40 MHz C54x CPU compatible with the TLV1562
2. Clear CSSelect ADC
3. Send out data on the busThe signal WR is automatically handled by the DSP
4. Set CSDeselect ADC
7.2Mono Interrupt Driven Mode Using RD
This mode is used when the application needs to sample one channel at a time
and performs the sampling, conversion, and serial transmission steps only once.
Although this mode produces continuous sampling data, the use of other modes
is recommended. One reason is the CS
sampling/conversion time. An interesting advantage of this mode is its ability to
control the start-sample time.
The RD
stops the sampling process (disconnects the capacitor from the input signal) and
starts the signal conversion. After two ADCSYSSCLKs, the sampling capacitor
gets connected back to the input signal to do the next sampling. The conversion
time needs five ADCSYSCLKs to finish the conversion before it gets written to the
data port.
signal controls the sampling and converting. Every falling edge of RD
signal has to stay low during the whole
During configuration, the rising edge of WR
Also, when conversion is finished, the ADC clears the INT signal purposes. Next
the ADC writes the conversion result to the data port. The rising edge of RD
this status; in other words, the INT
conversion result on the data port becomes invalid (the ADC data port gets
3-stated).
The configuration data needs to be written only once to the ADC. After this,
toggling the RD
the RD
12SLAA040
starts the sampling.
resets
signal goes back to logic high and the
signal runs the ADC in a sampling/conversion/sending mode and
signal releases every new cycle.
Table 7. DSP Algorithm for Mono Interrupt Driven Mode Using RD
STEPSTIMING, NOTES
0. Initialization
Write all configuration data to the
ADC
1. set CSdeselect ADC (optional with APD=0)
2. clear CSSelect ADC
3. Wait for
t
D(CSL-sample)
+1ADCSYSCLK
activate the mono interrupt-driven mode
in CR0(2;3)
(Note: if Hardware Auto power down is
enabled, Chip select has to be used,
otherwise CS can be left high)
t
D(CSL-sample)
t
D(CSL-sample)
= 5ns (APD=0)
= 500ns (APD=1)
Conversation Between the TLV1562 and the DSP
Wait cycles for the DSP internally (40 MHz DSPCLK):
APD=0
ADCSYCLK
= 7.5 MHz
≥6≥5≥26≥25
APD=0
ADCSYCLK
= 10 MHz
APD=1
ADCSYCLK
= 10 MHz
APD=1
ADCSYCLK
= 10 MHz
4. Clear RDADC goes over from sampling into
conversion
5. Wait until INT goes lowalternative: ignore the INT signal, wait 49
ns+5(6) ADCSYSCLK and goto step
number 7
6. Wait the time t
EN(DATAOUT)
t
EN(DATAOUT)
= 41 ns≥2≥2≥2≥2
7. Read sample out from the data port;
Reset RD
signal
8. Goto step 1 or step 3 (if APD=0) for
more samples
≥34≥22≥34≥22
Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP
13
Conversation Between the TLV1562 and the DSP
7.3Mono Interrupt Driven Mode Using CSTART
Use the CSTART signal when two or more ADCs must sample/convert signals
at the same time. Instead of the RD
is started with the edges of the CST ART
get the data out of the ADC and onto the bus.
Table 8. DSP Algorithm for Mono Interrupt Driven Mode Using CSTART
STEPSTIMING, NOTES
1.Set CSDeselect ADC
2.Clear CSTARTtTis starts sampling
3.Wait for t
4.Set CSTARTThis starts the conversion
5.Wait until INT goes lowAlternative: ignore the INT signal,
6.Wait the time t
7.Clear CSSelect the ADC
8.Clear RDStart communication
9.Wait the time t
10. Read sample out from the data port;
Reset RD
11. Set CSDeselect ADC
12. Go to step 2 for the next samples
W(CSTARTL)
D(INTL-CSI)
EN(DATAOUT)
signal
t
W(CSTARTL)
t
W(CSTARTL)
wait 14ns+5 ADCSYSCLK and goto
step number 7
t
D(INTL-CSI)
t
EN(DATAOUT)
signal, the timing for sampling and converting
signal. The RD signal is still required to
= 100 ns(APD=0)
= 600 ns(APD=1)
= 10 ns≥1≥1≥1≥1
= 41 ns≥2≥2≥2≥2
Wait cycles for the DSP internally (40MHz DSPCLK):
APD=0
ADCSYCLK
= 7.5 MHz
≥4≥4≥24≥24
≥33≥21≥33≥21
APD=0
ADCSYCLK
= 10 MHz
APD=1
ADCSYCLK
= 10 MHz
APD=1
ADCSYCLK
= 10 MHz
14SLAA040
7.4Dual Interrupt Driven Mode
Using techniques similar to those described in the first two modes for
sampling/converting/sending tasks, the dual mode samples two channels at the
same time and sends out the results in series to the data port. The CST AR T
is used to start sampling and converting.
Table 9. DSP Algorithm for Dual Interrupt Driven Mode
STEPSTIMING, NOTES
1.Set CSDeselect ADC
2.Clear CSTARTThis starts sampling
3.Wait for t
4.Set CSTARTThis starts the conversion
5.Wait until INT goes lowAlternative: ignore the INT signal,
6.Wait the time t
7.Clear CSSelect the ADC
8.Clear RDStart communication
9.Wait the time t
10.Read sample out from the data port;
reset RD
11.Wait t
12.Clear RD-Start communication
13.Wait the time t
14.Read sample out from the data port;
reset RD
15.Set CSDeselect ADC
16.Goto step 2 for the next samples
W(CSTARTL)
D(INTL-CSL)
EN(DATAOUT)
signal
W(CSH)
EN(DATAOUT)
signal
t
W(CSTARTL)
t
W(CSTARTL)
wait 210ns+10 ADCSYSCLK and go
to step number 7
t
D(INTL-CSI)
t
EN(DATAOUT)
t
W(CSH)
t
EN(DATAOUT)
= 100ns(APD=0)
= 600ns(APD=1)
= 10 ns≥1≥1≥1≥1
= 41 ns≥2≥2≥2≥2
= 50 ns≥2≥2≥2≥2
= 41 ns≥2≥2≥2≥2
Conversation Between the TLV1562 and the DSP
pin
Wait cycles for the DSP internally (40MHz DSPCLK):
APD=0
ADCSYCLK
= 7.5MHz
≥4≥4≥24≥24
≥62≥48≥62≥48
APD=0
ADCSYCLK
= 10MHz
APD=1
ADCSYCLK
= 10MHz
APD=1
ADCSYCLK
= 10MHz
Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP
15
Conversation Between the TLV1562 and the DSP
7.5Mono Continuous Mode
This mode simplifies data acquisition, since there is no need to generate a signal
to sample or convert data. Instead, initializing this mode once, the ADC sends out
the data continuously and will be read by the DSP with the RD
CAUTION:
In this mode, the sampling result sent out by the ADC is the
value of the sample from the last cycle. Therefore, the first
sample after initialization is trash.
Table 10. DSP Algorithm for Mono Continuous Mode
Wait cycles for the DSP internally (40MHz DSPCLK):
STEPSTIMING, NOTES
0. InitializationN/AN/A
Write all configuration data to the
ADC
1. Set CSDeselect ADCN/AN/A
2. wait for t
3. Clear CSSelect ADCN/AN/A
4. Clear RDStart conversionN/AN/A
5. Wait the time t
6. Read sample out from the data port;
reset RD
7. Wait for the time t
step 7 and 8 to ensure 5(6) ADCSYSCLk
8. Go to step 4 for more samplesN/AN/A
(SAMPLE1)
EN(DATAOUT)
signal
(CONV1)
minus
Activate the mono continuous mode in
CR0(2;3)
t
(SAMPLE1)
t
EN(DATAOUT)
(Caution: the first result after initialization
is trash)
t
(CONV1)
7 and 8 take at least 4 DSPSYSCLK, the
calculation are 5(6) ADCSYSCLK minus
100 ns
= 100 ns≥4≥4N/AN/A
= 41 ns≥2≥2N/AN/A
= 5(6) ADCSYSCLK; since step
APD=0
ADCSYCLK
= 7.5 MHz
≥23≥16N/AN/A
signal.
APD=0
ADCSYCLK
= 10 MHz
APD=1
ADCSYCLK
= 10 MHz
N/AN/A
N/AN/A
APD=1
ADCSYCLK
= 10 MHz
16SLAA040
Conversation Between the TLV1562 and the DSP
7.6Dual Continuous Mode
The dual continuous mode provides a data stream of two input signals. The
characteristic of the data protocol is similar to the mono continuous mode but with
the use of two RD
In this mode, the sampling result sent out by the ADC is the
value of the sample from the last cycle. Therefore, the first
sample after initialization is trash.
Table 11. DSP Algorithm for Dual Continuous Mode
STEPSTIMING, NOTES
0.InitializationN/AN/A
Write all configuration data to the
ADC
1.Set CSdeselect ADCN/AN/A
2.Wait for t
3.Clear CSSelect ADCN/AN/A
4.Clear RDStart conversion
5.Wait the time t
6.Read first sample out from the
data port; reset RD
7.Wait for the time t
step 7 and 8 to ensure 5(6) ADCSYSCLk
8.Clear RDStart conversion
9.Wait the time t
10.Read second sample out from the
data port; reset RD
11.Wait for the time t
step 7 and 8 to ensure 5(6) ADCSYSCLk
12.Go to step 4 for more samplesN/AN/A
(SAMPLE1)
EN(DATAOUT)
EN(DATAOUT)
signal
(CONV1)
signal
(CONV1)
minus
minus
cycles for one sample/hold cycle.
CAUTION:
Wait cycles for the DSP internally (40MHz DSPCLK):
ADCSYCLK
Activate the dual continuous mode in
CR0(2;3)
t
(SAMPLE1)
t
EN(DATAOUT)
(Caution: the first result after initialization
is trash)
t
(CONV1)
and 8 take at least 4 DSPSYSCLK, the
calculation are 5(6)ADCSYSCLK minus
100 ns
t
EN(DATAOUT)
(Caution: the first result after initialization
is trash)
t
(CONV1)
and 8 take at least 4 DSPSYSCLK, the
calculation are 5(6)ADCSYSCLK minus
100ns
= 100 ns≥4≥4N/AN/A
= 41 ns≥2≥2N/AN/A
= 5(6) ADCSysclk; since step 7
= 41 ns≥2≥2N/AN/A
= 5(6) ADCSysclk; since step 7
APD=0
= 7.5 MHz
≥23≥16N/AN/A
≥23≥16N/AN/A
APD=0
ADCSYCLK
= 10 MHz
APD=1
ADCSYCLK
= 10 MHz
N/AN/A
N/AN/A
N/AN/A
APD=1
ADCSYCLK
= 10 MHz
Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP
17
Software Overview
8Software Overview
The software in this report shows how to use all modes of the TL V1562 and useful
variations for each mode. It also includes a C program to start data acquisition
from a C level. To limit the number of programs, the report supplies five files for
running the ADC in five modes; a sixth program shows the C-callable function.
Each program can enable different software blocks to give the user a large choice
for generating the data acquisition. For more details, see paragraph 8.3.9.
Instead of using numbers for memory addresses or constants, very often
symbols replace the numbers. For that, the symbol (name) is assigned with the
real value (number) in the file header. The advantage of doing this is the higher
flexibility. Instead of changing a variable memory location in every related
instruction, the value for this location is changed only once in the program header.
This prevents software bugs from appearing through a forgotten correction of a
related instruction.
BSPC_BUFFER_STARTset 00800h; memory location (800h) for the
@AXR = #(BSPC_BUFFER_START); assign the starting address of auto
8.1Software Development tools
The DSKplus Starter Kit of the TMS320C54x comes with a free compiler to
generate an absolute object file from assembler code (DSKPLASM.EXE in the
TMS320C54x DSKplus development tools). The object code is then loaded into
the GoDSP software to run it on the kit.
An advanced version of this kit is the TMS320C54x Optimizing C Compiler/
Assembler/Linker (for example: TMDS324L855-02). These tools allow
generation of object code from C and assembler files. Furthermore, they also link
the code to an executable COFF file. The software in this report was created with
these tools.
For more information visit TI’s Internet page at:
http://www.ti.com/sc/docs/dsps/tools/c5000/c54x/index.htm
8.2DSP Memory Map
Figure 6 shows the memory map assigned to the application.
PROGRAM MEMORY (on-chip DARAM 10k words (OVLY=1) from 0080h to 27FFh):
; start address of the SPC buffer
; buffer
.
18SLAA040
0000h
007Fh
0080h
00FFh
0100h
017Fh
0180h
07FFh
0800h
0FFFh
1000h
1009h
100Ah
17FFh
1800h
27FFh
2800h
EFFFh
F000h
F7FFh
F800h
FF7Fh
FF80h
FFFFh
(OVLY = 1)
Original Interrupts DSKplus
Starter Kit
Communication Kernel
Starter Kit
RAM
BSP RAM Block or Program RAM
Kernel Buffer (10 Words)
HPI RAM Block or Porgram RAM
Program
External
On-Chip ROM
ROM (Bootloader)
ROM Interrupts
01FFh
0200h
027Fh
0280h
02FFh
0300h
Software Overview
Unused
Software Interrupt Table
Unused
Linked Program Memory Code
0000h
005Fh
0060h
007Fh
0080h
27FFh
1800h
1FFFh
2000h
27FFh
2800h
FFFFh
Reserved Memory by The DSKplus Board
Memory-Mapped Register
Scratch-Pad RAM
DRAM See Program Memory
Software Data Memory
(All Variables)
Tables to Store Data Samples
External
Figure 5. Memory Map
Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP
data_log_A
data_loc_A + num_data_A
data_loc_B
data_loc_B + num_data_B
data_loc_C
data_loc_C + num_data_C
data_loc_D
data_loc_D + num_data_D
Table 1
Table 2
Table 3
Table 4
19
Software Overview
8.3Programming Strategies for the ’C54x, Explanations
Before listing the program code, this chapter introduces some basic instructions
(strategies) to provide the ’C54x user with some ideas for dealing with the DSP
architecture.
8.3.1Optimizing CPU Resources for Maximum Data Rates
The ’C54x processor on the DSKplus starter kit runs at an internal clock
frequency of 40 MHz. Since the pipeline architecture allows most instructions to
be executed in one cycle, the DSP provides up to 40 MIPS. However, some
instructions, especially branch instructions, are not single cycle instructions;
therefore, they lower the available CPU power. Because of the high transfer rate
of the TLV1562 ADC,
performance. Since correct signal timing between DSP and ADC requires some
instructions per sample, the CPU power required between two samples is very
small.
The optimum case is to read a new sample, store it into memory, execute a
customized task as it could be data filtering (FFT, FIR, IIR), and send a digital
result to one of the DACs. Unfortunately, this task is impossible at the ADC’s
maximum throughput of 40 MIPS. Therefore, this software only stores the
samples and optionally moves them out to the DACs. Enabling all options at the
same time prevents the application from running at maximum throughput.
the software code must be optimized to test the full ADC
The following switches enable/disable these actions:
SAVE_INTO_MEMORY .set 00001h; set 1 to store the samples into memory
SEND_OUT_SERIAL .set 00001h; set 1 to send last sample to the serial DAC
SEND_OUT_PARALLEL .set 00001h; set 1 to send last sample out to the parallel DAC
8.3.2Address and Data Bus for I/O Tasks
8.3.2.1Writing
PORT(PA) = Smem
Writing something to the I/O bus uses the port instruction. PA sets the ADDRESS
bus permanently to that value. Smem is a value from memory , transferred for one
clock cycle to the DATA bus.
@send = #01234h; set the content of memory address send to 1234h
port(0FFFFh) = @send ; set address bus to FFFFh and write 1234h for one cycle
; on the DATA bus
8.3.2.2Reading
Smem = PORT(PA)
Reading from the I/O bus. P A sets the ADDRESS bus. Smem is a memory cell,
PA the address on the bus.
8.3.3Timer Output
@TCR = #00010h; deactivate timer
@PRD = #00000h;
@TCR = #00C01h ; set timer output toggling frequency to ½ CLKOUT
; frequency ; and start toggling
20SLAA040
The timer output pin TOUT can be used to generate an output function with a
prescale from half the CLK frequency down to 1FFFF . The problem: the high-time
is always one clock cycle and only the low time of the TOUT signal changes with
the timer.
8.3.4Data Page Pointer
DP = #0; load DP with 0
DP = #variable; point with DP to the page, where variable is stored
DP ≠ #register; error, this won’t work, the DP gets not loaded with
; register page, instead load DP with zero
If a register has to be written (example: IFR), the DP has to be loaded with zero
since DP=#register will not work.
8.3.5Generating the Chip Select Signal and the CSTART Signal
port(CSTART) = @ZERO; clear CSTART- (CSTARTlow)
port(ADC) = @CR0_SEND; clear CS- (CSlow)
port(DEACTIVE) = @ZERO; set CS or CSTART back (CS high or CSTARThigh)
The chip select signal and the CST ART signal can be accessed using the address
bus (decoder on A0/A1). The basic idea of having CSTART
triggering for sampling/conversion purposes without having to use CS
always blocks the address bus). Since the ’C542 DSP does not have enough
general purpose outputs, this application still uses the address bus to activate
CSTART.
was to allow ADC
Software Overview
(which
8.3.6Interfacing the Serial DAC 5618A to the DSP
A buffered serial port on the ’C542 board interfaces the TLC5618A DAC. The
advantage of using a buffered serial port compared to the standard port is the
auto buffer mode. This allows the programmer to save CPU power . A background
process takes the data from a defined memory location (table) and moves it out
to the serial port. (An interrupt can be generated after sending out half or the full
table content. However, disabling this interrupt and writing the new ADC samples
into the same memory location where the SPI takes the send value from, allows
continuous transmission of the data stream to the DAC. When debugging the
EVM it is preferable to compare the analog output signal of the DAC with the
analog input signal applied to the ADC.
The TLC5618A is very easy to use. The sample size is limited to 10 bits and the
first six MSBs are set so that the converter outputs the value on the right pin in
the right mode.
The next lines of code show the initialization. The only requirement is to initialize
the buffered serial port, since the DAC does not need an initialization procedure.
@BSPC = #00000h ; reset SPI
@IFR = #00020h ; clear any pending SPI IRQ
@IMR = #00020h ; allow BXINT0
@BSPCE = #00521h ; set Auto buffer mode
@AXR = #(BSPC_BUFFER_START); set the starting address of the auto buffer
@BKX = #(BSPC_BUFFER_SIZE) ; buffer size
@BSPC = #0C07Ch ; start serial port, FSX in Burst (every word)
Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP
21
Software Overview
8.3.7Interrupt Latency
The time required to execute an interrupt depends on the handling of the IRQ at
the four-word vector address or jumping further with a GOTO instruction. Using
the fast return from IRQ instruction, and branching from the IRQ vector to a
separate routine memory location, produces an IRQ overhead of:
The time between when the IRQ occurs and the routine executes its first
instruction depends on the instruction in the CPU pipeline when the interrupt
occurs. Running a repeat command delays the IRQ until the full number of
repetitions is finished.
NOTE: Using a delayed branch instruction (dgoto) and putting
two useful words of instruction behind this instruction saves the
CPU calculation power.(See the explanations about delayed
branches Section 8.3.8).
The easiest solution for a branch is to use the goto instruction. Since the ’C54x
has a pipeline to allow execution of one instruction in one clock cycle, a simple
branch instruction will take four cycles for execution. Example:
GOTO MARK
...
MARK: DP = #1;
ARP = #5;
...
The program counter (PC) points after the last instruction (ARP=#5) past 6 sysclk
cycles. However, this can be optimized, using a delayed branch.
DGOTO MARK
DP = #1;
ARP = #5;
...
MARK: ...
The time to execute the same number of instructions is now only four CPU clock
cycles. (After four instructions, the PC points to the address MARK. The reason
for this is the processor’s pipeline finishes the instructions after dgoto and does
not just trash the already-processed fetch when the branch is in the pipeline’s
decoding state.
Conclusion: The goto and dgoto instructions both execute the branch in less
than four SYSCLCKs, but the dgoto instruction can execute the next two
instructions following dgoto in the same amount of time.
22SLAA040
CAUTION:
Use the delayed branches carefully , since it looks confusing when
an instruction has been executed after a call instruction. A solution
is to first use the normal branches when writing the code, and when
all tasks have been finished, optimize the code with the delayed
algorithms.
To test different software solutions while keeping the number of files small
requires integrating all the modules in the same file. Furthermore, a switch is
needed to enable any of the software modules. Setting the constant SWITCH in
the program header to either one or zero enables/disables the instructions inside
an .IF-.ENDIF loop. Example:
SWITCH1.set00001h
SWITCH2.set00000h
...
.if SWITCH1
instruction_X; the instructions on this line will be assembled
.elseif SWITCH2
instruction_Y; the instructions on this line will be ignored
.endif
In this example, instruction_X is executed (linked into object code) while
instruction_Y is ignored. Setting SWITCH2 instead of SWITCH1 to 1 enables
instruction_Y and makes the compiler link it to object code. If both switches areone, only instruction_X is compiled.
8.4Software Code Explanation
Software Overview
The next capture describes the software solution to interface the TLV1562 and
the two DACs on the EVM board. Although the code looks very large and
complicated at first, it is a simple solution with only a little knowledge of the code
required to verify/customize the settings. The TLV1562 (ADC) offers a wide
choice of settings. First, choose the conversation mode. This application report
provides one file for each mode. Many settings (2s complement, channels, etc.)
must be selected. This software allows a variation of those parameters in the
program header. A simple switch enables or disables each component. After
recompiling the code with a special setting of all switches, the code becomes
much smaller and easier to understand. The .if/.elsif/.endif instruction allows the
program to use or ignore blocks of instruction between the statements.
If, for example, one does not want to use the serial DAC and disables the switch
SEND_OUT_SERIAL, all the source code for the serial conversation between
DSP and DAC is ignored. The compiler will not implement any code related to the
serial DAC.
8.4.1Software Principals of the Interface
Controlling the status of signals can be done in different ways. One of the
challenges in this interface is controlling signal status when the ADC conversion
is finished and the digital result is ready to be transferred from the ADC to DSP.
A high/low transition on the INT
has completed the conversion. Optionally, the DSP can ignore the INT
initialize the conversion instead, wait for a defined time, and directly read the
result out of the ADC. This solution requires knowing the precise time for
conversion/data ready on the bus for each converter/mode.
line of the TL V1562 informs the DSP that the ADC
signal,
Three options are given for each mode to match different custom needs; they are
listed in the next three sections.
Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP
23
Software Overview
8.4.1.1Software Polling
The status of the input pin is tested in a loop until the valid transition occurs. After
this transition, the program branches to the next instruction (reads data sample).
Advantage:
•Relatively fast program response after high-to-low transition of INT
•The software compensates for variations of timing given in data sheets for
conversion and the real time until the flag goes high.
•Not critical for any software changes (e.g. adding new features)
•Even when the program reaches the polling loop later than the transition
occurred, it steps ahead properly.
Disadvantage:
•Time inside the polling loop is not usable for other software features (wasted
CPU power)
•A hang up (ADC does not respond) will not be recognized without a watchdog
algorithm
•The polling algorithm requires five instruction cycles. Depending on when the
conversion finishes during these five instructions (when the INT
low), the time response after the falling edge can vary up to the five instruction
cycles. As experiments confirmed, this can result in a variation in the length
of the sampling window. So, a filter algorithm (eg. FFT) on the samples might
result in slightly different results for a steady (stable) input function, related
to the sampling time variations. The only way to prevent this is to control the
conversion with the on-chip timer of the DSP. Unfortunately, the maximum
throughput falls off with increased requirements for CPU power.
signal goes
8.4.1.2Timed Solution
How
long the ADC requires for conversion must be factored into the software flow.
In other words, the DSP has to wait a certain time between initializing the
conversion and reading the conversion result on the data bus from the ADC. This
timing is critical to the sampling device. If the conversion time of a data converter
changes (data sheet), the timing must be verified again.
Advantage:
•Fastest solution (with a fine tune, the maximum performance can be
extracted from the converter)
•Saves CPU power of the DSP (no time wasted for polling)
•Program can not hang up in an endless loop
•Less hardware required (input pin on the DSP and INT connection are left out)
Disadvantage:
•Every software variation changes timing and therefore, requires fine tuning
again. This can be avoided by using the DSP timer module, but since the
TLV1562 is an extremely fast device (2 MSPS at 10 bit), a timer module
solution becomes too slow.
•If the conversion time of the ADC varies for some reasons, this algorithm is
not able to respond; instead, the maximum conversion time is used.
24SLAA040
Loading...
+ 69 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.