Texas Instruments TLV1562 Application Report

Texas Instruments TLV1562 Application Report

Interfacing the parallel ad-converter to the tms320c54x dsp
Table of Contents

Advertisement

Quick Links

Interfacing the TLV1562
Parallel AD Converter to the
TMS320C54x DSP
July 1999
Application
Report
Advanced Analog Products
SLAA040

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the TLV1562 and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Summary of Contents for Texas Instruments TLV1562

  • Page 1 Interfacing the TLV1562 Parallel AD Converter to the TMS320C54x DSP Application Report July 1999 Advanced Analog Products SLAA040...
  • Page 2 IMPORTANT NOTICE Texas 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.
  • Page 3: Table Of Contents

    ............Interfacing the TLV1562 Parallel AD-Converter to the TMS320C54x DSP...
  • Page 4 Contents 8.5.5 Dual Continuous Mode ............8.5.6 C-Callable With Mono Interrupt Driven Mode Using CSTART to Start Conversion .
  • Page 5 Figures List of Figures 1 TLV1562 – DSP Interface of the EVM, Using RD or the CSTART Signal to Start Conversion ....2 TLV1562 – DSP Interface of the EVM, Using RD or the CSTART Signal to Start Conversion .
  • Page 6 SLAA040...
  • Page 7: Introduction

    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 TLV1562, 10-bit parallel-output analog-to-digital converter (ADC) to the TMS320C54x digital signal The hardware interface board, or evaluation module (EVM) processor (DSP).
  • Page 8: Tlv1562Evm

    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 (TLV1562) make this EVM flexible enough to test the features of the TLV1562. It also helps show how this ADC can be implemented.
  • Page 9: Recyclic Architecture

    The Board 2.3.1.2 Simplification of Software Requirements Through Modified Interface Of all the TLV1562 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.
  • Page 10: Note On The Interface, Using An External Adc Clock Drive

    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.
  • Page 11: Tlv5651 - Parallel Dac

    ). The data bus and the address decoder provide the interface to the DSP. Parallel DAC CLKOUT THS5651 TMS320C542 A(0–1) = 11 b D(0–9) D(0–9) Buffer Figure 4. THS5651 to C542 DSP Interface Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP...
  • Page 12: Operational Overview

    AV supply minus 1 V, or lower than 0.8 V. Other input restrictions apply so consult the TLV1562 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.
  • Page 13: Connections Between The Dsp And The Evm

    JP1/29 J11/15 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.
  • Page 14: Jumpers Used On The Tlv1562Evm

    Operational Overview 3.3.1 Jumpers Used on the TLV1562EVM Table 2. 3-Position Jumpers JUMPER GENERAL DESCRIPTION PIN 1-2 PIN 2-3 Connects BP/CH3 (ADC) to R45 or GND; Input not in use, grounded to reduce noise Use as single input channel3 or differential input positive channel B Connects BM/CH4 (ADC) to R44 or GND;...
  • Page 15: The Serial Dac/Dsp System

    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...
  • Page 16: The Dsp Serial Port

    The DSP Serial Port 5 The 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.
  • Page 17: Other Dsp/Tlv1562 Signals

    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. Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP...
  • Page 18: Conversation Between The Tlv1562 And The Dsp

    ’C54x to the ADC. 7.1 Writing 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.
  • Page 19: Dsp Algorithm For Mono Interrupt Driven Mode Using Rd

    7 Wait the time t = 41 ns EN(DATAOUT) EN(DATAOUT) Read sample out from the data port; Reset RD signal Goto step 1 or step 3 (if APD=0) for more samples Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP...
  • Page 20: Mono Interrupt Driven Mode Using Cstart

    Conversation Between the TLV1562 and the DSP 7.3 Mono 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 signal, the timing for sampling and converting is started with the edges of the CSTART signal.
  • Page 21: Dual Interrupt Driven Mode

    Start communication Wait the time t = 41 ns EN(DATAOUT) EN(DATAOUT) Read sample out from the data port; reset RD signal Set CS Deselect ADC Goto step 2 for the next samples Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP...
  • Page 22: Mono Continuous Mode

    Conversation Between the TLV1562 and the DSP 7.5 Mono 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 signal.
  • Page 23: Dual Continuous Mode

    (CONV1) (CONV1) step 7 and 8 to ensure 5(6) ADC- and 8 take at least 4 DSPSYSCLK, the SYSCLk calculation are 5(6)ADCSYSCLK minus 100ns Go to step 4 for more samples Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP...
  • Page 24: Software Overview

    Software Overview 8 Software Overview The software in this report shows how to use all modes of the TLV1562 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;...
  • Page 25: Memory Map

    Table 2 2000h data_loc_B + num_data_B Tables to Store Data Samples data_loc_C 27FFh Table 3 2800h data_loc_C + num_data_C External data_loc_D FFFFh Table 4 data_loc_D + num_data_D Figure 5. Memory Map Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP...
  • Page 26: Programming Strategies For The 'C54X, Explanations

    CPU power. Because of the high transfer rate of the TLV1562 ADC, the software code must be optimized to test the full 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.
  • Page 27: Data

    ; 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...
  • Page 28: Interrupt Latency

    Software Overview 8.3.7 Interrupt 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: 3 sysclk (goto IRQ vector) + 4sysclk (goto/dgoto) + 1 sysclk (fast return) = 8 instruction cycles...
  • Page 29: Enabling Software Modules (.If/.Elseif/.Endif)

    ADC to DSP. A high/low transition on the INT line of the TLV1562 informs the DSP that the ADC has completed the conversion. Optionally, the DSP can ignore the INT signal, initialize the conversion instead, wait for a defined time, and directly read the result out of the ADC.
  • Page 30 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.
  • Page 31 Depending on the custom requirements of data throughput, the program header also defines whether the samples will be stored into memory, sent serially out to the TLC5618A DAC, or sent in parallel to the TLV5651 CommsDAC. Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP...
  • Page 32: Switch Settings

    Software Overview Table 12. Switch Settings SWITCH DESCRIBTION Store the samples into DSP memory (location defined in constants.asm) SAVE_INTO_MEMORY Send the samples always to the serial DAC TLC5618A SEND_OUT_SERIAL Update always the parallel DAC with the last sample (DAC1) THS5651 SEND_OUT_PARALLEL Note: the 3 switches are independent from each other Use maximum resolution of 10 bit...
  • Page 33: Flow Charts And Comments For All Software Modes

    8.5.1 The Mono Interrupt Driven Mode Using RD to Start Conversion The following descriptions explain the software for the data acquisition in monomode. The required interface connections are shown in Figure 1. Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP...
  • Page 34 Software Overview Program Files: MONOIDM1.ASM includes the complete software algorithm to control the monomode CONSTANT.ASM common file of all modes (constants definition) common file of all modes (IRQ vector table) VECTORS.ASM Other Files: organization of the DSP memory (data and program memory) linker.cmd batch file to start the compiler for the monomode software auto.bat...
  • Page 35: Software Flow Of The Mono Interrupt Driven Solution

    Reset Actual Memory Pointer SEND_OUT_SERIAL = 0 if Send Register is Empty AR& = First Memory Store Location SAVE_INTO_MEMORY = 0 Figure 6. Software Flow of the Mono Interrupt Driven Solution Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP...
  • Page 36: Mono Interrupt Driven Mode Using Cstart To Start Conversion

    Software Overview 8.5.2 Mono Interrupt Driven Mode Using CSTART to Start Conversion The following descriptions explain the software for the data acquisition in monomode using the CSTART signal. The required interface connections are shown in Figure 1. Program Files: Includes the complete software algorithm to control the monomode MONOCST1.ASM Calibration procedure of the DAC CALIBRAT.ASM...
  • Page 37: Flow Chart Mono Interrupt Driven Mode Using Cstart To Start Conversion

    Reset Actual Memory Pointer if Send Register is Empty AR& = First Memory Store Location SAVE_INTO_MEMORY = 0 Figure 7. Flow Chart Mono Interrupt Driven Mode Using CSTART to Start Conversion Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP...
  • Page 38 A concern is that during conversion if any small spikes occurs on the CSTART signal while the ADC data is being read out onto the data bus, then the accuracy of the ADC quantized output data could be affected. This only works for one TLV1562 (not multiple) because CS is not used. SLAA040...
  • Page 39: Dual Interrupt Driven Mode

    The timing requirements to interface the ’C54x to the ADC are provided in Table 9. The STEP numbers given there can be found again as Marker in the code. This helps to debug and verify the code. Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP...
  • Page 40 Software Overview IMPORTANT NOTE: The code has been optimized to maximize the data throughput. It was found that CSTART can be pulled low earlier than the data read instruction is performed by the DSP. This saves the 100-ns wait time in STEP 3 because the data read requires at least 100 ns.
  • Page 41: Flow Chart Dual Interrupt Driven Mode (Using Cstart) To Start Conversion

    Reset Actual Memory Pointer AR7/7= First Memory Store Location SAVE_INTO_MEMORY = 0 AR7 = Data_Loc_A; AR6 = Data_Loc_B Figure 9. Flow Chart Dual Interrupt Driven Mode (Using CSTART) to Start Conversion Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP...
  • Page 42: Mono Continuous Mode

    Software Overview 8.5.4 Mono Continuous Mode The following descriptions explain the software for the data acquisition in Mono Continuous Mode. The required interface connections are shown in Figure 2 Program Files: Includes the complete software algorithm to control the Mono Continuous Mode MONOCON1.ASM Calibration procedure of the DAC CALIBRAT.ASM...
  • Page 43: Flow Chart Mono Continuous Mode

    SAVE_INTO_MEMORY = 0 Location = Data_Loc_A Wait 5(6) ADC Clock Cycles Started at Time Stamp t C(RD) = 800 ns (With 8 MHz ADC Clock) Figure 10. Flow Chart Mono Continuous Mode Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP...
  • Page 44: Dual Continuous Mode

    Software Overview 8.5.5 Dual Continuous Mode The following descriptions explain the software for data acquisition in dual continuous mode. The required interface connections are shown in Figure 2. Program Files: Includes the complete software algorithm to control the Dual Continuous Mode DUALCON1.ASM Calibration procedure of the DAC CALIBRAT.ASM...
  • Page 45: Flow Chart Dual Continuous Mode

    SAVE_INTO_MEMORY = 0 AR7= Data_Loc_A; AR6 = Data_LOc_B Wait 5(6) ADC Clock Cycles Started at Time Stamp = 800 ns (With 8 MHz ADC Clock) C(RD) Figure 11. Flow Chart Dual Continuous Mode Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP...
  • Page 46: C-Callable With Mono Interrupt Driven Mode Using Cstart To Start Conversion

    Software Overview 8.5.6 C-Callable with Mono Interrupt Driven Mode Using CSTART to Start Conversion The following descriptions explain the software for the data acquisition with a user friendly C program interface in monomode using the CSTART signal. The required interface connections are shown in Figure 2. Program Files: Includes the complete software in the C-layer C1562.ASM...
  • Page 47: Source Code

    .set 00020h ; Conversion clock selection is External CALIB_OP .set 00000h ; Operate with the calibrated inputs SYS_OFF_CALIB .set 00040h ; do a system offset calibration INT_OFF_CALIB .set 00080h ; do a internal offset calibration Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP...
  • Page 48 Software Overview NO_CALIB_OP .set 000C0h ; Operate without calibrated inputs (no offset) * INDEX MODE 1: NO_SW_PWDN .set 00100h ; Software power down mode disabled SW_PWDN .set 00101h ; instruction for software power down NO_AUTO_PWDN .set 00100h ; Automatic internal power–down Disabled AUTO_PWDN .set 00102h ;...
  • Page 49 ;0C–3F: vectors for software interrupts 18–30 int0 return_fast ;come out of the IDLE goto IRQ_INT0 ;40; external interrupt int0 int1 return_enable ;44; external interrupt int1 int2 return_enable ;48; external interrupt int2 Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP...
  • Page 50 Software Overview tint return_enable ;4C; internal timer interrupt brint return_enable ;50; BSP receive interrupt bxint goto BXINT0 ;54; BSP transmit interrupt trint goto trint ;58; TDM receive interrupt txint return_enable ;5C; TDM transmit interrupt int3 return_enable ;60; external interrupt int3 hpiint goto hpiint ;64;...
  • Page 51 Mono Continuous Mode: /******************************************************************/ /* File: Linker.lnk COMMAND FILE .title ”COMMAND FILE FOR TLV1562.ASM” /* This CMD file allocates the memory area for the TLV1562 /* interface Program /******************************************************************/ –stack 0x0080 –M monocon1.MAP –O monocon1.OUT...
  • Page 52: Mono Mode Interrupt Driven Software Using Rd To Start Conversion

    Software Overview 8.6.2 Mono Mode Interrupt Driven Software Using RD to Start Conversion Mainprogram (Monomode.asm) ************************************************************************** * TITLE : TLV1562 ADC Interface routine * FILE : MONOIDM1.ASM * FUNCTION : MAIN * PROTOTYPE : void MAIN () * CALLS : SERIAL_DAC_INI() initialzation of the BSPI/serial DAC...
  • Page 53 ; use differential mode instead of single ended inputs .sect ”.text” _MAIN: START: INITIALIZATION: * disable IRQ, sign extension mode, ini Stack INTM ; disable IRQ ; no sign extension mode = #0280h ; initialize Stack pointer Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP...
  • Page 54 Software Overview * initialize waitstates: = #00000h ; point to page zero @SWWSR = #01000h ; one I/O wait states * copy interrupt routine, which are not critical for the EVM to the IRQ table location: * this is required for the DSKplus kit but has to be changed on other platforms = #1 ;...
  • Page 55 ; clear bit for 10–Bit Resolution @CR1_SEND |= #RES_4_BIT ; set 8–Bit conversion mode .endif .if (EXTERNAL_CLOCK) @CR0_SEND ^= #CLK_INTERNAL ; clear CLK_INTERNAL bit if one @CR0_SEND |= #CLK_EXTERNAL ; set CLK_EXTERNAL mode .endif Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP...
  • Page 56 Software Overview .if (AUTO_PWDN_ENABLE) @CR1_SEND ^= #NO_AUTO_PWDN ; clear NO_AUTO_PWDN bit if one @CR1_SEND |= #AUTO_PWDN ; set AUTO_PWDN mode .endif .if (DIFF_INPUT_MODE) @CR0_SEND ^= #SINGLE_END ; clear single ended input bit if one @CR0_SEND |= #DIFFERENTIAL ; set differential input mode .endif **************************** * ADC_INI:...
  • Page 57 .if SAVE_INTO_MEMORY * store new sample into DSP data memory *AR7+ = data(@ADSAMPLE) ; write last sample into memory table .endif .if SEND_OUT_SERIAL * store sample into the serial buffer location Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP...
  • Page 58 Software Overview = #00000h ; point to page zero = bitf(@SPC,#01000h) ; test, is the XRDY Bit in SPC=1? if (TC) goto SEND_SERIAL_END ; don’t send something until XDR is empty ; this has been included because the serial DAC TLC5618A is not able to understand ;...
  • Page 59: Calibration Of The Adc

    * initialize the send values to setup the two programmable registers of the ADC to calibrate data(CR_CALIBRA) = @CR0_SEND ; load help register with CR0 content * use calibrated mode in the following for conversion @CR0_SEND |= #CALIB_OP ; set calibration for further use Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP...
  • Page 60 Software Overview * clear mode related bits in CR0 and set MONO_INT: @CR0_SEND &= #(MONO_INT^0FFFFh) ; clear bit for no calibration use @CR0_SEND &= #(DUAL_INT^0FFFFh) ; clear bit for no calibration use @CR0_SEND &= #(MONO_CONTINUOUS^0FFFFh); clear bit for no calibration use @CR0_SEND &= #(DUAL_CONTINUOUS^0FFFFh);...
  • Page 61 ; clear bit for no calibration use * initialize the send values to setup the two programmable registers of the ADC to calibrate data(CR_CALIBRA) = @CR0_SEND ; load help register with CR0 content Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP...
  • Page 62 Software Overview * use calibrated mode in the following for conversion @CR0_SEND |= #CALIB_OP ; set calibration for further use * clear mode related bits in CR_CALIBRA and set MONO_INT: @CR_CALIBRA &= #(MONO_INT^0FFFFh) ; clear bit for no calibration use @CR_CALIBRA &= #(DUAL_INT^0FFFFh) ;...
  • Page 63 * write CR0 port(ADC) = @CR0_SEND ; send CR0 value to the ADC port(DEACTIVE) = @ZERO ; deselect ADC (CS high) ; wait for tW(CSH)=50ns return ; return from call .endif .endif Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP...
  • Page 64: Mono Mode Interrupt Driven Software Using Cstart To Start Conversion

    Software Overview 8.6.4 Mono Mode Interrupt Driven Software Using CSTART to Start Conversion Mainprogram (Monomode.asm) ************************************************************************** * TITLE : TLV1562 ADC Interface routine * FILE : MONOCST1.ASM * FUNCTION : MAIN * PROTOTYPE : void MAIN () * CALLS : N/A...
  • Page 65 ; use differential mode instead of single ended inputs IME_CALIBRATION .set 00000h ; do an Internal Midscale Error Calibration SME_CALIBRATION .set 00000h ; do a System Midscale Error Calibration .sect ”.text” Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP...
  • Page 66 Software Overview _MAIN: START: INITIALIZATION: * disable IRQ, sign extension mode, ini Stack INTM ; disable IRQ ; no sign extension mode = #0280h ; initialize Stack pointer * initialize waitstates: = #00000h ; point to page zero @SWWSR = #01000h ;...
  • Page 67 * this next steps can be erased, if the user is running in only one special configuration .if (R8BIT_RESOLUT) @CR1_SEND ^= #RES_10_BIT ; clear bit for 10–Bit Resolution @CR1_SEND |= #RES_8_BIT ; set 8–Bit conversion mode Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP...
  • Page 68 Software Overview .elseif (R4BIT_RESOLUT) @CR1_SEND ^= #RES_10_BIT ; clear bit for 10–Bit Resolution @CR1_SEND |= #RES_4_BIT ; set 8–Bit conversion mode .endif .if (EXTERNAL_CLOCK) @CR0_SEND ^= #CLK_INTERNAL ; clear CLK_INTERNAL bit if one @CR0_SEND |= #CLK_EXTERNAL ; set CLK_EXTERNAL mode .endif .if (AUTO_PWDN_ENABLE) @CR1_SEND ^= #NO_AUTO_PWDN...
  • Page 69 ; read the new sample into the DSP .if (AUTO_PWDN) * wait 800ns before finishing the sampling (requirment in Auto power down mode) repeat(#24) ; wait for 20 clock cycles [t(APDR)=500ns] .endif Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP...
  • Page 70 Software Overview STEP4: XF ; wait for TW(CSTARTL) and set CSTART call STORE ; store the last sample into the table .if INT0_DRIVEN return ; return from routine back to IRQ_INT0 .else goto STEP5 ; go back to receive next sample .endif ********************************** * STORE:...
  • Page 71 ; return from IRQ (wake up from the IDLE mode) ************************************************************************** * BXINT0: Interrupt routine of the serial transmit interrupt of the buffered SPI ************************************************************************** BXINT0: return_enable ; interrupt is not in use .sect ”.text” .copy ”calibrat.asm” .end Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP...
  • Page 72: Dual Interrupt Driven Mode

    Constants definition – see 8.6.1.1 Constants.asm Interrupt Routine handler – see 8.6.1.2 Interrupt Vectors 8.6.5 Dual Interrupt Driven Mode Mainprogram (DUALIRQ1.asm) ************************************************************************** * TITLE : TLV1562 ADC Interface routine * FILE : DUALIRQ1.ASM * FUNCTION : MAIN * PROTOTYPE : void MAIN ()
  • Page 73 00000h ; do an Internal Midscale Error Calibration SME_CALIBRATION .set 00000h ; do a System Midscale Error Calibration .sect ”.text” _MAIN: START: INITIALIZATION: * disable IRQ, sign extension mode, ini Stack Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP...
  • Page 74 Software Overview INTM ; disable IRQ ; no sign extension mode = #0280h ; initialize Stack pointer * initialize waitstates: = #00000h ; point to page zero @SWWSR = #01000h ; one I/O wait states * copy interrupt routine, which are uncritical by the EVM to the IRQ table location: * this is required for the DSKplus kit but has to be changed on other platforms = #1 ;...
  • Page 75 ; clear bit for 10–Bit Resolution @CR1_SEND |= #RES_8_BIT ; set 8–Bit conversion mode .elseif (R4BIT_RESOLUT) @CR1_SEND ^= #RES_10_BIT ; clear bit for 10–Bit Resolution @CR1_SEND |= #RES_4_BIT ; set 8–Bit conversion mode .endif Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP...
  • Page 76 Software Overview .if (EXTERNAL_CLOCK) @CR0_SEND ^= #CLK_INTERNAL ; clear CLK_INTERNAL bit if one @CR0_SEND |= #CLK_EXTERNAL ; set CLK_EXTERNAL mode .endif .if (AUTO_PWDN_ENABLE) @CR1_SEND ^= #NO_AUTO_PWDN ; clear NO_AUTO_PWDN bit if one @CR1_SEND |= #AUTO_PWDN ; set AUTO_PWDN mode .endif .if (DIFF_INPUT_MODE) @CR0_SEND ^= #SINGLE_END ;...
  • Page 77 ; the user software could do something else here goto USER_MAIN .elseif NO_INT0_SIG * instead of using the INT signal, the processor waits * for 6ADCSYSCLK+49ns and reads then the sample repeat(#32) ; wait for 34 processor cycles .endif Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP...
  • Page 78 Software Overview * read sample STEP2: XF ; clear CSTART STEP10: @CH1_ADSAMPLE = port(ADC) ; read the new sample into the DSP STEP14: @CH2_ADSAMPLE = port(ADC) ; read the new sample into the DSP STEP3: ; wait for TW(CSTARTL) .if (AUTO_PWDN_ENABLE) * wait 800ns before finishing the sampling (requirment in Auto power down mode) repeat(#38) ;...
  • Page 79 ; return from IRQ (wake up from the IDLE mode) ************************************************************************** * BXINT0: Interrupt routine of the serial transmit interrupt of the buffered SPI ************************************************************************** BXINT0: return_enable ; interrupt is not in use .sect ”.text” .copy ”calibrat.asm” .end Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP...
  • Page 80: Mono Continuous Mode

    Constants definition – see 8.6.1.1 Constants.asm Interrupt Routine handler – see 8.6.1.2 Interrupt Vectors 8.6.6 Mono Continuous Mode Mainprogram (MONOCON1.asm) ************************************************************************** * TITLE : TLV1562 ADC Interface routine * FILE : MONOCON1.ASM * FUNCTION : MAIN * PROTOTYPE : void MAIN ()
  • Page 81 = #00240h repeat(#35) data(00C0h) = *AR7+ ; copy INT0, INT1,... * clear all memory locations of the sampling table (table, where the samples will be stored) = #AD_DP @TEMP = #00000h repeat(#num_data_A–1) Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP...
  • Page 82 Software Overview data(data_loc_A) = @TEMP ; fill memory table 1 repeat(#num_data_B–1) data(data_loc_B) = @TEMP ; fill memory table 2 repeat(#num_data_C–1) data(data_loc_C) = @TEMP ; fill memory table 3 repeat(#num_data_D–1) data(data_loc_D) = @TEMP ; fill memory table 4 .if SEND_OUT_SERIAL ****************************************************************************** * SERIAL_DAC_INI: initialize the serial interface to send out the samples for the serial DAC set up the serial interface for a DSP–DAC (5618A) conversation...
  • Page 83 STEP1: port(DEACTIVE) = @ZERO ; deselect ADC (CS high) STEP2: NOP ; wait for t(SAMPLE1)=100ns * initialize longer waitstates: = #00000h ; point to page zero @SWWSR = #07000h ; one I/O wait states Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP...
  • Page 84 Software Overview = #AD_DP ******************************************* * ADC_mono_con_Start: read samples and store them into memory ******************************************* ADC_mono_con_Start: repeat(#12) ; wait for t(SAMPLES) (450ns) STEP6: @ADSAMPLE = port(ADC) ; read the new sample into the DSP * IMPORTANT: fine–tune the counter number of the next repeat loop in order * to achive maximum throughput related to the delay of the store instructions STEP7: repeat(#7) ;...
  • Page 85 ; interrupt is not in use ************************************************************************** * BXINT0: Interrupt routine of the serial transmit interrupt of the buffered SPI ************************************************************************** BXINT0: return_enable ; interrupt is not in use .sect ”.text” .copy ”calibrat.asm” .end Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP...
  • Page 86: Dual Continuous Mode

    Constants definition – see 8.6.1.1 Constants.asm Interrupt Routine handler – see 8.6.1.2 Interrupt Vectors 8.6.7 Dual Continuous Mode Mainprogram (DUALCON1.asm) ************************************************************************** * TITLE : TLV1562 ADC Interface routine * FILE : DUALCON1.ASM * FUNCTION : MAIN * PROTOTYPE : void MAIN ()
  • Page 87 = #00240h repeat(#35) data(00C0h) = *AR7+ ; copy INT0, INT1,... * clear all memory locations of the sampling table (table, where the samples will be stored) = #AD_DP @TEMP = #00000h Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP...
  • Page 88 Software Overview repeat(#num_data_A–1) data(data_loc_A) = @TEMP ; fill memory table 1 repeat(#num_data_B–1) data(data_loc_B) = @TEMP ; fill memory table 2 repeat(#num_data_C–1) data(data_loc_C) = @TEMP ; fill memory table 3 repeat(#num_data_D–1) data(data_loc_D) = @TEMP ; fill memory table 4 .if SEND_OUT_SERIAL ****************************************************************************** * SERIAL_DAC_INI: initialize the serial interface to send out the samples for the serial DAC...
  • Page 89 ; send CR0 value to the ADC STEP1: port(DEACTIVE) = @ZERO ; deselect ADC (CS high) STEP2: NOP ; wait for t(SAMPLE1)=100ns * initialize longer waitstates: = #00000h ; point to page zero Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP...
  • Page 90 Software Overview @SWWSR = #07000h ; one I/O wait states = #AD_DP ******************************************* * ADC_dual_con_Start: read samples and store them into memory ******************************************* ADC_dual_con_Start: repeat(#12) ; wait for t(SAMPLES) (450ns) STEP6: @CH1_ADSAMPLE = port(ADC) ; read the new sample into the DSP STEP7: repeat(#20) ;...
  • Page 91 ; interrupt is not in use ************************************************************************** * BXINT0: Interrupt routine of the serial transmit interrupt of the buffered SPI ************************************************************************** BXINT0: return_enable ; interrupt is not in use .sect ”.text” .copy ”calibrat.asm” .end Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP...
  • Page 92: C-Callable

    /* This file will select the parameters to allow a C–call of the ADC sampling */ extern void TLV1562(int, int, int); main() TLV1562(Channel, Save Memory Start address, NUMBER_OF_SAMPLES); */ TLV1562(1, 0x2000, 0x0080); /* 80h samples of channel 1 will be stored beginning on 2000h */ TLV1562(2, 0x2100, 0x0080);...
  • Page 93 = #0 ; do DP pointer addressing * sign extension mode, ini Stack ; no sign extension mode * reset pending IRQs = #1 ; reset any old interrupt on pin INT0 Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP...
  • Page 94 Software Overview * initialize storage table for the ADC samples = #AD_DP += #–1 ; decrement A @CH_NO = A ; read number of sampling channel = @ADMEM ; point to first date location of the storage table = @ADCOUNT ;...
  • Page 95 Interrupt routine of the external interrupt input pin INT0 ************************************************************** IRQ_INT0: return_enable ; return from IRQ (wake up from the IDLE mode) ************************************************************************** * BXINT0: Interrupt routine of the serial transmit interrupt of the buffered SPI ************************************************************************** Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP...
  • Page 96 Software Overview BXINT0: return_enable ; interrupt is not in use .end Vectors.asm ************************************************************************** * TITLE : TLV1562 ADC Interface routine * FILE : VECTORS.ASM * FUNCTION : N/A * PROTOTYPE : N/A * CALLS : N/A * PRECONDITION : N/A * POSTCONDITION : N/A * SPECIAL COND.
  • Page 97 ;58; TDM receive interrupt txint return_enable ;5C; TDM transmit interrupt int3 return_enable ;60; external interrupt int3 hpiint goto hpiint ;64; HPIint * DO NOT MODIFY IF USING DEBUGGER * .space 24*16 ;68–7F; reserved area Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP...
  • Page 98 –l –mg –q –s pause lnk500 linker.cmd Linker.cmd /******************************************************************/ /* File: Linker.lnk COMMAND FILE .title ”COMMAND FILE FOR TLV1562.ASM” /* This CMD file allocates the memory area for the TLV1562 /* interface Program /******************************************************************/ –stack 0x0080 –M asm1562.MAP –O asm1562.OUT –v0 –c –l rts.lib...
  • Page 99: Summary

    TMS320C54x Optimizing C Compiler, Literature number SPRU103B TMS320C54x Assembly Language Tools, Literature number SPRU102B TMS320C54x DSKplus DSP Starter Kit, Literature number SPRU191 TLV1544 Data Sheet, Literature number SLAS139 TMS320C54x DSK plus Adapter Kit, Literature number SLAU030 Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP...

Table of Contents