Texas Instruments TLV1562 manual Software Overview, sent value to register CR0 of the ADC

Page 53

 

 

Software Overview

CR0_SEND

.usect ”.variabl”, 1

; sent value to register CR0 of the ADC

CR1_SEND

.usect ”.variabl”, 1

; sent value to register CR1 of the ADC

ZERO

.usect ”.variabl”, 1

; the value zero to send a ”Zero Dummy”

ADSAMPLE

.usect ”.variabl”, 1

; last read sample from the ADC

* TLC5618 conversation

 

SERIAL_SEND

.usect ”.variabl”, 1

; serial output send word

* other

 

 

TEMP

.usect ”.variabl”, 1

; temporary variable, can be changed anywhere during

 

 

; the program

* Address Decoder constants:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

CSTART

 

 

.set

00001h

; activate A1 when CSTART is choosen

ADC

 

 

.set

00002h

; activate A2 when TLV1562 is choosen

DAC1

 

 

.set

00003h

; activate A3 when DAC1 is choosen

DEACTIV

 

 

.set

00000h

; deactivate the address lines A0, A1 and A2

* set timing mode (use od IRQ, or timer)

 

 

 

 

 

 

 

 

 

POLLING_DRV

 

.set

00001h

; software polls the INT0 pin to wait, until conversion

is done

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

INT0_DRIVEN

 

.set

00000h

; software uses Interrupt INT0 to organize conversion

NO_INT0_SIG

 

.set

00000h

; INT0 signal not in use, interface is controlled with

timing solution

 

 

 

 

 

 

 

 

SAVE_INTO_MEMORY .set

00001h

; store the samples into DSP memory, defined in

”constants.asm”

 

 

 

 

 

 

 

 

SEND_OUT_SERIAL .set

00000h

; send the samples always to the serial DAC

SEND_OUT_PARALLEL .set 00001h

; update always the parallel DAC with the last sample

 

 

 

 

 

(DAC1)

R10BIT_RESOLUT

 

.set

00001h

; use maximum resolution of 10-bit

R8BIT_RESOLUT

 

.set

00000h

; use 8-bit resolution

R4BIT_RESOLUT

 

.set

00000h

; use fastest mode (4-bit resolution)

INTERNAL_CLOCK

 

.set

00001h

; use the internal clock of the ADC

EXTERNAL_CLOCK

 

.set

00000h

; use the external clock of the ADC

AUTO_PWDN_ENABLE .set

00000h

; ADC goes into power reduced state after conversion

DIFF_INPUT_MODE .set

00001h

; use differential mode instead of single ended inputs

.sect ”.text”

 

 

 

 

 

 

 

 

_MAIN:

 

 

 

 

 

 

 

 

 

 

START:

 

 

 

 

 

 

 

 

 

 

INITIALIZATION:

 

 

 

 

 

 

 

 

* disable IRQ, sign extension mode, ini Stack

 

INTM

=

1

; disable IRQ

 

SXM

=

0

; no sign extension mode

;

SP

= #0280h

; initialize Stack pointer

Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP

47

Image 53
Contents SLAA040 JulyApplication Report TParalInteMS3rflelADConvertertotheacing20C54xDSPtheTLV1562IMPORTANT NOTICE Contents 8.5.5 Figures List of FiguresList of Tables viSLAA040 1 Introduction Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP2 The Board 2.1 TMS320C54x Starter Kit2.3 ADC TLV1562 Overview 2.2 TLV1562EVM2.3.1 Suggestions for the ’C54x to TLV1562 Interface 2.3.1.1 The Universal InterfaceFigure 2. TLV1562 to ’C54x DSP Interface of the EVM Using RD or the CSTART Signal to Start Conversion2.3.2 Recyclic Architecture 2.4.1 TLC5618A - Serial DAC 2.3.3 Note on the Interface, Using an External ADC Clock Drive2.4 Onboard Components Figure 4. THS5651 to C542 DSP Interface 2.4.2 THS5651 - Parallel Output CommsDACFigure 3. TLC5618A to ’C542 DSP Interface 3.2 Input Data Bits 3 Operational Overview3.1 Reference Voltage Inputs 3.3 Connections Between the DSP and the EVM Table 1. Signal ConnectionsTable 2. 3-Position Jumpers 3.3.1 Jumpers Used on the TLV1562EVMTable 3. 2-Position Jumpers 8SLAA040Table 4. DSP/DAC Interconnection 4 The Serial DAC/DSP System5 The DSP Serial Port Table 5. DSP Serial Port Signals and Registers6.1 DSP Internal Serial Port Operation 6 Other DSP/TLV1562 Signals7 Conversation Between the TLV1562 and the DSP 7.2 Mono Interrupt Driven Mode Using RD7.1 Writing to the ADC Table 6. DSP Algorithm for Writing to the ADCtENDATAOUT = 41 ns Table 7. DSP Algorithm for Mono Interrupt Driven Mode Using RDtDCSL-sample+1ADCSYSCLK 14 SLAA040 7.3 Mono Interrupt Driven Mode Using CSTARTTable 8. DSP Algorithm for Mono Interrupt Driven Mode Using CSTART Table 9. DSP Algorithm for Dual Interrupt Driven Mode 7.4 Dual Interrupt Driven Mode16 SLAA040 7.5 Mono Continuous ModeTable 10. DSP Algorithm for Mono Continuous Mode Table 11. DSP Algorithm for Dual Continuous Mode 7.6 Dual Continuous Mode8.2 DSP Memory Map 8 Software Overview8.1 Software Development tools Figure 5. Memory Map 8.3 Programming Strategies for the ’C54x, Explanations 8.3.3 Timer Output8.3.1 Optimizing CPU Resources for Maximum Data Rates 8.3.2 Address and Data Bus for I/O Tasks8.3.6 Interfacing the Serial DAC 5618A to the DSP 8.3.5 Generating the Chip Select Signal and the CSTART Signal8.3.4 Data Page Pointer 8.3.8 Branch Optimization goto/dgoto, call/dcall 8.3.7 Interrupt LatencyGOTO MARK MARK DP = #1 ARP = #58.4.1 Software Principals of the Interface 8.3.9 Enabling Software Modules .if/.elseif/.endif8.4 Software Code Explanation 8.4.1.1 Software Polling 8.4.1.2 Timed SolutionAdvantage Disadvantage8.4.1.5 Setting the Right Switches 8.4.1.3 Interrupt Driven SolutionAdvantages DisadvantagesTable 13. Instruction in the Program Header Step Table 12. Switch SettingsTask 8.5.1 The Mono Interrupt Driven Mode Using RD to Start Conversion 8.5 Flow Charts and Comments for All Software ModesTable 14. Instruction in the Program Header Step 8.4.1.6 Common Software for all ModesOther Files Program FilesCode verification common file of all modes constants definitionFigure 6. Software Flow of the Mono Interrupt Driven Solution Calibration procedure of the DAC 8.5.2 Mono Interrupt Driven Mode Using CSTART to Start ConversionIncludes the complete software algorithm to control the monomode Common file of all modes constants definitionSAVE Initialize SPIPoll INTO Pin Until h/0 Transition Occurs Pull Down CSTARTThis only works for one TLV1562 not multiple because CS is not used 8.5.2.1 Throughput Optimization†Maximum Performance at 1.2 MSPS with Internal Clock 8.5.3 Dual Interrupt Driven ModeFigure 8. Time Optimization monocst1 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. Therefore, CSTART gets pulled high directly after data read, and the interface becomes faster and gains throughput. This variation will be found in the code. The data acquisition is done in a small number of steps that explains everything inside the code Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP 8.5.4 Mono Continuous Mode Figure 10. Flow Chart Mono Continuous Mode 8.5.5 Dual Continuous Mode Figure 11. Flow Chart Dual Continuous Mode Code verification 8.6.1.1 Constants.asm 8.6 Source Code8.6.1 Common Software for all Modes except C-Callable 42 SLAA040 set 000C0h Operate without calibrated inputs no offset8.6.1.2 Interrupt Vectors 44 SLAA040 4C internal timer interrupt8.6.1.4 Auto.bat 8.6.1.3 linker,cmdFile Linker.lnk COMMAND FILE title ”COMMAND FILE FOR TLV1562.ASM”pointer address when using any of the following variables Mainprogram Monomode.asmjump address to init. new channel counter for one channelsent value to register CR0 of the ADC 48 SLAA040 if SENDOUTSERIALendif if INT0DRIVENPOLLINGDRV endif endif if DIFFINPUTMODE if AUTOPWDNENABLE= bit*AR5,15-0 elseif INT0DRIVENelseif NOINT0SIG 52 SLAA040 CALIBRAT.ASM 8.6.3 Calibration of the ADC54 SLAA040 if SMECALIBRATION 56 SLAA040 endif 58 SLAA040 Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP 60 SLAA040 if INT0DRIVENPOLLINGDRV 62 SLAA040 = bit*AR5,15-0 64 SLAA040 endif if SAVEINTOMEMORYInterfacing the TLV1562 Parallel ADC to the TMS320C54x DSP Constants definition - see 8.6.1.1 Constants.asm 8.6.5 Dual Interrupt Driven ModeInterrupt Routine handler - see 8.6.1.2 Interrupt Vectors Mainprogram DUALIRQ1.asmInterfacing the TLV1562 Parallel ADC to the TMS320C54x DSP Software Overviewif SENDOUTSERIAL Software OverviewInterfacing the TLV1562 Parallel ADC to the TMS320C54x DSP 70 SLAA040 Software Overview 72 SLAA040 endif 74 SLAA040 8.6.6 Mono Continuous ModeMainprogram MONOCON1.asm Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP 76 SLAA040 endif if EXTERNALCLOCK 78 SLAA040 endif if SAVEINTOMEMORY 80 SLAA040 8.6.7 Dual Continuous ModeMainprogram DUALCON1.asm Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP 82 SLAA040 endif if EXTERNALCLOCK 84 SLAA040 Interfacing the TLV1562 Parallel ADC to the TMS320C54x DSP Mainprogram C1562.c 8.6.8 C-CallableTLV1562Channel, Save Memory Start address, NUMBEROFSAMPLES 80h samples of channel 1 will be stored beginning on 2000hInterfacing the TLV1562 Parallel ADC to the TMS320C54x DSP 88 SLAA040 AR7+ = data@ADSAMPLE 90 SLAA040 Vectors.asmint2 returnenable 48 external interrupt int2 nop 92 SLAA040 Auto.batLinker.cmd 10 References 9 Summary