Home
"TMS320C3x DSP Starter Kit User's Guide"
Contents
1. 5 000 TLC32040CFN 3 3500 Oo oo0o0o00 000 4 3 2000 ooo0o0000000000000 oo0o0o000 0O W 00000000 3 2000 5 Canann gt _ oo 2 5820 O Bes d B oe og e B Sel ene ed d E ds 2 1250 9 E 99 N ae d O 1 6560 od C M 3 5000 O o 9 o pauiatarrara rm C og aE o o E de de o olf E S o o q og o_o E 8 Hs og oo 1 0750 0 7300 D Lite p O O ec a Oo 00 0 0 0500 a 0 0000 APP DEEP ere eee 0 0000 0 1500 Y 4 7000 4 9000 SUOISUBWIG pJeog JINDND Hardware Component Overview B 1 Hardware Component Overview This section describes the basic functions of the DSK components LJ Expansion connectors The four 32 pin headers allow you to develop add on cards that can directly interface to all of the C31 signals Jumper block header An 11 pin jumper block connects the C31 serial port to the TLC32040 AIC Removal of the jumpers disconnects the AIC from the C31 serial port so that a daughtercard can use the serial port si
2. Jo 3eeus 9eecT 7T Trad e3ed v L 009a v ow ZHWOS TA ATA x quny a3ueunoodg ezrs ee S5 dN5 LIM SHELHWLS ASA XEDOZESHL Bm G ano ON F x eTatL Le EE ee 8 T SLNEWOULSNI SYXAL Sn v V 22A 22A TSA NNOOTH CPE l EE lt WATE TEE Tez 7oTv Ire ola OTA E Zsa o ok Bb P core Ercorbe nwatH ooA af agagap te i EFEREREBER agauguaaugamgaguagmgauamgaumguatgd C NNOOEH E PPa a 8 SZ 1 I ojelg elsislelzie zirle zlolglals rle elolsizi9ls rle rielate t 8888 T e8zzzLzZLL9999j5959s issssirvjrvirvrvvvEE E pu DI DG IL DD IIT dW 2W dW IgOW LZ Sai x Ei adddadaaddaaddddaddaddddd WO10H vaioH 7 LNadoH 68 IOH 3 ow NAGH zeg Edu Z IV HHLS ced guns B zw M A M a ew iasa teg LASHA vv OX Se 0dX Sv TAX se 4X 9v LY XOWI XYI 8 DoINT 664 OINI 6v TINI OOT TINT orv ZINI told ZINI TTY CEINT 2910 EINI TEDOZESHL ZIY TV Od aor oxa va PIY OAST oxsa STU OANT oH ODIO 9I OXN IO FT OXNIO Ll OXSA Err 0X84 STY oxa oxa 6T OSIOI S gv att owIOL ozv TX IOL TATL Tew vod cet eee Enna cana ecw zona eel ZONT SET EEN Loana T per PONE qaaaaaaaaadaaaaaaadad sssssssssssssssssssssssss raw cet TAWS Cadqaqdqaddaddadadadadad SSSSSSSSSSSSSSSSSSSSSSSSS AAAAAAAAAAAAAAAAAAAA AKAARAAAARAARAARAARAAARAAAA aot uot XOT XOT MOT wot MoT XOT 6H su gt LH IAY GUD FA
3. HEADER 16X2 i GND UBOOT HPACK USERR USERW USERX SRAM GND GND V VCC VCC Ve GND vec HEADER 16X2 H3EMU RESET RDY and INT2 are driven by the host interface and should not be driven by external signals Most signals at the expansion headers are unbuffered When building external circuits which will use these signals care should be taken to meet all I O requirements and timings to ensure proper circuit operation and avoid damage HEADER 6X2 GND GND TEXAS INSTRUMENTS Title TMS320C3x DSP STARTERS KIT Size Document Number REV A D600337 A Date March 21 1996 Sheet 6 of 6 B 10 Host Interface Control Design Notes Host Interface Control Design Notes TI DWG ASS PAL COM ENG LE NAME Y PANY R DA m HOST 7 WAHGUH 7 DESIGN NOTES INTERFACE CONTROL 96 S320C3X DSK 600335 0001 EXAS INSTRUMENTS INCORPORATED EITH LARSON he power consumption of the TMS320C31 DSK was considerably lowered by the use of a CMOS TIBPAL22V10Z When clocked at 25MHz H1 rate the TIBPAL22V10Z typicaly consumes 40mA 80mA max as compared to 200mA for bipolar PAL devices If lower consumption is needed the TMS320C31 can be programmed to use the LOPOWE
4. ldi ARO IRO R6 ldi AR1 IRO R7 f ldi Q ARO ARO ldi AR1 AR1 ldi _AR2 AR2 ldi Q AR3 AR3 ldi AR4 AR4 ldi AR5 AR5 ldi Q AR6 AR6 ldi Q AR7 AR7 ldi Q IRO IRO ldi Q TR1 IR1 or IF IF ldi 8 IOF IOF ldi G RS RS ldi _RE RE ldi RC RC ldi _BK BK ldi Q SP SP F ldi Q PC R5 andn 0x4 IF tstb 4 IF bnz 3 ldiu _ST ST or IE IE BUD R5 or 2000h ST ldiu Q0 R5 R5 ldiu DP DP load ARx CPU interrupt flags IO flags Repeat start Repeat end Repeat counter Block size get user SP return to PC from TOS return Clear Poll INT2 before SSTEP or RUNF restore Status turn on restore INTS DP XHALT H When called t for quick returns from the XWRIT context save his function restores th E XR EAD followed by waiting for a temporary use registers used before falling into a full new command XHALT A 4 pop pop pop pop pop pop AR1 ARO IRL RO DP ST f restore User PC original registers before sav now at TOS Communications Kernel Source Code SSIEP H H This section of code is executed after the pending interrupt which was set in XSTEP has feteched the ISR vector and begun execution This code performs a full CPU context save before going to the spin H loop to await f
5. OC Automatically search for a printer port TEST option Use the test option to systematically search for a parallel port that has a DSK connected The search loops through LPT1 LPT2 and LPT3 CCN Note If you have a printer port or other peripheral connected to your PC turn it off before using the test option LILL J Using the DSK Debugger 7 3 Understanding the Debugger Windows 7 2 Understanding the Debugger Windows DISASSEMBLY window The DISASSEMBLY window shows the reverse assembly of memory con tents As shown in Figure 7 1 this window displays several lines of code Eachline showsthe instruction address instruction opcode label and instruc tion mnemonic The highlighted line corresponds to the next instruction to be executed Figure 7 1 DISASSEMBLY Window Instruction address 809c03 809c04 809c05 809c06 809c07 809c08 809c09 809c0a 809c0b 809c0c 809c0d 809c0e 809cOf 809c10 809c11 Instruction opcode Label Instruction mnemonic DISASSEMBLY 50700080 start LDIU 00080h DP 08349c2c LDI 09c2cH SP 07608000 LDF 0 000000e 00 R0 c610c1c0 LDI ARO RO LDI AR c610c1c0 LDI ARO RO LDI AR 08600100 LDI 256 R0 09a09c00 LSH 09c00H RO 61809c0e BRD jump 07618000 LDF 0 000000e 00 R1 07628000 LDF 0 000000e 00 R2 07630000 LDF 1 000000e 00 R3 0764
6. 4 4 1N4002 T GND D4 1 2 1 i K MNE 1N4002 c14 C17 2 3 v 13 b C15 C16 f C18 C19 D5 R1 FB SD osc x 4 12 4 7UF 4 7UF 1N5817 R5 19 cap VREF x 1UF 1UF 1UF 1UF 10 a C20 un casr vour ii VI G VO IV 4 7UF N 2 N 3 D plane LT1054DW wee 5 U3 LM7905 J1 F1 DJOO5A GND o N o 1f6 3 0 75A X PTOL 4 The circuit board heat spreading pads under the 2 regulators are connected to ground LM7805 and floating LM 7905 F2 o N Jo 5 Circuit breakers Fl and F2 are designed to 0 75A protect against excessive current draw PTC2 They will thermally reset after power is NOTES 1 Input Power Requirements 7 12VDC or 6 9VAC gt 500mA UL CLASS II ONLY disconnected 6 R44 and R45 H1 and H3 clock signals are not installed 2 To minimize heating in the power supply components it is recommended that the external current on any supply Should not exceed 50mA by using a lower supply voltage or by heatsinking the regulator 3 The heatsink tabs of the LM7085 and LM7905 regulators are internally connected to GND and V DO NOT ELECTRICALLY CONNECT THE HEATSINK TABS TOGETHER respectively Heating can also be minimized TEXAS INSTRUMENTS Title TMS320C3x DSP STARTERS KIT A Size Document Number D600337 REV Date March 26 1996 Sheet 2 of B 6 Schematics
7. start sect2 0x809A00 s include FILEI1 ASM Include source files include FILE2 ASM H include FILE3 ASM H Using the DSK Assembler 5 17 Chapter 6 Assembler Directives Assembler directives supply program data and control the assembly process They allow you to do the following _j Assemble code and data into specified sections L Reserve space in memory for uninitialized variables Lj Initialize memory _j Assemble conditional blocks Topic Page 6 1 Using the DSK Assembler Directives 6 2 6 2 Directives That Define Sections Luuuuueese 6 5 6 3 Directives That Initialize Constants 00 e eee eee eees 6 4 Directives That Reference Other Files 6 5 Directives That Enable Conditional Assembly 6 6 Directives That Align the Section Program Counter 6 11 6 7 Directives That Define Symbols at Assembly Time 6 8 Miscellaneous Directives cc cece eee neers 6 12 6 9 Directives Reference an a e 6 13 6 1 Using the DSK Assembler Directives 6 1 Using the DSK Assembler Directives Table 6 1 summarizes the assembler directives Note that all source state ments that contain a directive may have a label and a comment To improve readability they are not shown as part of the directive syntax Table 6 1 Assembler Directives Summary a Directives that define sect
8. MEMORY window The MEMORY window shows the contents of a range of memory as shown in Figure 7 3 The MEMORY window has two parts Addresses The first column of numbers identifies the addresses of the first column of display data No matter how many columns of data you dis play only one address column is displayed Each address in this column identifies the address of the data immediately to its right Data The remaining columns display values at the listed addresses For example the MEMORY window below has four columns of data so each new address is incremented by 4 Although the window shows four columns of data there is still only one column of addresses address 0x0080 9800 con tains 0x0000 0007 address 0x0080 9801 contains OxFFFF FFFC address 0x0080 9804 the first value in the second row contains 0x0080 982C ad dress 0x0080 9805 contains 0x0080 98389 etc Figure 7 3 MEMORY Window 7 6 Address column Data columns MEMORY 809800 00000007 fffffffc 00809802 00809827 809804 0080982c 00809839 0080983c 0080983f 809808 00809843 00809842 00809868 0080989a 80980c 008098a9 10800000 0 350000 0f 300000 809810 0 200000 0 320000 0 280000 0 290000 809814 1a770004 6a050006 628098a9 50700080 To modify the contents of the MEMORY window press to activate the window and then type over the data To select a cell you can use the following keys G C aa CPAGEUP PAGEDOWN TAB Understanding the
9. PU registers from the context save area before returning to the code pointed to by the program counter value opcode has been fetched from be other dummy fetches there may interrupt then causes the processor to return back to effectively singlestepping the CPU S0 xdata SO rdata XSTEP XRUNF set 0x808048 set 0x80804C Sect kernel word 0x00320C31 word 0x00320C31 or 0x40 IF or OxC4 IE sti IE _freerun ldi CPUCTXT ARO ldi ARO AR1 addi 1 AR1 ldi 2 IRO ldi 8S0 rdata RO ldi 0 RO sti RO SO_xdata ldf ARO IRO RO ldf AR1 IRO R1 ldf ARO IRO R2 ldf AR1 IRO R3 ldf ARO IRO R4 ldf AR1 IRO R5 ldf ARO IRO R6 ldf AR1 IRO R7 ldi ARO IRO RO ldi AR1 IRO R1 ldi ARO IRO R2 ldi AR1 IRO R3 ldi ARO c IRO R4 ldi AR1 IRO R5 SP 0 Data SP 0 Data Prepend a few easily recognizable markers set XINTI1 set EXINT1 Freerun 0 transmit receive safe INT for C31 C32 debug safe INT for C31 C32 debug indicates DSK is not halted Use parallel opcodes for squeeze Clear under overrun conditions before exit 0 ensures low bits during SP recovery XSR resends should all be zero load floats load longs exponents mantissa Communications Kernel Source Code A 3 Communications Kernel Source Code
10. 350000 0 300000 809810 0 200000 0 320000 0 280000 0 290000 809814 1a770004 6a050006 628098a9 50700080 p wqwaaaaaaaaaaa aaaaaaoaoaaaaauaoaaoaaoaoaoaaoaow_ _ lt lt r Note When the communications kernel is first loaded the on chip timers are initial ized causing the LED to cycle through several colors The sequence is red yellow green yellow red etc sss Installing the DSK Assembler and Debugger 2 7 Step 5 Verifying the Installation Installation errors 2 8 If you see a display similar the one shown in Figure 2 3 you have correctly installed your DSK board assembler and debugger If you see the display shown in Example 2 1 then your software or cable may not be installed prop erly Go through the installation instructions again and make sure that you have followed each step correctly then reenter the dsk3d command above If you still do not see the debugger display one or more of the following condi tions may be the cause L You may have used an incorrect communication port LPT1 versus LPT2 A printer driver or other software may be using the same communication portthat you are attempting to use with the DSK If so try another commu nication port for the DSK Your printer port cable and connectors may not be connected snugly Your power transformer may not be plugged in on both ends If t
11. 40 bit hex display FLOAT display Source DASM debug toggle Run Display breakpoints Clear all breakpoints Singlestep Toggle DASM window size Step over function Selects Disassembly Window Selects Memory Window Move Up Dn Pup Pdn H Xtra help S save help to file To move through the help window you can use PGUP to move ahead a page PGDN to move back a page HOME to return to the first page of the help menu S to save help text to a file ESC to exit the help menu and return to the debugger d n d END to go to the last page of the help menu d d d H to enter a second help level The second help level is more hardware oriented and deals less with debugger specific commands 7 8 Using Software Breakpoints 7 4 Using Software Breakpoints This section describes how to set and clear software breakpoints and how to obtain a listing of all the breakpoints that are set While debugging you may want to halt execution temporarily so that you can examine the contents of selected variables registers and memory locations before continuing with program execution You can do this by setting software breakpoints in the assembly language code A software breakpoint halts any program execution whether you re running or single stepping through code Setting a software breakpoint When you set a software breakpoint the debugger highlights the breakpointed line in a bolder or brighter font The highlighted statem
12. This section provides a quick walkthrough so that you can get started without reading the entire user s guide These examples show the most common methods for invoking the assembler and debugger 1 Create asource file to use for the walkthrough call it rand asm You do not need to enter the information following a semicolon such information is comments to help you understand what the program is doing Example 3 1 File rand asm RAND ASM This example shows nested loops with a call to a random number within the inner loop NOTE This file can be loaded either by using the debugger or a bootloader This example does not use 0x809800 and 0x809801 since the bootloader uses these locations for stack space Start Sect entry CODE 0x809802 Start assembling CODE section here CODE H SAMPLE Debugger entry point ldp ldi stac Load a data page stac Load a stack pointer Tdi ldi ldi O RO Start with SEED 0 O R1 Inner loop counter 0 R2 Outer loop counter ldi rptb call addi addi b 3 RG Start OUTER loop INNER Repeat block INNER RC 1 times Call function D 1 Count INNER loops Count OUTER loops ER Do it again Fast 32 bit random number generator RANDX ldi RAND mpyi addi sti rets SEED RO Calculate RAND SEED A RO Calculate RAND RO QC RO RO S Result is returned
13. comments 5 7 to in assembly language source code communications kernel 4 8 to 4 13 commands data packets 4 8 structure 8 debugging functions to flow diagram i pipeline flow j source code conditional assembly conditional block definition config sys file connecting the DSK constant definition constants assembly time binary integers character 5 9 decimal integers hexadecimal integers symbols as contacting Texas Instruments copy directive cursors command line cursor definition definition Index 2 data directive data packets 4 8 structure 4 8 debugger oy definition description of 3 2 to B 3 display basic opio ae options 2 dz corcom V 3 h Pd E debugging functions communications kernel single step flow diagram single step pipeline flow decimal integer constants 5 8 developing code 3 4 directives assembler binary integers b 8 character constants E hexadecimal integers definition disassembly definition display directory function key method display requirements driver cpp DSK assembler using 5 1 to 6 18 DSK host software 4 23 DSK overview 1 3 dsk3a exe command dsk3d exe command dska command dskd command DSP defined C 2 EGA definition else directive end directive endif directive endloop directive 6 24 entry directive entry point definition execute program to breakpoint function key meth external symbol defini
14. indicat ing that the host is requesting the transfer of a packet The INT2 signal is needed only for the initial packet transfer request and is ignored during subsequent packet requests 3 The C31 starts a one wait state read access to location OxFFFOOO The PAL decodes this address as the host interface active HPACK signal drives the host s ERROR signal low and drives the C31 s READY signal high This prevents the C31 from completing its read access The host uses the ERROR HPACK signal to acknowledge that the C31 is locked and waiting to receive the data 4 4 DSK Hardware Interface The host drives the HPSTB signal high indicating to the C31 that the data is ready The PAL detects the rising edge of HPSTB and drives the C31 s READY signal low unlocking freeing the locked bus access and con cluding the C31 read cycle This process is repeated until all four bytes are transferred least signifi cant byte first At each transfer the C31 pieces the bytes together to form a 32 bit word The host receives data in a similar manner 1 2 The host waits for the HPACK signal indicating that the C31 understands the host request for a packet transfer The C31 starts a one wait state write access to location OxFFFOOO The PAL decodes this address as the HPACK signal drives the host s ERROR signal low and drives the C31 s READY signal high This prevents the C31 from completing its write access The
15. may not be exactly the same but it should be close Figure 3 1 Basic Debugger Display DISASSEMBLY window REGISTER window DISASSEMBLY C31 DSP STARTERS KIT 809c03 50700080 startLDIU 00080h DP 00809c03 008098de 809c04 08349c2c LDI 09c2cH SP 00000000 00000000 809c05 07608000 LDF 0 000000e 00 R0 00000000 00000000 809c06 c610c1c0 LDI ARO RO LDI AR 00000000 00000000 809c07 c610c1c0 LDI ARO RO LDI AR 00000000 00000000 809c08 08600100 LDI 256 R0O 00000000 00000000 809c09 09a09c00 LSH 09c00H RO 00000000 00000000 809c0a 61809c0e BRD jump 00000000 00000000 809cOb 07618000 LDF 0 000000e 00 R1 00000000 00000000 809cOc 07628000 LDF 0 000000e 00 R2 00000000 00000000 809cOd 07630000 LDF 1 000000e 00 R3 00000000 00000000 809c0e 07640000 LDF 1 000000e 00 R4 00000000 00000000 809cO0f 087b0003 LDI 3 RC 00000000 00000000 809c10 64809cla RPTB block 00000000 00000000 809c11 02640001 ADDI 1 R4 COMMAND MEMORY 809800 00000007 fffffffc 00809802 00809827 809804 0080982c 00809839 0080983c 0080983f 809808 00809843 00809842 00809868 0080989a 80980c 008098a9 10800000 0 350000 0f 300000 Texas Instruments 1994 809810 0 200000 0 320000 0 280000 0 290000 ES GERE 809814 1a770004 6a050006 628098a9 50700080 F1 Help F2 REG40 F3 FLOAT FM Srce F5 Run F6 DispBP F7 ClrAllF8 SStep F9 Grow F10 FStep Command line COMMAND window window Key features of the debugger Eas
16. rrzdv e3ed hi L 009ad Y Ada aTequnN a3ueunoodg ezrs LIN SHALLHViS dSd XEDOZESHL e9TaIL SLNEWNULSNI SVX3L 9vOZEDOTLL 107 ZZA TO OVOTEDIL AOF OZA TTe3sur e630N Lno FLAO NIXOY XRIZON anow ana NIY NIW WHO o euetTd prds Teu ND OST T AT XOT MOT aor alz 6 ott veal tr OVOZEOTLL ere 9es ccu aa d z 6TH NEP NH OR anow ano 2 8 kaoa EEX 4 A 4 TEN ados bit ZXII HHdVaH E UJT 8 pe E his Sis zz 110 xsa vx OOT ANTE OZ 6T oxsa gt TT ze tano Xa zt 81 ZT oxa atos HE TAANE 91 ST OXN TO gzg NIXnV ATON Fo Det STH PII OANT z Fe NIXNY aa 2 COT AA STH ZI TI Od usa pr Oot lt TH oT 6 ONSd OD gz NI 9A 8 y OMTOL z 9 zm Se NI rasau pz i gt g Qax X 29 d z I DDA DTE Tar anow slo sialzieft 2 E E l Tie tiz auo 4nztvj 4nZz v snr anr anr aar dar ANT gt ant ant vz2 zz2 eo pro z o trol eto oT os vo ezo DOA OST euerd arrds TTA oT DoA OST ota B 9 DSK Circuit Board Dimensions and Schematic Diagrams Schematics JP2 lt D 0 31 gt DLO 31 NOTES TCLKO SNP DXO FSXO CLKXO CLKRO FSRO DRO INT3 INT2 INTI INTO IACK XFI XFO RESET R W STRB RDY HOLD HOLDA HICONN H3CONN GND HEADER 16X2 GND P ERR PWM TRI JP5
17. tives and macro directives The assembler substitutes absolute opera tion codes for symbolic operation codes and absolute or relocatable ad dresses for symbolic addresses assignment statement A statement that assigns a value to a variable autoexec bat A batch file that contains DOS commands for initializing your PC batch file A file that contains DOS commands for the PC to execute block A set of declarations and statements that are grouped together with braces breakpoint A point within your program where execution because of a pre vious request from you byte A sequence of eight adjacent bits operated upon as a unit C 1 Glossary C 2 code display windows Windows that show code text files or code specific information commandline The portion of the COMMAND window where you can enter commands command line cursor A block shaped cursor that identifies the current character position on the command line comment A source statement or portion of a source statement that is used to document or improve readability of a source file Comments are not assembled common object file format COFF An object file that promotes modular programming by supporting the concept of sections constant A numeric value that can be used as an operand cursor An icon onthe screen such as a rectangle or a horizontal line that is used as a pointing device The cursor is usually under keyboard con trol debugge
18. 0x00809a00 0x00809a04 0x00000004 gt gt gt gt gt gt gt gt gt gt gt gt END DSK Assembler Directives 6 7 Directives That Initialize Constants 6 3 Directives That Initialize Constants 6 8 Several directives assemble values for the current section m The byte directive places one or more 8 bit values into consecutive words in the current section A byte in this case uses all 32 bits of the word placing Os into the upper 24 bits The fill directive reserves a specified number of words in the current section with a value The assembler advances the SPC and skips the re served words When you use a label with fill it points to the first word of the reserved block The float directive converts an expression value into a 32 bit TMS320C3x floating point constant This format has an 8 bit exponent and a 24 bit mantissa The float16 directive converts an expression value into a 16 bit TMS320C3x floating point constant This format has an 8 bit exponent and an 8 bit mantissa The format is identical to that used by the sfloat directive of the TMS320C32 The upper 16 bits are not used and are filled with Os The float8 directive converts an expression value into an 8 bit TMS320C3x floating point constant This format has a 4 bit exponent and a 4 bit mantissa This format can be used for a quick logarithm approxima tion The upper 24 bits are not used and are filled with Os The ieee directive calcu
19. A23 A22 A21 STRB RW USERX DEMO A23 A22 A21 STRB DEMO TO T1 TO T1 UBOOT DEMO A23 A22 A21 A20 STRB DEMO TO T1 TO T1 The decoded address ranges are as follows NOTE By using A23 as an enable it is possible to use external H zero wait state RAM Essentialy by ignoring decoded outputs USER BOOT 000000 OFFFFF EPROM boot or uP mode operation 5 100000 7TFFFFF No decode SRAM 0x800000 OxBFFFFF lws decoded external memory i USER R 0OxCO0000 OxDFFFFF Read access USER W 0OxCO0000 OxDFFFFF Write access USER X 0OxCO0000 OxDFFFFF Read or Write access HPI asynch OxE00000 OxEFFFFF DSP access to bus w o host lock HPI host locked OxF0O0000 OxFFFFFF Must pulse HPIS to advance DSP state SIMULATION EADY INT2 TO T1 DEMO RW USERX UBOOT SRAM USERR USERW TRACE ON CLK HPIS STRB HPIA R Simulate access Q0 outside decoded rang Note The simulation vectors are omitted for clarity and brevity LLLLLLL L LL 3w DSK Circuit Board Dimensions and Schematic Diagrams B 13 Appendix C Glossary absolute address An address that is permanently assigned to a memory location assembler A software program that creates a machine language program from a source file that contains assembly language instructions direc
20. Debugger Options ssssssssssssssssesses eens 7 2 Editing Command Keys ssssssssssssssssssss ssh 7 3 Command Line Editing saa sane suaian a a N ene 7 4 Command Line Buffer Manipulation 00 eect eens 7 5 Running Programs seviscevscs eves nT r AARE So ys eed ies BE eee BE CHEER eR REA 7 6 Displaying and Changing Data 0 0c cece rh 7 7 Managing Breakpoints tiatn cee ERENER EN 7 8 Loading Programs 425b eee ARTOSE EAN IAE ERETON ees 7 9 Performing System Tasks 0 06 c cece eet eee eee aes 7 10 Function Key Shortcuts for DISASSEMBLY Window Active 000222e eee 7 11 Function Key Shortcuts for CPU Window Active 000 cee eee eee eens 7 12 Function Key Shortcuts for MEMORY Window Active 00c cece eee 7 13 Function Key Shortcuts for COMMAND Window Active 0 cece eee eens Contents xiii Examples TII TD wo a a xiv Port Selection Display sssssssssssssssseeess teen eee File rand asm Initialize the Serial Port Global Control Register Setting the TA and TB Registers 0 0 e eee nent eh Sections Directives Chapter 1 Introduction This chapter provides an overview of the TMS320C3x DSP Starter Kit DSK The C3x DSK is alow cost simple high performance stand alone application development board that lets you experiment with and use TMS320C3x DSPs for real time signal processing The DSK h
21. Mnemonic and Syntax brstart section name n end start section name address Description Equate a value with a local symbol Equate a value with a local symbol multiple times Description Align the named section to the next 2n address bound ary Program end Links the named section to start assembling at the location address Page 6 28 6 26 Page 6 15 6 19 6 30 Directives That Define Sections 6 2 Directives That Define Sections These directives associate the various portions of an assembly language pro gram with the appropriate sections The data directive identifies portions of code to place in data memory Data memory usually contains initialized data _j The sect directive defines an initialized named section and associates subsequent code or data with that section A section defined with sect can contain code or data The text directive identifies portions of code in the text section The text section usually contains executable code Example 6 1 shows how you can use sections directives to associate code and data with the proper sections This is an output listing column 1 shows the SPC value and column 2 shows the memory contents if affected by the previous line or a comment Each section has a section program counter SPC The start directive for a section determines that section s initial SPC value When you resume assembling into a section its SPC resumes counting as
22. TE 5 12 5 6 Assembling Your Program eese 5 15 5 7 Placing Code Sections Memory Locations 5 1 Creating DSK Assembler Source Files 5 1 Creating DSK Assembler Source Files 5 2 To create a DSK assembler source file you can use almost any ASCII program editor Be careful using word processors these files contain various formatting codes and special characters DSK assembly language source programs consist of source statements that can contain assembler directives assembly language instructions and comments Source statement lines can be up to 80 characters per line The next several lines show examples of source statements C REG set 10100b lt lt 2 3 Control word text start ldi 2h IOF Pull AIC into reset ldi Oh T4 Clear R4 ldp SGCRO sti R4 SGCRO Reset serial port ldi SINIT1 R7 Load initialization value 1 into R7 sti R7 SPCX0 Initialize FSX DX CLKX control reg sti R7 SPCRO Initialize FSR DR CLKR control reg Idi SINITO R7 Load initialization value 0 into R7 sti R7 SGCRO Enable RINT and 16 bit transfers Sti R4 DTXO Transmit O0 sti R4 TGCRO Reset timer O0 ldi TIMERPER R7 sti R7 TPRO Store timer 0 period Your source statement can contain four ordered fields The general syntax for source statements is as follows abel mnemonic operand list comment Follow these guidelines Allstatements must begin with a la
23. The host communicates with the C31 through the parallel printer port The PC manipulates the parallel port s signals by writing to and reading from the host s parallel port control and status registers Figure 4 2 and Figure 4 3 show the parallel port control and status register bit fields used by the DSK host soft ware The labels below the printer port signal names refer to signal names as used by the DSK board as shown in Figure 4 1 Figure 4 2 Parallel Port Control Register 0x37A 7 6 5 4 3 2 1 0 wm x ww SET mr AUTORD FETROEE RESET HPSTB Ww R W Ww R W Ww R W Figure 4 3 Parallel Port Status Register 0x379 7 6 5 4 3 2 1 BUSY ACK PAPER SELECT ERROR ACK X D3 D2 D1 DO HPACK The host initializes the C31 by pulsing the INIT signal writes a 0 followed by a 1 to the INIT bit field of the parallel port control register This signal resets the C31 and activates the bootload mode The host then downloads your pro gram or the communications kernel to the C31 The parallel port is mapped into the C31 memory to the address range OXFFF000 0xFFFFFF as shown in Figure 4 4 page 4 7 The host sends data to the C31 in the following way 1 The host writes the byte to be transmitted to the l O mapped area of the host s parallel port data lines I O address 0x378 for LPT 1 2 Thehostdrives the HPSTB signal low and waits for an acknowledgement The HPSTB signal interrupts the C31 by pulsing the INT2 signal
24. are the two timer output frequencies S the Users Guide Sect sstack stack word stack 1 start of kernel stack MMRBASE word 0x00808000 PRDO word 0x0000A000 PRD1 word 0x0000A060 TSTART word 0x000003C3 START ldp START Set up stack and other params ldi stack SP ldi MMRBASE ARO Init timers for slow PWM modulation ldi 3 RO HALT timers sti RO ARO 0x20 sti RO ARO 0x30 sti RO ARO 0x24 Init count registers sti RO ARO 0x34 Lgi QPRDO RO Init periods sti RO ARO 0x28 ldi QPRD1 RO st RO ARO 0x38 ldi TSTART RO Start timers sti RO ARO 0x20 st RO ARO 0x30 b spinO A 2 Communications Kernel Source Code DEBUGG memory func ER COMMANDS E The debugger commands are assembled into the lowest available kernel If an application were to overgow this section the debugger tions would be corrupted but the application would continue to run so long as the debugger functions were not used XSTEP XRUNE 3 H hese functions restor The only difference is that XSTEP purposely sets the interrupt flag used for single stepping before returning to the users code i SINGLE STEPPING The tail end of this function is written such that a pending 7 interrupt will not be serviced until on the return address and This pending the context sav the C routine xecuted
25. can equate meaningful names with constant values The set directive enables you to set constants to symbolic names Symbolic constants cannot be redefined The following example shows how these directives can be used text initialize PC K set 12 constant definition K 12 BIN set 01010101b BIN 055h max_buf set K 2 max buf K 2 24 LDI K RO loads 12 LDI K RO loads 12 LDI K 2 R0 loads 24 LDI max buf RO loads 24 LDI BIN RO loads 0AAh Predefined symbolic constants The assembler has several predefined symbols including the following L the dollar sign character represents the current value of the section pro gram counter SPC Register symbols including ARO AR7 IF PC RS BK IOF RO R7 SP DP IRO RC ST IE IR1 RE Using the DSK Assembler 5 11 Expression Analyzer 5 5 Expression Analyzer The expression analyzer used in the DSK assembler includes ANSI C math library functions that aid in the generation of tables and constants These func tions eliminate the tedious work of calculating tables and constants before in cluding them in the assembly process The functions are shown in Table 5 2 p M 7 Note If you use any of these functions a post assembly warning is generated to remind you that these functions are not supported by the TMS320 floating point code generation COFF tools If you wantto
26. character strings A character constant represents a simple integer value and is enclosed in single quotes a string is a list of characters and is enclosed in double quotes Using the DSK Assembler 5 9 Character Strings 5 3 Character Strings A character string is a string of characters enclosed in double quotes The maximum length of the string varies and is defined for each directive that re quires a character string Examples of valid character strings include sample program defines a 14 character string sample program temp asm defines an 8 character string temp asm Character strings are used for the following Filenames as in copy filename LJ Section names as in sect section name Operand of a string directive 5 4 Symbols Labels Constants Symbols Symbols are used as labels constants and substitution symbols A symbol name is a string of up to eight alphanumeric characters A Z a z 0 9 and symbols cannot contain embedded blanks The first character in a symbol cannot be a number or special character The symbols you define are case sensitive for example the assembler recognizes ABC Abc and abc as three unique symbols Symbols that are used as labels become symbolic addresses that are associated with locations in the program A label must be unique Note that you should not use register names as labels Symbols can be set to constant values By using constants you
27. if there had been no intervening code After the code in Example 6 1 is assembled the sections contain text Bytes with the values 1 2 3 4 5 and 6 data Bytes with the values 9 10 11 and 12 mysect Bytes with the values 21 22 23 24 AE ENN Note The text and data directives are short hand representations of sect state ments for that section name text is equivalent to sect text data is equivalent to sect data LLLLLLLLL Assembler Directives 6 5 Directives That Define Sections Example 6 1 Sections Directives 6 6 0x00809800 0x00809800 0x00809800 0x00809800 0x00809800 0x00809800 0x00809800 0x00809800 0x00909800 0x00809801 0x00809802 0x00809802 0x00809803 0x00809804 0x00809804 0x00809804 0x00809804 0x00809900 0x00809900 0x00809901 0x00809902 0x00809902 0x00809903 0x00809904 0x00809904 0x00809904 0x00809804 0x00809804 0x00809805 0x00809806 0x00809806 0x00809806 0x00809806 0x00809a00 0x00809a00 0x00809a01 0x00809a01 0x00809a02 0x00809a02 0x00809a02 0x00809a04 0x00809a04 0x00809a04 directive directive directive nocode nocode nocode directive directive 0x00000001 0x00000002 directive 0x00000003 0x00000004 nocode nocode nocode directive directive 0x00000009 0x0000000a directive 0x0000000b 0x0000000c nocode nocode directive directive 0x00000005 0x000
28. in RO F word word word 0107465h Constants needed for RAND 0234567h 0 word end S 1 Begin stack here Overview of a Code Development and Debugging System 3 5 Getting Started 3 6 2 Enter the following command to assemble rand asm dsk3a rand This command invokes the TMS320C3x DSK assembler If the input file extension is asm for example rand asm you don t have to specify the extension the assembler uses asm as the default For more information about invoking the assembler refer to Section 5 6 Assembling Your Pro gram on page 5 15 When you enter this command the assembler creates an executable file called rand dsk This file is used for directly loading executable code into the DSK The executable file includes a listing of all errors and warnings that may have occurred during assembly of your program This listing is helpful because it contains a list of all unresolved symbols and opcodes Now you are ready to debug your program Enter the following command to invoke the debugger dsk3d This command brings up the TMS320C3x DSK debugger on your screen From here you can load your rand dsk sample program by using the LOAD command For more information on using the debugger refer to Chapter 7 Chapter 4 Functional Overview The TMS320C3x DSK hardware and software work together to create a low cost development platform that lets you
29. indicates HALT spin0 Send ACKNOWLEDGE zero to host lt Branch is removed spin0 is inline The spinO code loop is used by the kernel as a known program loop when a process is halted While in the spin loop commands can be processed This code loop is primarily used while debugging or during startup as a known useable code loop A i spinO or 4 IE Enable DSK31 HPI interrupt and 4 IE Shut down all interrupts except host b spin0 i SOxdata word 0 GIE set 0x2000 A 6 Communications Kernel Source Code REGISTER CONTEXT STORAGE This block of memory holds the register values when a process is stopped Essentially the registers displayed in the debugger ar the contents of this memory block A F context _FO word 0 RO F1 word 0 s RI F2 word 0 p RA _F3 word 0 RS _F4 word 0 R4 F5 word 0 R5 F6 word 0 R6 F7 word 0 R7 RO word 0 FO RI word 0 EI _R2 word 0 F2 _R3 word 0 i F3 _R4 word 0 F4 R5 word 0 F5 R6 word 0 F6 _R7 word 0 so RB _ ARO word 0 ARO _AR1 word 0 ARI _AR2 word 0 AR2 _AR3 word 0 AR3 ARA word 0 ARA _AR5 word 0 ARS _AR6 word 0 ARO _AR7 word 0 ART DP word 0 Data page IRO word 0 Index register 0 _IR1 word 0 Index register 1 _BK word 0 Block size _SP word stack 1
30. jack analog out RCA jack analog in Q O TLC32040 Plug your printer cable into this socket DB25 female 5 Plug the transformer into a wall socket 6 Turn on your PC s power 7 The LED will illuminate either red or green p BB B eel IMMITI Note Some manufacturers of plug in cards may also use DB25 connectors that appear to be of the same type If this is the case be sure to check the PC configuration thoroughly before continuing LLLLLL 2 4 Step 2 Installing the DSK Software Step 3 Modifying Your config sys File 2 3 Step 2 Installing the DSK Software This section explains how to install the debugger software on a hard disk system 1 Make a backup copy of the product disk If necessary refer to the DOS manual that came with your computer 2 On your hard disk or system disk create a directory named dsktools This directory will contain the DSK assembler and debugger software To create this directory enter md c dsktools 3 Insert your product disk into drive A Copy the contents of the disk using the following command copy a c dsktools v 2 4 Step 3 Modifying Your config sys File When using the debugger and assembler you can open multiple files To allow enough environment room it is recommended that the following line be added to the config sy
31. label would point to the first word In the following example the label Begin has the value 0x00809800 0x00809800 directive Begin int OAh 3 7 0x00809800 0x0000000a int 0x00809801 0x00000003 int 0x00809802 0x00000007 int When a label appears on a line by itself it points to the instruction on the next line 0x0080981f nocode XMIT 0x0080981f 0x10760010 or 10h IE 0x00809820 0x06000000 idle When an opcode or directive references a label the label is substituted with the address of the label s location in memory The only exception to this is the set directive which assigns a value to a label If you don t use a label the first character position must contain a blank a semicolon or an asterisk Using the DSK Assembler 5 3 Creating DSK Assembler Source Files Using the mnemonic field 5 4 The mnemonic field follows the label field The mnemonic field cannot start in column 1 or it is interpreted as a label The mnemonic field can contain one of the following opcodes Machine instruction mnemonic such as ADDI MPYF Assembler directive such as data set entry If you have a label in the first column a space colon or tab must separate the mnemonic field opcode from the label For example Start AICTEST 0x809900 sect AICTEST GIE set 0x2000 C3xMMRS ASM A REG Word TA lt lt 9 RA lt lt 2 0 0x809902 B REG word TB lt lt 9 R
32. location starting address The context address value is placed in the global variable DEBUG CTXT External unsigned long DEBUG_CTXT NO_ERR Command completed successfully RECV ERR Failed reception XMIT ERR Failed transmission Host Software DSK reset input rdy recv long byte Host communications driver routines Syntax Description Arguments Return Value Syntax Description Arguments Return Value recv long byte Syntax Description Arguments Return Value To facilitate the data transfer from the host to the C31 the DSK software in cludes several driver level routines in the file driver cpp This file includes rou tines that manipulate the hardware interface circuitry ofthe hostto reset send and receive data through unidirectional and bidirectional parallel printer ports Reset MSGS DSK reset void The reset routine resets the DSK by toggling the INIT signal None NO_ERR Reset sequence completed RESET ERR Reset has failed Input Ready char input rdy void The input rdy routine indicates that the DSK is ready to receive None 0 DSK ready to receive data 1 DSK not responding to host command Receive Long Byte MSGS recv long byte ulong rcv data Therecv long byte routine receives a 32 bit value in four 8 bit data transfers to be used only in bidirectional parallel printer ports rcv data Address of the value to receive NO ERR RECV ERR Successful reception Failed reception Fu
33. port FSR DR CLKR control register DTXO set 0x808048 Serial port data transmit register DRXO set 0x80804c Serial port 0 data receive register TGCRO set 0x808020 Timer 0 global control register TCNTO set 0x808024 Timer 0 counter register TPRO set 0x808028 Timer 0 period register global control register 0 0 FSX DX CLKX control register 0 0 Ne Se Ne Se Se Se Se Se The second way to comment your source file is to use an asterisk in column 1 of your code If the asterisk is notin column 1 the assembler assumes it is part of your code and can generate an error A source statement that contains only a comment is valid Using the DSK Assembler 5 7 Constants 5 2 Constants Binary integers Decimal integers The assembler supports five types of constants Binary integer constants Decimal integer constants Hexadecimal integer constants Floating point constants Character constants O O O O L The assembler maintains each constant internally as a 32 bit quantity Constants are not sign extended For example the constant OFFh is equal to OOFF base 16 or 255 base 10 it does not equal 1 A binary integer constant is a string of Os and 1s followed by the suffix B or b Examples of valid binary constants include 0101b Constant equal to 5 10101B Constant equal to 21 0101b Constant equal to 5 A decimal integer constant is a string of decimal digits ranging from 2 147 483 647 to 4 294 967 295
34. reserved space Using the DSK Assembler Directives b Directives that initialize constants data and memory Continued Mnemonic and Syntax Description Page String string strings l Initialize one or more text strings 6 31 word value valuey Initialize one or more 32 bit integers 6 16 c Directives that reference other files Mnemonic and Syntax Description Page copy filename Include source statements from another file 6 17 include filename Include source statements from another file 6 17 d Directives that enable conditional assembly Mnemonic and Syntax Description Page else Optional conditional assembly 6 23 endif End conditional assembly 6 23 Af well defined expression Begin conditional assembly 6 23 loop well defined expression Begin repeatable assembly of a code block the loop 6 24 count is determined by the well defined expression endloop End loop code block 6 24 e Directives that modify the section program counter SPC Mnemonic and Syntax Description Page align size in bytes Align the SPC on a boundary specified by size in bytes 6 14 which must be a power of 2 default to byte boundary entry address Initialize the starting address of the SPC when loading 6 20 a file Assembler Directives 6 3 Using the DSK Assembler Directives f Directives that define symbols at assembly time Mnemonic and Syntax set value sdef value g Miscellaneous Directives
35. to OxFFFO000 bytes 1 to receiv shift result right one byte Load byte shift to upper byte or w result loop until done restore lt Branch can be saved Next 4 opcodes common to W HOST R HOST A XWRIT is a host port command designed to transfer a block of data from the host to the C31 s memory T XWRIT call XW1 call sti db b A 10 COMN R HOST RO ARO IR1 AR1 XWl SR2 Communications Kernel Source Code i 7 3 XREAD is a host port command designed to transfer a block of data from C31 memory to the host z XREAD call COMN XR1 ldi ARO IR1 RO call W HOST db AR1 XR1 b SR2 H There are a few leftover traps that can be used by appliactions The number of TRAPs coincides with the amount of available unused memory before the JUMP table is encountered and was adjusted by hand by looking at the assembler listing E r TRAPOO b Leftover TRAPs which can be TRAPO1L b used by applictions F A JUMP table can also be used to access the DSK3 routines from H other applications that require host communications In this case the contents of the loaction specified can be used in a register call or branch r 3 Start JMPTBL 0x809FF4 sect JMPTBL JUMP word JUMP 0x809FF4 Jump table base address word XWRIT 1 0x809FF5 for DSK3 routines
36. 0000 LDF 1 000000e 00 R4 087b0003 LDI 3 RC 64809c1a RPTB block 02640001 ADDI 1 R4 To select the DISASSEMBLY window press C While in the DIS ASSEMBLY window you can use the cursor to select a line and then use a function key to set or clear a breakpoint Referto Table 7 13 for more informa tion about function keys 74 Understanding the Debugger Windows CPU REGISTER window The CPU REGISTER window displays the content of all CPU registers as shown in Figure 7 2 The register s contents are normally displayed in hexa decimal format You can press to display the extended precision registers in floating point decimal format You can press to display the extended precision registers in 40 bit hexadecimal format Figure 7 2 CPU REGISTER Window Register names C31 DSP STARTERS KIT 00809c03 008098de 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 Register contents To modify the contents of a register activate the CPU REGISTER window by pressing C You can type over the highlighted data and press to accept the changes when you are satisfied with them Use the following keys to select the data you want to edit Q CD GQ CPAGEUP PAGEDOWN TAB Using the DSK Debugger 7 5 Understanding the Debugger Windows
37. 00006 nocode nocode nocode directive nocode directive 0x00000015 0x00000016 directive 0x00000017 0x00000018 nocode nocode nocode Start text 0x809800 Start data 0x809900 start mysect 0x809a00 Start assembling into text text byte 1 2 byte byte byte 3 4 byte byte Start assembling into data data byte 9 10 byte byte byte 11 12 byte byte Resume assembling into text text byte 5 6 byte byte Start assembling into mysect sect mysect byte 21 22 byte byte byte 23 24 byte byte Directives That Define Sections Example 6 1 Sections Directives Continued S25 gt gt gt gt PASS 2 Complete gt gt gt gt Errors 0 Warnings 0 gt gt gt gt gt gt gt gt ENTRY 0x00809800 gt gt gt gt gt gt gt gt Symbol reference tabl Type Addressable S ref Default Start 0x00809800 1 1 gt gt gt gt ref 0x00000001 1 2 gt gt gt gt ref text 0x00809800 1 1 gt gt gt gt ref data 0x00809900 1 1 gt gt gt gt xref mysect 0x00809a00 1 1 gt gt gt gt ref 0x00000001 1 2 gt gt gt gt gt gt gt gt Output section start end length gt gt gt gt sect Default Start 0x00809800 0x00809800 0x00000000 gt gt gt gt sect text 0x00809800 0x00809800 0x00000006 gt gt gt gt sect data 0x00809900 0x00809904 0x00000004 gt gt gt gt sect mysect
38. 1 MAX SECTN More than 64 sections BAD OPTN HDR Incorrect optional COFF header COM ERR Communication failure Functional Overview 4 29 Init Communication Host Software Init Communication Syntax Description Arguments Return Value 4 30 Initialize Communication MSGS Init Communication int init n times The Init Communication function first attempts to communicate with the DSK assuming that a valid communications kernel already exists If this fails the DSK is reset and the kernel is bootloaded up to init n times This function also queries an existing communications kernel to determine if the kernel is configured for bytewide or nibble mode readback After initializing communications with the DSK the Load File function then loads the desired application init n times Number of times to attempt bootloading the communications kernel before failing Typically this value is set to a large value to allow you to connect cables and power to the DSK NO ERR The DSK communications link is valid INIT ERR The communications link has failed Chapter 5 Using the DSK Assembler This chapter explains how to use the DSK assembler and describes valid DSK source files Topic Page 5 1 Creating DSK Assembler Source Files 5 2 5 2 Constants c r e ee mere mem ERES Ae CGhara cter Strings e REPETI 54 Symbols aena iet EM E M UTE ae 5 11 5 52 Expressionr Analyzer ccce nece re
39. 2 BPI Some values Syntax Description Example Assemble Conditional Block if else endif Af well defined expression else endif Three directives provide conditional assembly I The if directive marks the beginning of a conditional block The expres sion is a required parameter B f the expression evaluates to true nonzero the assembler as sembles the code that follows it up to an else or an endif B f the expression evaluates to false 0 the assembler assembles code that follows an else if present or an endif The else directive identifies a block of code that the assembler assembles when the if expression is false 0 This directive is optional in the condi tional block if an expression is false and there is no else statement the assembler continues with the code that follows the endif The endif directive terminates a conditional block Nested if else endif directives are not valid Here is an example of conditional assembly TRUE set 1 FALSE set 0 if TRUE nop Assembles nop since TRUE else B Never assembles endif Assembler Directives 6 23 loop break endloop Assemble Code Block Repeatedly Syntax Description Example loop well defined expression endloop Two directives enable you to repeatedly assemble a block of code The loop directive begins a repeatable block of code The optional expression evaluates to
40. 32040 hardware interface E Index TLC32040 AIC initialization to VGA definition windows definition word definition word directive xmit long Index 5
41. 33 100 R47 33 o 147 4 470 ot 2 R35 us okis 470 2 a1 mI 18 DO 6 R36 3 I7 pu O A2 B2 19 470 4 16 D2 Dm A3 B3 7 R37 5 15 D3 o AA B4 20 470 6 14 D4 nl a A5 B5 8 R38 Fi 13 D5 O id A6 B6 21 470 8 12 D6 9 A7 B7 9 R39 9 ll D oO 225 Ad AS B8 Q a 470 o 10 C33 C34 Can C36 193 c e238 i 1 DIR o EAT 220PF 220PF 220PF 220PF o 24 4 n 4 4 74ACT245 oH y RZW 25 C37 c38 c39 C40 GND oO o EE 2 Al BL 18 Se 470PF 470PF 470PF 470PF 3Slas po OZ DB25 R40 4 l6 id A3 B3 100 5 RET AA B4 R41 6 14 id A5 B5 100 7 13 A6 B6 R42 8 12 mE 9 A7 B7 II i RA3 A8 B8 100 AS gc ah DIR ug J 74ACT245 GND NOTE By configuring TCLKO and TCLK1 as clock outputs and driving PWM high default the output pins UBOOT and USERX drive the TEXAS INSTRUMENTS LED with a PWM signal The PWM voltage is the phase difference between the two clocks and can be configured to be a DC output Title or a triangle wave see DSK documentation TMS320C3x DSP STARTERS KIT A Size Document Number D600337 REV Date April 1 1996 Sheet 4 of 6 B 8 Schematics E Jo amp 3eeus o66T I
42. 7 0972 or 81 3 3457 0976 82 2 551 2804 886 2 3771450 Ask questions about Digital Signal Processor DSP product operation or report suspected problems Fax Fax Europe Email World Wide Web BBS North America BBS Europe 320 BBS Online 713 274 2320 713 274 2324 33 1 3070 1032 43897509 mcimail com http www ti com dsps 713 274 2323 8 N 1 44 2 3422 3248 ftp ti com mirrors tms320bbs 192 94 94 53 Ask questions about micro 713 274 2370 controller product operation Fax 713 274 4203 or report suspected prob Email H370 msg ti com lems World Wide Web http www ti com sc micro BBS 713 274 3700 8 N 1 Request tool updates Software 214 638 0333 Software fax 214 638 7742 Hardware 713 274 2285 800 Order Texas Instruments documentation see Note 1 Literature Response Center 800 477 8924 Make suggestions about or report errors in documenta tion see Note 2 Notes Email Mail comments books sc ti com Texas Instruments Incorporated Technical Publications Manager MS 702 P O Box 1443 Houston Texas 77251 1443 1 The literature number for the book is required see the lower right corner on the back cover 2 Please mention the full title of the book the literature number from the lower right corner of the back cover and the publication date from the spine or front cover Read This First vii Trademarks Trademarks vi
43. B lt lt 2 2 0x809903 C_REG word 10000011b 0x809904 1 5 V S0 gctrl val word 0x0E970300 SO xctrl val word 0x00000111 SO rctrl val word 0x00000111 prog AIC push R1 push IE ldi 0x10 IE andn 0x30 IF ldi SO_xdata R1 sti R1 SO_xdata idle ldi G8S0 xdata R1 or S RI sti R1 SO_xdata idle sti RO SO_xdata idle andn 3 R1 sti R1 SO_xdata pop IE pop R1 rets Refer to the 7MS320C3x User s Guide for syntax specifications on individual opcodes It is necessary to resolve al fields in an opcode If an opcode field such as the section name in a sect opcode is omitted the assembler generates the error statement Invalid Undefined or Missing Operand Creating DSK Assembler Source Files Using the operand field The operand field is a list of operands that follow the mnemonic field An operand can be a constant see Section 5 2 page 5 8 a symbol see Sec tion 5 4 page 5 11 or a combination of constants and symbols in an expres sion You must separate operands with commas The assembler lets you specify whether to use a constant or use a symbol as an immediate value a direct address or an indirect address The following rules apply to the operands of instructions No prefix the operand is a well defined immediate value The assembler expects a well defined immediate value such as a register symbol or a constant For floating point operations use an extended reg ister RO
44. Buffer Manipulation To do this Recall the last command typed Recall the first command in the command line buffer Reexecute the last command typed Table 7 5 Running Programs free Todotis Usethiscommand Move the cursor to the beginning of the command line Move the cursor to the end of the command line Delete the character to the left of the cursor Delete the character to the right of the cursor END Move the cursor to the left Move the cursor to the right Use this command CPAGEUP or T eace DOWN or J TAB To do this Use this command Step through the instructions one at a time single SS step Execute n instructions XNn Single step through the instructions until you reach XG addr address addr Execute the program until a breakpoint is encoun RUN tered Execute the program and ignore breakpoints run RUNF Table 7 6 Displaying and Changing Data To do this Display the contents of memory starting at address adar in the MEMORY window Modify memory at address addr Fill eng locations of memory starting at address addr with value val If val is expressed in a floating point format with a decimal point it will be converted into a TMS320 floating point format Display assembly language code starting at address adar in the DISASSEMBLY window Display extended precision registers in 40 bit hexade cimal format in the register window Display extended precision registers in floating poi
45. Debugger Windows COMMAND window The COMMAND window provides an area for entering commands echoing commands and displaying command output errors and messages The COMMAND window has two parts Command line This is the area where you enter commands When you want to enter a command just type no matter which window is active _j Display area This area echoes the commands that you enter shows any output from your commands and displays debugger error messages Figure 7 4 shows the window command line and display area Figure 7 4 COMMAND Window COMMAND gt load testa Display area Command line You can use the and CD keys to select a previously entered command from the buffer a gt is used to indicate the buffer The editing command keys are shown in Table 7 2 Table 7 2 Editing Command Keys To do this Use this command Move through the command Toggle the insert and type over mode INS Delete the character at the cursor DEL Move to the beginning of the line HOME Move to the end of the line END Clear the command ESC Select a command from the buffer mM om Using the DSK Debugger 7 7 Using the Help Menu 7 3 Using the Help Menu You can press the or H key to bring up the Help Window Display shown in Figure 7 5 Choose from the menu selections listed below to find additional information Figure 7 5 Monitor Information Screen KEYBOARD COMMANDS Help Screen
46. EMD ZA B 7 DSK Circuit Board Dimensions and Schematic Diagrams Schematics P INIT P ERR MRE P STRB woe u7 HH Nc vec 38 vcc R23 HIPAL I1 CLK IO10 RESET 27 R25 STRE 3 2 roo ZS R24 10K 470 470 A23 4 25 I3 ros USERWN 470PF A22 5 24 I4 IO7 R26 R27 A21 6 23 GND id 276 A20 7 r5 roe 22 SRAMN 5 I6 NC SIX ere o x 5 NC Ios 20 RDY c26 A 20 23 AL20 231 PWM 17 ro4 INT2 10 19 vec vec p La a bd TCLKI 1i IS Io3 18 470PF A TCLKO i2 I9 IO2 12 HPACK c28 c29 c30 c31 c32 y oa 13 I10 rol 16 USERR GND R28 R29 cyp LERI 14 111 I12 5 P1 470PF 220PF 220PF 220 r 220PF SED SEE He ds 10K lt 10K ur m E S 4 22V10zZ 14 95 2 i R30 LS bs 3 R32 d R46 33 oO UBOOTN o ze azo RAL USERX o 4 R
47. Examples of valid decimal constants in clude 1000 Constant equal to 1 00049 or 3E846 32768 Constant equal to 32 76849 or 800016 25 Constant equal to 2549 or 1916 Hexadecimal integers 5 8 A hexadecimal integer constant is a string of up to eight hexadecimal digits followed by the suffix H or h or preceded by the prefix Ox Hexadecimal digits include the decimal values 0 9 and the letters A F or a f A hexadecimal constant must begin with a decimal value 0 9 Examples of valid hexadeci mal constants include 78H Constant equal to 12049 or 007846 OxOf Constant equal to 1549 or 000F46 37ACh Constant equal to 14 25249 or 37AC46 Constants Floating point constants A floating point constant is a string of decimal digits followed by an optional decimal point fractional portion and exponent portion Examples of floating point numbers include 1 75e 10 represented internally as 2202 629A46 4 represented internally as 0200 000046 3 5 represented internally as 01A0 000016 3 2e5 represented internally as 12E3 C00046 A floating point constant can be preceded with a or sign Character constants A character constant is a single character enclosed in single quotes The characters are represented as 8 bit ASCII characters Examples of valid char acter constants include ab represented internally as 0000 006116 represented internally as 0000 004346 Note the difference between character constants and
48. Figure 4 4 Figure 4 4 DSK Memory Map On chip internal RAM 0 and RAM 1 2K total Oh FFFh 1000h 400000h 7FFFFFh 800000h 807FFFh 808000h 8097FFh 809800h 8098FFh 809C00h 809F00 809FCOh 809FC1h M 809FFFh 80A000h OxOBFFFFFh 0x0CO0000h OxODEFFFFh 0x0E00000h OxOEFFFFFh OxOFFFOOOh OxOFFFFFFh Reserved for boot loader operations Boot 1 External USER_BOOT Reserved 32K Peripheral bus memory mapped registers 6K internal RAM block 0 1K word RAM block 1 1K word Kernel The kernel interrupt and trap tables occupy the last 256 Interrupt and trap branches words of RAM 1 External USER_RAM External USER lO External HPI non interlocking Boot 3 External HPI interlocking Functional Overview 4 7 DSK Communications Kernel 4 2 DSK Communications Kernel Data packets Uponreset the host downloads a communications kernelto the C31 using the bootloader This communications kernel provides a set of low level routines that allow the host and the C31 to exchange information and perform debug ging functions The host and the C31 communicate by exchanging packets of data Figure 4 5 shows the structure for data packets The data packet headers shaded section typically consist of four fields command data stream length target address and target index This header is followed by the data stream as shown in Fi
49. G SNVMLIOS uo SU ONT SINSNAONLSNI SVX3UL SHIMMY SE AH arva AHD 96 61 Z SNWG KW SIHHHS JO SOLVES NOISIAHN gawd NMa er SHOLOSNNOO 5 oar SHHOVHH 4 Td SLYOd H 6n S OI a 9a SHdOIG 2 sou SHOLSISHSN a Lao SHOLIOVdVO V HSN HOXIVNOISSG AONTAAAHA LSHH IH G SQVHVAJONOINW NI HAY SHNTYA H NYLIDYAY SWHO NI GV SHNTYA HONYLSISHA OLS S DI NId OZ TIY JO OT NId S OI NId 9T SWVH IHH UIVWHOG NNV UIO D 96 S 9ONVG W H 0P9 9GSNOH GHAONHddWV aLa NOILdAIXDSAA AJA SNOISI AHJA Nx LA TIE TIY do 9T Nid 4O 8 NId SDI NId I Tiw JO L Nid S OI NId O Z IIV JO OZ NId S OI NId vl IIV JO pI Nid gS OI NId 8 IIV AO 8 NId OL GHI IddV SI 22A S OI NId 8 TTY JO p NId OL Gur IddV SI GNDnOND S OI NId 9T OWIZJIOHdS ASIMAAHLO SSH IN TE SALON B 5 DSK Circuit Board Dimensions and Schematic Diagrams Schematics V UL vcc D1 LM7805 plane ji i gt 2 T vi 4 vor N 1N4002 B D2 2 c5 ce c7 cs c9 C10 C11 C12 c52 CaL c54 c56 1 2 ci c2 c3 ca TN2002 DS 4 7UF 1UF 1UF 1UF 1UF 1UF lUF 1UF 1UF lUF lUF 1UF c57 1000uF 4 7U 1UF 1UF 1UF D3 4 4 iet
50. LOADED The LPTx name or handle for a port address depends on the operating system and installed drivers The DSK uses standard port conventions so you might need to use a different port name to get the correct port address For reference the systems LPT cross reference table is given below SYSTEM TABLE LOCATED A LPT1 800x378 RAM ADDRESS 0000 0400 LPT2 0x278 LPT3 800x002 Installing the DSK Assembler and Debugger 2 9 Chapter 3 Overview of a Code Development and Debugging System The DSP Starter Kit DSK lets you experiment with and use a DSP for real time signal processing The DSK gives you the freedom to create your own software to run on the board as is or to build new boards and expand the System in any number of ways The DSK assembler and debugger are software interfaces that help you to develop test and refine DSK assembly language programs This chapter provides an overview of the assembler and debugger and describes the overall code development process Topic Page 3 4 Description of the DSK Assembler 3 2 3 2 Description of the DSK Debugger cseeeeeeeeeeeeeess 3 2 3 3 Developing Code for the DSK ec ee cece eee eee eee eees 3 4 Getting Started eem EIL ER 3 5 3 1 Description of the D
51. LT command pops these push IR1 values followed by a full save push ARO push AR1 E ldp JUMP Get address of command from JUMP table ldi SO_xdata RO Put a zero in the DXR making startup sti RO SOxdata from a stalled port safe for the AIC ldi 0 RO which cannot accept garbage which S RO SO_xdata would reprogram it tstb 4 1F Get here by driving INT2 low bz SR2 Make sure INT2 is active call R_HOST RO command ldi R0O AR1 E addi QJUMP AR1 ldi AR1 AR1 F b AR1 execute command PR RRR RRR RRR RRR RRR ko ke kk ERK RK KK KEK koc kk koc KKK KER KE KK hock KKK kk koc ke kc kc ke kk ke kc ke ke e kk e ek x COMN is used by both the XWRIT and XREAD functions to receive the block transfer length address and address increment value pOCKCKCKCKCk kk RK kk RRR KR KEK ke kc KR KKK KEK KKK kk kk ke kk koc KKK KKK KER KK KEK ke k KEK koe ke ke ke ee COMN call ldi call ldi call ldi subi rers A 8 R HOST RO AR1 R HOST RO ARO R_HOST RO IRL 1 AR1 data packet length Source address Source index t XCTXT ldi CPUCTXT RO Transmit location of context to CPU call W_HOST H b SR2 f SR2 ldi 07F00h ARO Dummy non HPI read releases READY Idi ARO ARO pop AR1 restore ISR variables pop ARO pop IRI R pop RO pop DP andn Ox4 IF A or 4 IE s pop ST reti return to original code Communications Kernel Sourc
52. R or IDLE2 when full speed execution is not required IDLE2 shuts the LOPOWER essentially runs the DSP at 1 16 of full speed and the clock completely off This results in 1 16 and practically zero power for these modes respectively for both the PAL However due to the 25nS propogation delay through the TIBPAL22V10Z2 a wait state is required for host and peripheral decodes and the DSP Memory access times for the SRAM decoded output are as follows t t t t TIBPAL22V10Z CMOS at 50MHz H1 40ns t access H1 1 WS Tpal Td H1L A Tsu D R t access H1 1 WS 25ns 19ns wait states gt 0 1 2 3 4 t access read gt 4 36 76 116 156 IDLE2 wakeup is initiated by asserting the INT2 pin low Since the clock is stopped during IDLE2 gating with synchronized signals cannot A buffer is used with INT2 to avoid differences in the logic thresholds of the PAL22V10 and the C31 and to improve the rise and fall signal be used time of that TRI COLOR LED POWI ER AND PWM If a logic and USI high is applied to PWM default state the outputs UBOOT ERX become an XOR and XOR of TO and Tl The XOR gate in this case is being used to detect the phase angle between TO and Tl Therefor if TO and T1 are configured as outputs such as when the debugger is started the color can be c
53. R7 For integer operations use any register For example Label ADDI 0x0 R4 This instruction adds the integer value 0 to the extended precision register R4 Q prefix the operand is direct address If you use the 9 sign as a prefix the assembler treats the operand as the contents of a 32 bit address specified by addr The 16 MSBs of the address are specified by the DP register the 16 LSBs are specified by the instruction word For example Label LDP 0x0080 ADDI 80x9800 RO The first line of this code sets the DP register to 0x0080 The second line uses the concatenated value of DP and 0x9800 to form an address of 0x0080 9800 The value stored at 0x0080 9800 to is then added the value stored in RO prefix the operand is a register indirect address If you use the sign as a prefix the assembler treats the operand as an indirect address that is it uses the operand as an address For example Label ADDI AR3 RO This instruction adds the integer stored in the location pointed to by AR3 to the value stored in RO Table 5 1 lists the various forms that indirect operands may take The displacement can be specified as a value from 0 255 or as one of the index registers IRO or IR1 Itis not necessary to specify the displacement if itis 1 because the assembler assumes a default displacement of 1 For example ARn is equivalent to ARn 1 Using the DSK Assembler 5 5 Creating DSK Assembler Source Fi
54. SK Assembler Description of the DSK Debugger 3 1 Description of the DSK Assembler The DSK assembler is a simple and easy to use tool Only the most significant features of an assembler have been incorporated However if you want you can create and load COFF files by using the TMS320 floating point DSP as sembly language tools that will also load and run on the DSK Key features of the assembler Quick The DSK assembler differs from many other assemblers because it does not go through a linker phase to create an output file Instead the DSK uses special directives to assemble code at an absolute address during the assembly phase As a result you can create small programs quickly and easily Easy to use If you want to create larger programs you can do this by chaining files together with the include directive 3 2 Description of the DSK Debugger 3 2 The debugger is easy to learn and use Its friendly window oriented interface reduces learning time and eliminates the need to memorize complex com mands The debugger can load and execute code with single step breakpoint and run time halt capabilities The debugger can run and debug your code on an actual C3x DSP as op posed to a simulator which uses a PC to only simulate a DSP Description of the DSK Debugger Figure 3 1 identifies several debugger display features When you invoke the debugger by typing in dsk3d you should see a display similar to this one it
55. Stack pointer initial DSK3D value ST word 0 Status IE word 0 Internal int enable _IF word 0 CPU interrupt flags IOF word 0 I O flags RS word 0 Repeat start RE word 0 Repeat end REG word 0 Repeat counter PG word 0 program counter _FREERUN word 0 1 DSK is free running 0 DSK is HALT ed CPUCTXT word context Communications Kernel Source Code A 7 Communications Kernel Source Code p RRR RRR kk kk ke kk KKK ko KR KK kk KKK ko KKK ke kk KKK ko ke RK KR KR ERK KEK ke kk koc kk ke ke ke ke ke e ke koe ke ke y KERNEL COMMANDS These commands are the primary functions required by the kernel to perform host based communications the avalable memory in such a way as to minimiz The non debugger functions have also b They have b n packed into the kernels size n placed after the debugger commands making it easier to simply allow the application to 7 overwrit the debugger commands PERE ER AR EKA EEK AR EKER EK RE KEE EK ACRCRON AORCKORCOKCRON AR ER REN RK RK ER EK RK HO INTx is the starting point for all host generated commands A host generated command is received when INT2 goes active driven low indicating HPSTB has gone low and that the host would like to transfer a piece of data or command i INTX maxspeed push ST Push ISR variables push DP push RO NOTE A HA
56. TMS320C3x DSP Starter Kit User s Guide TEXAS INSTRUMENTS IMPORTANT NOTICE Texas Instruments TI reserves the right to make changes to its products or to discontinue any semiconductor product or service without notice and advises its customers to obtain the latest version of relevant information to verify before placing orders that the information being relied on is current Tl warrants performance of its semiconductor products and related software to the specifications applicable at the time of sale in accordance with Tl 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 INTENDED AUTHORIZED OR WARRANTED TO BE SUITABLE FOR USE IN LIFE SUPPORT APPLICATIONS DEVICES OR SYSTEMS OR OTHER CRITICAL APPLICATIONS Inclusion of TI products in such applications is understood to be fully at the risk of the customer Use of TI products in such applications requires the written approval of an appropriate TI officer Questions concerning potential risk applications should be directed to TI through a local SC sales offic
57. Tells you how to invoke and use the DSK assembler describes valid source file formats 5 1 Creating DSK Assembler Source Files 00 000 ccc cece cee eee Using valid labels hr lee awe enr lawl yung RIA Ned RU Eos howto cant Using the mnemonic field 06 00 e cece eee eee teenies Using the operand field 0 cece eee tenes Commenting your source file 2 0 cece teens JU MEE COUCHE LEM Binay Moges nete rer ridi qs iubar ad tee S RR Fus Decimal integers ccc cia noue ere aree e be eR EU TER ET Meee eae CE Hexadecimal integers ssssssssssesesssselsls n Floating point constants sssssssseseee IRR Character constants 06 c cece cee hn 5 3 Character Strings 2 0 cece ened e eens DA SYMB See oad edt no Ee ee re ee ee ee eee Constants i ckiehanindeeiaddmtadakd Manta ane i a eb sda tea a de Predefined symbolic constants 00 cece cece ete 5 5 Expression Analyzer 00 0 cect sn 56 Assembling Your Program 2 b x e ed tenir entara c ei EAE IE E 5 7 Placing Code Sections in Memory Locations 0000 cece eee eens 6 Assembler Directives 0 0 ccc eee ee eee Tells you how to use assembler directives and describes the available DSK directive 6 1 Using the DSK Assembler Directives 0 anunn c ccc cee eees 6 2 6 2 Directives That Define Sections 0 0 RI 6 5 Contents 6 3 Di
58. Verifying the Installation 2 6 Step 5 Verifying the Installation To ensure that you have correctly installed your DSK board assembler and debugger enter the following command at the system prompt to start the DSK debugger dsk3d After entering the dsk3d command you should see a display similar to the one shown in Figure 2 3 Figure 2 3 Basic Debugger Display 809c03 809c04 809c05 809c06 809c07 809c08 809c09 809c0a 809c0b 809c0c 809c0d 809c0e 809c0f 809c10 809c11 50700080 08349c2c 07608000 c610c1c0 c610c1c0 08600100 09a09c00 61809c0e 07618000 07628000 07630000 07640000 087b0003 64809cla 02640001 COMMAND Texas Instruments 1994 load testa DISASSEMBLY C31 DSP STARTERS KIT start LDIU 00080h DP 00809c03 SP 008098de LDI 09c2cH SP 00000000 R1 00000000 LDF 0 000000e 00 R0 00000000 R3 00000000 LDI ARO RO LDI AR 00000000 R5 00000000 LDI ARO RO LDI AR 00000000 R7 00000000 LDI 256 R0 00000000 AR1 00000000 LSH 09c00H RO 00000000 AR3 00000000 BRD jump 00000000 AR5 00000000 LDF 0 000000e 00 R1 00000000 AR7 00000000 LDF 0 000000e 00 R2 00000000 IR1 00000000 LDF 1 000000e 00 R3 00000000 RC 00000000 LDF 1 000000e 00 R4 00000000 RE 00000000 LDI 3 RC 00000000 BK 00000000 RPTB block 00000000 IF 00000000 ADDI 1 R4 MEMORY 809800 00000007 fffffffc 00809802 00809827 809804 0080982c 00809839 0080983c 0080983f 809808 00809843 00809842 00809868 0080989a 80980c 008098a9 10800000 0
59. a tions of devices TMS320C3x C Source Debugger User s Guide literature number SPRUO53 tells you howto invoke the C3x emulator evaluation module and simulator versions of the C source debugger interface This book discusses various aspects of the debugger interface including window management command entry code execution data management and breakpoints It also includes a tutorial that introduces basic debugger functionality TMS320C30 Evaluation Module Technical Reference literature number SPRUO69 describes board level operation of the TMS320C30 EVM TMS320 DSP Designer s Notebook Volume 1 literature number SPRT125 collection of designer s notebook pages TMS320C40 Data Sheet literature number SLASO14 describes the analog interface circuit device and gives its electrical specifications If You Need Assistance If you want to Visit TI online If You Need Assistance Contact Texas Instruments at World Wide Web http www ti com Receive general information or assistance World Wide Web North America South America Europe Middle East Africa Dutch English French Italian German Japan Japanese or English Domestic toll free International Korea Korean or English Taiwan Chinese or English http www ti com sc docs pic home htm 214 644 5580 33 1 3070 1166 33 1 3070 1165 33 1 3070 1164 33 1 3070 1167 33 1 3070 1168 0120 81 0026 81 3 345
60. ample Here is an example of the entry directive Start code 0x809800 Create a named section to assemble to sect code 4 use the new section entry BEGIN Start program at BEGIN BEGIN ldi 80h ARO Initialize ARx pointers to RAMO lsh 16 ARO0 ldi AR0 AR1 Lo 0 R3 R3 is used as loop counter LABO ldi ARO 0 RO Both labels resolve to the same address LAB1 ldi AR1 1 R1 Colon is recongized as a WS character RO contains the opcode at BEGIN Rl contains the opcode at BEGIN 1 count addi l R3 Add 1 to count b count Wait in count loop forever 6 20 Syntax Description Example Initialize TMS320C3x Floating Point Value PI float float16 float8 pfloat16 pfloat8 float value valuen float16 value valuen float8 value value y pfloat16 value values pfloat8 value values These directive convert one or more values into TMS320C3x floating point constants m LI The float directive converts a value into a 32 bit TMS320C3x floating point constant This format has an 8 bit exponent and a 24 bit mantissa The float16 directive converts a value into a 16 bit TMS320C3x floating point constant This format has an 8 bit exponent and an 8 bit mantissa The float8 directive converts a value into an 8 bit TMS320C3x floating point constant This format has a 4 bit exponent and a 4 bit mantissa When properly scaled this format
61. as a TMS320C31 on board to allow full speed verification of the TMS320C3x code The DSK also gives you the freedom to build new boards create your own software on a host PC down load the software to the DSK and run the software on the DSK board The supplied debugger is windows oriented simplifying code development and debugging capabilities Topic Page 1 1 Key Features of the DSK RUE 1 2 12 DSK OvervIew e eI aE EE ALEA EE nnn eee 1 3 Key Features of the DSK 1 1 Key Features of the DSK This section details the key features of the TMS320C3x DSP Starter Kit d d m m Industry standard TMS320C31 floating point DSP 40 ns instruction cycle time 50 MFLOPS 25 MIPS Standard or enhanced parallel printer port interface which connects to a host PC and allows the TMS320C31 to communicate with PC programs Analog data acquisition via the TLC32040 analog interface circuit AIC B Variable rate analog to digital converter ADC and digital to analog converter DAC with 14 bit dynamic range at 20 000 samples per se cond B Output reconstruction filter and bypassable switched capacitor anti alias input filter Standard RCA plug connectors for analog input and output that provide a direct connection to microphone and speaker XDS510 emulator connector Note Jumper and header are not installed Ly Expansion connectors which route all the TMS320C31 pins for use wi
62. ations with the value 0x0 Paws 3 0x5555 Fill three words with 0x5555 start Mysect 0x809800 Initialize start of Mysect sect Mysect H COXL data Assembler Directives 6 29 Start Link Section to Address Syntax Description Example 6 30 start section name address The start directive links the section name to start at location address This directive effectively gives the DSK assemblerthe same functionality as a linker command file when used only to create runtime executable modules For the specified section to have a valid starting address the start statement for the section must precede the text data or sect directive that defines the section name Note that by using an include file with an imbedded if sdef endif the Start directive can effectively be used in place of the linker Here is an example of the start directive entry START Sstart MAIN 0x809800 Create an output sections Sect MAIN Begin assembling into MAIN LOOP addi 1 R0 Top of loop addi TRI START ldi 0 RO Initialize RO R1 ldi 0 R1 b LOOP Go to top of loop Syntax Description Example Initialize Text string String string stringn The string directive places one or more 8 bit character strings into consecu tive bytes of the current section The character string must be enclosed in double quotes Each character ina string represents a separate value The string di
63. ayed or modified usually under the supervision of a host debugger routine An XRUNF or XSTEP command indicates to the CPU that it needs to restore the context area to its correct running state and then continue execution The host accesses the C31 s context save area by looking up the pointer to the context through the XCTXT command Interrupts DSK Communications Kernel The communications kernel implements breakpoints by replacing the code at the desired location with a TRAPn opcode When the CPU encounters a TRAP the context save routine is invoked the CPU enters spin mode writes an acknowledge to the host and waits for a new command While in spin mode the CPU can receive new interrupts Thecommunications kernel implements CPU halt XHALT in a manner similar to breakpoint halts but the interrupt source originates from the host not a TRAP opcode The main difference is that the registers used by the commu nications kernel are restored before invoking a full context save and falling into spin mode The kernel implements XRUN by restoring the context followed by a standard return from interrupt The processor is then free to execute code The communications kernel implements the opcode XSTEP by using a reserved interrupt in the C31 Serial Port 1 transmit interrupt XINT1 Figure 4 6 on page 4 12 shows the single step routine flow diagram The communications kernel Restores the context of the CPU Places the program count
64. bel a blank an asterisk or a semicolon Labels are optional if you use them they must begin in column 1 One or more blanks must separate each field Note that tab characters are equivalent to blanks Comments are optional Comments that begin in column 1 can begin with an asterisk or a semicolon or but comments that begin in any other column must begin with a semicolon Using valid labels Creating DSK Assembler Source Files Labels are optional for all assembly language instructions and for most but not all assembler directives When you use them a label must begin in col umn 1 of a source statement A label can contain up to eight alphanumeric characters A Z a z 0 9 and Labels are case sensitive and the first character cannot be a number For example Start text 0x809C00 entry start CTRL set 0 IN set 1 OUT set 2 EOXt WSHIFT word 8 start ldp stack Load data page Idi stack SP Initialize the stack ldf 0 0 R0 Idi 0x100 R0 lsh WSHIFT RO BRD jump ldf 0 0 R1 ldf 0 0 R2 ldf 1 0 R3 jump ldf 1 0 R4 b start stack word 1 end In the preceding example the colon appended to the jump label is optional The DSK assembler does not require a label terminator When you use a label its value is the current value of the section program counter the label points to the statement it s associated with If for example you use the int directive to initialize several words a
65. can be used for quick logarithm approxi mations The pfloati6 directive converts a value into a 16 bit floating point constant The values are packed into consecutive fields of memory The pfloat8 directive converts a value into an 8 bit floating point constant The values are packed into consecutive fields of memory The value is a required parameter it is an expression that is evaluated and placed in the constant The value must be absolute Note that the C31 expects floating point numbers to have the 32 bit format Here is an example of these directives set 3 1415926 Set remembers PI is float float 10 3 0 1 0 0 1 PI 2 PI Some easy to compare values float8 10 3 0 1 0 0 1 PI 2 PI pfloat8 10 3 0 1 0 0 1 PI 2 PI floatl6 10 3 0 1 0 0 1 PI 2 PI pfloati16 10 3 0 1 0 0 1 PI 2 PI AE 10 3 0 1 0 0 1 PI 2 PI Assembler Directives 6 21 leee Initialize IEEE Format Floating Point Value Syntax Description Example ieee expression The ieee directive places the IEEE single precision floating point representa tion of a single floating point constant into three bytes in the current section The expressionis a required parameter itis an expression that must evaluate to a floating point constant Each constant is converted to a floating point value in IEEE single precision 32 bit format Here is an example of the ieee directive ieee 1 0 3 O 1 0 0 1 PL
66. cation Data Format eal El D13 D12 D11 D10 D9 pe ES D6 D5 D4 D3 D2 D1 aa TA register value unsigned RA register value unsigned EN register value signed 2s ESE register value signed 2s complement complement ER TB register value unsigned al RB register value unsigned ESESESESETEIESEI Control register TLC32040 AIC Initialization Figure 4 9 describes the control register bit fields Figure 4 9 Control Register Bit Fields D7 D6 D5 Loopback Bandpass Input Gain Transmit Receive AUX IN Pins Function Filter 0 0 1X for 6V analog input 0 asynchronous 0 disables 0 disables 0 deletes 0 1 2X for 3V analog input 1 enables 1 enables 1 enables 1 inserts 1 0 4X for 1 5V analog input 1 1 1X for 6V analog input The assembly code in Example 4 2 sets the TA and TB registers of the AIC This code transmits a 16 bit word to the AIC and then waits until the transmit interrupt is generated by the serial port Four commands are transmitted start ing with a 0 then the TB and RB values followed by the TA and RA values and finally the control word TA and RA values should be the last values trans mitted since they change the AIC sample rate By transmitting these values last the sample rate is not changed until the AIC receives the last program word In this way very high sample rates can be achieved Each command transmits three 16 bit words a primary communication a secondary commu n
67. clh Timer global control register value ldp TGCRO Set Data Page ldi Oh R4 Initialize R4 to zero ldi lh RO Initialize RO to 1 sti R4 TGCRO Reset timer0O sti RO TPRO Store timerO period sti R4 TCNTO Reset timer0 counter ldi TIMVAL R7 Load timer control value sti R7 TGCRO Start timer 0 A period of zero is not allowed in pulse mode If the timer is run in clock mode the resulting output is a square wave with a frequency of half that of pulse mode A period of zero is allowed in this mode resulting in a 12 5 MHz clock Initializing the C31 serial port This subsection explains how to initialize the following 1 C31 serial port C31 serial port control register memory mapped to 0x0080 8040h FSX DX CLKX control register memory mapped to 0x0080 8042h FSR DR CLKR control register memory mapped to 0x0080 8043h For a detailed description of the C31 serial port see the TMS320C3x User s Guide Functional Overview 4 15 TLC32040 AIC Initialization The C31 assembly code in Example 4 1 initializes the serial port global con trol register SGCR0O in the following manner Issuing transmit and receive resets Enabling receive and transmit interrupts Setting 16 bit receive and transmit transfers Setting FSX and FSR CLKX and CLKR active low Setting continuous mode 1 Setting variable data rate transfers L Example 4 1 Initialize the Serial Port Global Control Reg
68. code into data memory The data section normally contains tables of data or preinitial ized variables Note that the assembler assumes that text is the default section Therefore at the beginning of an assembly the assembler assembles code into the text section unless you specify a section control directive This example shows how to assemble code into the data and text sections start data 0x809900 entry BEGIN BEGIN ldi 0 RO Initialize RO and R1 ldi 1 R1 data value int 0 1 2 3 4 5 Integer values End Assembly end Syntax end Description The end directive is an optional directive that terminates assembly It should be the last source statement of a program The assembler ignores any source statements that follow an end directive Example This example shows how the end directive terminates assembly ldi 1 R1 Assemble this code mpyi SRI end Stop assembler subi 2 R1 does not assemble Assembler Directives 6 19 entry Define Entry Point Syntax entry value Description The entry directive tells the assembler the address of the section program counter when file is loaded If you do not use the value parameter the current program memory address determined by the text section becomes the start ing address If you have more than one entry directive in your file then the last entry directive encountered becomes the starting address of your code Ex
69. de into Mysect entry START Execution START point START LDI 0 RO Initialize R0 0 LOOP ADDI 1 R0 Increment RO B LOOP Do it again To place two sections of code that leave a hole of unused memory look at the following code The first section Mysect which starts at location 0x0080 9800 is followed by a second section jumpback which starts at location 0x0080 9900 Start Mysect 0x809800 Mysect begins at 0x809800 sect Mysect Assemble code into Mysect entry START Execution START point START LDI 0 RO Initialize R0 0 LOOP ADDI 1 RO0 Increment RO B JUMP 1 oe start jumpback 0x809900 jumpback begins at 0x809900 Ssect jumpback Assemble code into jumpback JUMP1 ADDI 1 R0 Increment RO B JUMP2 pte ee e gelo n pu eed tel sect Mysect Add more code to Mysect JUMP2 ADDI 1 RO0 Increment RO B LOOP Finish LOOP Placing Code Sections in Memory Locations To simulate a linker command file such as the one used in the TMS320 code generation tools you can use a single file to control the starting address of all sections and then use the include directive to append all assembly source files For example consider the following build file where three source files are appended to each other using a common block statement for several start directives BUILD ASM pe start text 0x809800 Initialize start address for each section start data 0x809C00 i start secti1 0x809900
70. de one of the referenc frequencies in thr phases seperated by 2 pi 3 radians By then using one of the DSP timers for the other reference a variable frequency 3 phase output can be constructed NOTE The amplitude of the PWM triangle wave cannot be controlled from A the timers alone Either the DSP would have to continuously calculate the ouptuts as a DC reference or an external circuit E would have to chop the output i i STRB o0 A23 H1 VCC Ql LE d 4d Ld g i 4 4 4 4 3 2 1 28 27 26 i A22 5 25 UW A21 16 24 UX A20 7 23 SRAM 8 22 DEMO 9 21 RDY TCK1 10 20 INT2 TCK0 11 19 UBOOT rd A 12 13 14 15 16 17 18 t qp L4 R 4 4 4 Ld Ld R W GND HPS HPA TRI UR B 12 Host Interface Control Design Notes NC CLK STRB A23 A22 A21 A20 NC DEMO T1 TO RW TRI GND C HPIS USERR HPIA UBOOT INT2 READY NC SRAM USERX USERW Q1 Q0 VCC global EQUATIONS READY TRST TRI H INT2 TRST TRI INT2 HPIS A HPIA A23 A22 A21 STRB TRI 245 enable and HPIA Q0 INT2 Ist tap Ql QO 2nd tap for pulse gen READY Q0 Q1 A23 A22 A21 A20 STRB A23 A22 A21 A20 STRB SRAM A23 A22 STRB USERR A23 A22 A21 STRB RW USERW
71. develop real time signal processing applications In addition to performing full speed verification of your TMS320C3x code the DSK has expansion headers that allow you to build new daughterboards to expand your system This chapter details the functionality of the hardware and the software Topic Page 431 DSK Hardware Interface lees nnn 1 2 4 2 DSK Communications Kernel eene 4 3 TE632040 AIC initialization c 00e coco ecu cepe ien eee 4 42 Host Software 5 cem elemen ssi eis lesa eie e hee e cave 4 23 4 1 DSK Hardware Interface 4 1 DSK Hardware Interface The C3x DSK starts up by responding to a host reset command and bootload ing a communications kernel or a program that you supply The communica tions kernel provides the necessary I O for interfacing the DSK board and the host system Host communications occur through the parallel bus of the C31 while analog I O is handled by the TL C32040 analog interface circuit AIC and sent to the C31 s serial port See Appendix A Communications Kernel Source Code for more information Host hardware interface 4 2 The host interface connects the C31 parallel bus to the host PC parallel printer port It consists of three devices A programmable array logic TICPAL22V10Z Two high speed octal bus transceivers with tri state outputs 74ACT245 The programmable array logic PAL determines when the C31 is accessing t
72. e In order to minimize risks associated with the customer s applications adequate design and operating safeguards should be provided by the customer to minimize inherent or procedural hazards Tl assumes no liability for applications assistance customer product design software performance or infringement of patents or services described herein Nor does TI 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 Copyright 1996 Texas Instruments Incorporated Preface Read This First About This Manual This book describes the DSP digital signal processing Starter Kit DSK and how to use the DSK with these tools The DSK assembler The DSK debugger How to Use This Manual The goal of this book is to help you learn how to use the DSK assembler and debugger This book is divided into four distinct parts Part I Hands On Information is presented first so that you can start using your DSK the same day you receive it B Chapter 1 describes the features and provides an overview of the TMS320C3x DSP Starter Kit B Chapter 2 contains installation instructions for your assembler and debugger It lists the hardware and software tools you ll need to use the DSK and tells you
73. e selection The AIC sends the data value to the D A converter and enables one of the modes shown in Table 4 2 depending on the two LSBs Functional Overview 4 17 TLC32040 AIC Initialization Table 4 2 Primary Communications Mode Selection LSBs Mode 00 Tx Counter A TA Rx Counter A RA Tx Counter B TB Rx Counter B x RB 01 Tx Counter A TA TA Rx Counter A RA RA Tx Counter B TB Rx Counter B RB 10 Tx Counter A TA TA Rx Counter A RA RA Tx Counter B TB Rx Counter B RB 11 Tx Counter A TA Rx Counter A RA Tx Counter B TB Rx Counter B RB The second and third modes use the TA and RA registers to advance or slow down the sampling frequency by shortening or lengthening the sample period This is particularly useful in modem applications It can also enhance the sig nal to noise performance perform frequency tracking functions and gener ate nonstandard modem frequencies Secondary communications Secondary communication follows a primary communication that has the two LSBs set to 11 This secondary communication programs the AIC by loading the A A B or control registers Figure 4 8 shows the secondary communica tion data format The TA RA TB and RB values are unsigned The TA and RA values are in signed 2s complement format The control register enables and disables auxiliary inputs bandpass filters and so forth Figure 4 8 Secondary Communi
74. e Code The XCTXT command returns the address of the context save area to the host Subsequently the host can use this address to get and put the CPU registers to modify the exectution of the processor SR2 is the short common return sequence used by most commands when executed the return will send the CPU back to the users code TMS320C31 SECONDARY VECTOR TABLE When the TMS320C31 receives an interrupt it first fetches an address from the primary vector table located in the bootloader ROM This 32 bit value is then used as an address where the new execution begins Since it is impossible to relocate the vector table or modify the contents of the bootloader ROM a secondary or branch vector table is used to direct execution to the correct routines In this case the C3l s primary vector table has been filled with interrupt routine addresses which point to the upper memory of internal RAM beginning at 0x809FCO Since these locations are were execution actually begins and can be modified a branch opcode can be used to direct execution to the desired location sect vectors INTO b 0x809FC1 0x001 INT1 b Ox809FC2 0x002 INT2 b INTXxX 0x809FC3 0x004 HPI INT3 b 0x809FC4 0x008 XINTO b Ox809FC5 0x010 RINTO b Ox809FC6 0x020 XINT1 b SSTEP Ox809FC7 0x040 lt SSTEP RINT1 b SSTEP TRAPFIX O
75. e one or more values into the current section The byte directive places 8 bit values into consecutive words in the current section The value must be an expression that evaluates to a number within 128 and 127 The upper 24 bits are 0 The int directive places 16 bit values into consecutive words in the current section The value must be an expression that evaluates to a number within the range of 32768 and 32767 The upper 16 bits are always 0 The long and word directives place 32 bit values into consecutive words in the current section The valueis an expression that the assembler eval uates and treats as a 32 bit signed number A value must be absolute You can use as many values as fit on a single line 80 characters If you use a label it points to the first word that is initialized Here is an example of these directives word A BY C 1 0x1234 0320C31h int 111b 1 lt lt 4 long 0x87654321 1 31 byte 0x20 At B TQ hword 32765 1 32768 2 2 Syntax Description Example Copy Source File copy include copy filename include filename The copy and include directives tell the assembler to read source state ments from a different file The assembler 1 Stops assembling statements in the current source file 2 Assembles the statements in the copied included file 3 Resumes assembling statements in the main source file starting with the statement that follows t
76. e special typeface to distinguish commands that you enter from items that the system displays such as prompts command output error messages etc Hereis a sample program listing of a bit file generated by the accumulator 0x00809800 directive word 1 2 3 0x00809800 0x00000001 word 0x00809801 0x00000002 word 0x00809802 0x00000003 word Here is an example of a system prompt and a command that you might enter C dsk3a testa In syntax descriptions the instruction command or directive is in a bold typeface font and parameters are in an italic typeface Portions of a syntax that are in bold should be entered as shown portions of a syntax that are in italics describe the type of information that should be entered Syntax that is entered on a command line is centered in a bounded box Syntax that is used in a text file is left justified in an unbounded box Here is an example of command line syntax dsk3a filename dsk3a is a command The command invokes the assembler and has one parameter filename which is required When you invoke the assembler you supply the name of the file that the assembler uses as input Note that int does not begin in column 1 d Notational Conventions Information About Warnings In assembler syntax statements column 1 is reserved for the first charac ter of a label or symbol If the label or symbol is optional it is usually not shown If itis a required parameter it is s
77. ectives tell the assembler to begin reading source statements from another file When the assembler finishes reading the source statements in the copy include file it resumes reading source statements from the current file Assembler Directives 6 9 Directives That Enable Conditional Assembly 6 5 Directives That Enable Conditional Assembly Conditional assembly directives enable you to instruct the assembler to as semble certain sections of code according to a true or false evaluation of an expression Two sets of directives allow you to assemble conditional blocks of code The if else endif directives tell the assembler to assemble a block of code according to a true or false evaluation of an expression Note that you cannot nest if statements f well defined expression marks the beginning of a conditional block and assembles code ifthe if well defined expression is true else marks a block of code to be assembled if the if well defined expression is false endif marks the end of a conditional block and terminates the block The loop break endloop directives tell the assembler to repeatedly as semble a block of code according to the evaluation of an expression loop well defined expression marks the beginning a repeatable block of code The optional expression evaluates to the loop count endloop marks the end of a repeatable block Directives That Align the Section Program Counter Directives That Defi
78. ed in Chapter 5 Using the DSK Assembler and Chapter 7 Using the DSK Debugger Functional Overview 4 23 getmem putmem Host Software Host communications target routines Syntax Description Arguments Return Value Syntax Description Arguments Return Value 4 24 The communications kernel resident in the C31 assumes that data transfers to and from the host are organized into packets as shown in Figure 4 5 on page 4 8 The target cpp file includes routines that manipulate data transmis sions between the host and the C31 into this packet structure These routines read and write blocks of data from the C31 memory send commands to the C31 perform context save and restores and provide debugging commands such as run single step and halt Get Memory MSGS getmem ulong addr ulong length ulong data The getmem routine reads a block of data from the C31 memory addr Address of the data to be read length Size of memory block to read data Pointer to host memory address in which to place data read from the C31 NO ERR Block read completed successfully RECV ERR Failed reception XMIT ERR Failed transmission Put Memory MSGS putmem ulong addr ulong length ulong data The putmem routine writes a block of data into C31 memory addr Starting address to write the data to length Size of memory block to write data Pointer to host memory address to read data from The data is then placed into C31 memo
79. eee 4 2 Parallel Port Control Register OX87A 0 00 eects 4 3 Parallel Port Status Register 0x379 0 c eens 4 4 DSK Memory Map 42 eserkoecel he ee ER ERES ie aa da a E CES a a E a 4 5 Data Packet Structure sneon oaa aa aa i a a 4 6 Single Step Flow Diagram 0c cece ceed eee eens 4 7 Primary Communication Data Format 0000 cece eee eee teeta 4 8 Secondary Communication Data Format 0c cece cece lees 4 9 Control Register Bit Fields 0 0 c cece eens 7 1 DISASSEMBLY Window sssssssssssse eee eee e eee ee 7 2 CPU REGISTER WindOW 4 22 22 tasna ace aaia aed Haneda Y e eee aa 7 3 MEMORY WIBdOW 2 2 14 sau Edi RR de ep CR ER Rus QI LR RE Eee ed aR as 7 4 COMMAND Window sads masaren a a ss Rn n 7 5 Monitor Information Screen 1 6 eee sen B 1 TMS320C3x DSP Starter Kit DSK Circuit Board Dimensions Xii Tables 4 1 Single Step Pipeline Flow sssuuessssssssses III 4 2 Primary Communications Mode Selection 000 cece eee eee eee 5 1 Indirect Addressing isana dinaa anaa aa aa a a a Daai a aota Rn 5 2 ANSI C Math Library Functions Supported by the DSK Assembler 5 3 Operators Used in Expressions 0 0000 c cece eee eee eee eee eens 5 4 Summary of Assembler Options 0000 000 cece eee eee eee 6 1 Assembler Directives Summary 60 0000 cece eee ee 7 1 Summary of
80. ement PC definition pfloat16 direc pfloat8 directive 6 8 power requirements predefined symbols tive 6 21 primary communications print screen function key method 7 14 program assembling 5 15 entry point definition putmem 4 24 qxx directive raw data definition recv long 4 28 recv long byt required files Index 4 e 1 3 to 4 18 reset RUN CPU sdef directive secondary communications to 4 22 control register bit fields data format sect directive 6 5 6 27 section definition section program counter See SPC serial port definition identifying set directive set directi 11 single step definition C 5 singlestep function key us 7 13 7 14 single step flow diagram single step pipeline flow software breakpoints a BA command BD command BL command clearing 7 9 listing 7 9 setting 7 9 software checklist source listings 5 2 statement format comment field label field mnemonic field operand field 5 5 number source iq 5 4 source file definition source files 5 2 to 5 7 commenting 5 7 to labeling 5 3 to opcodes 5 4 to space directive SPC assigning a label to value associated with labels SSTEP CPU start directive 6 30 string directive e 9 e 31 symbol definition symbolic constants 5 11 symbols predefined target cpp 4 23 lext directive timer period register value maximum minimum TLC
81. ent appears in the DIS ASSEMBLY window After execution is halted by a breakpoint you can continue program execution by reissuing any of the run or single step commands You can set a software breakpoint by entering the SB command sb addr If you know the address where you d like to set a software breakpoint you can use the SB command This command is useful because it doesn t require you to search through code to find the desired line When you enter the SB com mand you enter an absolute address addr Once you have entered the ad dress you are asked to choose the line number you want the breakpoint set on Note that you cannot set multiple breakpoints at the same statement Clearing a software breakpoint cb addr f you d like to clear a breakpoint you can use the CB command You can use the CB command to clear a specific address by entering an absolute address addr after the command You can clear all breakpoints by entering the CB command without an address Finding the software breakpoints that are set db Sometimes you may need to know where software breakpoints are set The DB command provides an easy way to get a complete listing of all the software breakpoints that are currently set in your program Using the DSK Debugger 7 9 Debugger Commands 7 5 Debugger Commands The following tables provide a summary of the debugger function keys and commands Table 7 3 Command Line Editing Table 7 4 Command Line
82. er into R5 Clears INT2 Sets the XINT1 interrupt Restores the status register Sets a delayed branch on R5 D D UD D D C The delayed branch executes the next three instructions 1 Sets the global interrupt enable 2 Restores R5 3 Restores the data page pointer By coordinating the setting of the XINT1 interrupt and the branch to the user program the kernel allows only a single instruction to execute before servicing the pending interrupt When the interrupt is recognized the kernel saves the CPU context sends an acknowledge to the host branches to the spin mode and waits for a new command Functional Overview 4 11 DSK Communications Kernel Figure 4 6 Single Step Flow Diagram 4 12 Q PC R5 CINT2 IF 4 IF 2000h ST _R5 R5 _DP DP Context restore return to PC from TOS return Clear Poll INT2 before SSTEP or RUNF Set XINIT1 interrupt restore Status turn on INT s restore DP Fetch one user opcode XINT1 occurs Context save Send trap acknowledge to host Wait in spin loop Table 4 1 Single Step Pipeline Flow Cycle 1 2 N o oc A 10 11 12 13 Description Set global interrupt enable Interrupt recognized Jam interrupt discard USER2 fetch Execute USER1 instruction Clear interrupt flag clear GIE store return address on stack read vector table Pipeline begins to fill with interrupt service routine Pipeline continues to fi
83. er when preparing a program for debugging dsk3a filename options dsk3a is the command that invokes the assembler filename is the assembly language source file Filenames are not case sensitive If you do not specify an extension the assembler assumes the default extension asm options affect the way the assembler processes input files You can specify options and filenames in any order on the command line Table 5 4 lists the assembler options the following subsections describe the options Table 5 4 Summary of Assembler Options Option Description Exxx Stops assembling after xxx error messages occur 5 is the default Q Suppresses the banner and all progress information quiet Wxxx Stops assembling after xxx warning messages occur Using the DSK Assembler 5 15 Placing Code Sections in Memory Locations 5 7 Placing Code Sections in Memory Locations The assembly source contains several sections that must be placed in C31 memory locations because the DSK assembler includes several new direc tives that control the starting address of the sections A linker is not needed In the following code example an output section named Mysect is placed be ginning at address 000x80 9800 The entry execution start point is then de fined atthe label START Next a simple code loop that increments RO is placed into the current section Start Mysect 0x809800 Mysect begins at 0x809800 sect Mysect Assemble co
84. for long or noisy cables Enables Windows Time Slice management Disables Windows Time Slice management and enables set or clear interrupt STI CLI Displaying a list of available options or Help option You can display the contents of Table 7 1 on your screen by using the or Help option For example enter dsk3d Invoking the Debugger Selecting the parallel printer port LPT 3 or LPT option The LPT option selects a parallel printer port from the host to communicate with the DSK Parallel Printer Port Functions LPT1 or LPT 1 Selects printer port hardware at I O address 0x378 LPT2 or LPT 2 Selects printer port hardware at I O address 0x278 LPT3 or LPT 3 Selects printer port hardware at I O address Ox3BC V7 1 Note Some EISA machines and IBM PS 2s use a different naming convention for the LPTx AT Convention EISA and PS 2 I O Address LPT1 LPT2 0x378 LPT2 LPT3 0x278 LPT3 LPT1 Ox3BC Select the parallel printer port at a particular address PORT option The port option selects the parallel printer port at the given address For example port 0x378 selects the host s parallel port mapped to the address 0x378 p A A M 7Z Note Use this option with extreme care since any base address can be used LLLLL X O OO C OeOo e
85. g file An output file created by the assembler that lists source state ments their line numbers and any unresolved symbols or opcodes LSB Least significant bit LSByte Least significant byte Glossary C 3 Glossary C4 member An element or variable of a structure union or enumeration memory map Amapoftarget system memory space that is partitioned into functional blocks mnemonic An instruction name that the assembler translates into machine code MSB Most significant bit MSByte Most significant byte named section 1 Aninitialized section that is defined with a sectdirective or 2 an uninitialized section that is defined with a usect directive object file A file that has been assembled and contains machine language object code operand The arguments or parameters of an assembly language instruc tion assembler directive or macro directive options Command parameters that allow you to request additional or spe cific functions when you invoke a software tool PC Personal computer or program counter depending on the context and how it s used In this book installation instructions or in information relat ing to hardware and boards PC means Personal Computer as in IBM PC In general debugger and program related information PC means Program Counter which is the register that identifies the current state ment in your program parallel port The parallel printer port interface is primarily
86. gnals Host interface logic The host interface logic consists of a program mable array logic PAL 22V10Z and two high speed octal bus transceiv ers with tri state outputs 74ACT245 These devices interface the C31 with the host parallel printer port This interface logic supports 8 bit bidirec tional or 4 bit unidirectional data modes of the PC host Oscillator The on board 50Mhz oscillator drives the C31 clock input The C31 internal clock value is divided by 1 same frequency Parallel printer port connector The DB25 25 pin connector connects directly to the host parallel printer port RCA jacks The RCA jacks supply analog input or output and are routed to the I O pins of the AIC Resettable fuses The polyswitch resettable fuses interrupt the flow of excessive current The fuses reset after they cool down and the faulty condition is corrected The fuses require no manual resetting or replace ment TLC32040 AIC The analog interface circuit provides the C31 access to the analog world The AIC samples analog data and converts it into a digital stream for C31 analysis The C31 operates on this digital data and returns the transformed digital data to the AIC for conversion into an ana log signal TMS320C31 The main processor is a 32 bit floating point digital signal processor You develop application code and load it to the on chip memory ofthe C31 This code can be executed single stepped and v
87. gure 4 5 The header fields are described as follows Command directs the handling of the packets See the Commands sec tion page 4 9 for more information Data stream length indicates the length of data in the data stream Target address points to the memory location where data is read from or written to Target index post increments the value of the target address after a read or write of a single data item Figure 4 5 Data Packet Structure 4 8 Data stream length Target address Target index DSK Communications Kernel Commands When the C31 receives an interrupt from the host INT2 the C31 saves the current state of the CPU and then receives a packet Once the C31 receives the packet the communications kernel analyzes the command entry in the header to direct the handling of the packet The command entry provides the low level routines necessary to communicate with the host and debug the sys tem The communications kernel supports these commands XWRIT Write a block of data from the host to the DSK This command takes data stream length items from the host and writes them into the C31 s memory location pointed to by the target address The target address is incremented by the target index after each write operation XREAD Read a block of data from the DSK to the host This command reads data stream length items from the C31 s memory location pointed at by the target address and sends them
88. he copy or include directive The filename is a required parameter that names a source file The filename must be enclosed in double quotes and mustfollow operating system conven tions You can specify a full pathname for example c dsktools file1 asm If you do not specify a full pathname the assembler searches for the file in the current directory The copy and include directives can be nested within a file that is copied or included the assembler limits this type of nesting to eight levels the host operating system may set additional restrictions This example shows how the include directive is used to tell the assembler to read and assemble source statements from other files then to resume assembling into the current file Source file source asm Filename source asm Filename source asm Filename source asm Filename source asm Filename source asm Space 10h include byte asm Ne Ne Ne Ne Ne Space 20h First copy file byte asm Filename byte asm byte a Oah 32 Filename byte asm include word asm Filename byte asm byte 11 12 13 Filename byte asm Ne Ne Ne Ne Ne Filename byte asm Second copy file word asm Filename word asm word oabcdh 56 Filename word asm Filename word asm Assembler Directives 6 17 data Assemble Into data Section Syntax Description Example data The data directive tells the assembler to begin assembling source
89. he DSK is receiving power then the LED will illuminate either red or green Some operating systems do not use conventional AT I O port addresses when mapping port names to addresses For example an EISA PC or IBM PS 2 might assign port OX3BC as LPT1 instead of LPT3 If this is the case you should use LPT3 to start the DSK since the DSK works from a physical address instead of the port name LPTx The last three lines of Example 2 1 show the operating system s lookup table located at RAM address 0000 0040 that maps physical addresses to port names This may help you to determine which ports are in use and which name is associated with each port for a particular address The information in the lookup table in Example 2 1 may not be accurate since network and operating system soft ware also uses this table for redirecting printer output Step 5 Verifying the Installation Example 2 1 Port Selection Display TESTING TMS320C3x DSK RESET AT PORT 0x378 LPT1 gt gt gt gt HPACK ERROR pin did not go high during reset SELECT LPT1 0x378 alternate LPT2 LPT2 0x278 alternate LPT3 LPT3 0x3BC alternate LPT1 dditional online help K TARGET POWER LED IS RED O EN PORT SELECTION I O CONNECTIONS AND CABLES POWER CONSERVATION SOFTWARE LAPTOPS AUTOEXEC BAT CONFIG SYS AND BIOS DAUGHTER CARDS VERY OLD PRINTER PORTS WITHOUT PULLUPS PRE 1986 IF THE LED IS CYCLING R Y G THE KERNEL HAS
90. he host interface by using the STROBE A23 A22 A21 and A20 signals to decode the address of the C31 The PAL provides one input TRI that disconnects the host interface by tri stating the PAL INT2 and READY signals The PAL provides five address decode outputs USER IOR USER IOW USER IO USER RAM USER BOOT and three outputs READY INT2 and EN signals When the DEMO signal is pulled high two of the address decode outputs USER IO and USER BOOT drive the tri color LED The bus transceivers buffer data between the PC parallel printer port and the C31 parallel bus The host interface supports two types of transfers The8 bit bidirectional mode allows faster transfers on parallel printer ports that support bidirectional transfers O Unidirectional printer ports support an 8 bit transfer from the host to the C31 while supporting 4 bit transfers from the C31 to the host Figure 4 1 shows a high level circuit diagram of the C3x DSK DSK Hardware Interface Figure 4 1 TMS320C3x DSK Functional Circuit Diagram INIT RESET PSTROBE HPSTB A Voc x A LTICPAL22V102 25 USER IOW Address USER RAM decode IN IN OUT FSR OUT SCLK TLC32040 Functional Overview 4 3 DSK Hardware Interface Host communications
91. host uses the ERROR signal to acknowledge that the C31 is already sending data When the host receives the HPIA signal it drives PSTROBE low and the host reads a byte or 4 bit nibble depending on whether a bidirectional par allel printer is present in the host The host drives the HPSTB signal high indicating to the C31 that the data was read The PAL detects the rising edge of HPSTB and drives the C31 s READY signal low concluding the C31 write cycle This completes the C31 read cycle This process is repeated until all four bytes or eight nibbles are transferred least significant byte first During each transfer the host pieces the bytes together to form a 32 bit word NT 7Z Note During the bootload process the C31 does not read the third and fourth bytes of the first 32 bit word The bootloader acts as if itis reading from an EPROM and skips these bytes LLLLLL L AX a Functional Overview 4 5 DSK Hardware Interface TLC32040 AIC hardware interface 4 6 The TLC32040 analog interface circuit AIC on the DSK provides Asingle channel input output analog interface with 14 bit dynamic range ADC and DAC 1 Variable ADC and DAC sampling rate with 14 bit precision at 20 000 sam ples per second Output reconstruction filter Bypassable switched capacitor antialiasing input filter Selectable auxil
92. how to set up its environment B Chapter 3 lists the key features of the assembler and debugger and tells you the steps you need to take to assemble and debug your program Part Il Functional Description contains a functional overview of the DSK which includes the TMS320C3x DSK functional diagram a descrip tion of the DSK hardware components and software operation Part Ill Assembler Description contains detailed information about using the assembler B Chapter 5 explains how to create DSK assembler source files and invoke the assembler B Chapter 6 discusses the valid directives and gives you an alphabetical reference to these directives Read This First iii Notational Conventions Notational Conventions PartIV Debugger Description contains detailed information about using the debugger Chapter 7 explains how to invoke the DSK debugger and use its function keys and debugger commands Part V Appendices contains a description of the communications kernel source code the DSK circuit board dimensions and schematic diagrams the data sheet of the TLC32040 that provides all specifications of the analog interface circuit and a glossary This document uses the following conventions Program listings program examples and interactive displays are shown ina special typeface similar to a typewriter s Examples use a bold version ofthe special typeface for emphasis interactive displays use a bold version ofth
93. hown starting against the left mar gin of the shaded box as in the example below No instruction command directive or parameter other than a symbol or label should begin in col umn 1 symbol set value The symbol is required for the set directive and must begin in column 1 The value is also required Square brackets and identify an optional parameter If you use an optional parameter you specify the information within the brackets you don t enter the brackets themselves Here s an example of a directive that has an optional parameter entry value The entry directive has one parameter which is optional Some directives can have a varying number of parameters For example the int directive can have up to 100 parameters The syntax for this direc tive is int value values This syntax shows that int must have at least one value parameter but you have the option of supplying additional value parameters each sepa rated from the previous one by a comma Information About Warnings This book contains warnings This is an example of a warning statement A warning statement describes a situation that could potentially cause harm to you Read This First V Helated Documentation From Texas Instruments Related Documentation From Texas Instruments vi The following books describe the TMS320C3x and related support tools To obtain a copy of any of these TI documents call the Texas In
94. iary analog input channel The DSK connects the TL C32040 AIC to the C31 serial port through a header and 100 Q isolation resistors The header lets you disconnect the AIC and use the C31 s serial port in the daughterboard Two additional pins from the C31 control resetting and clocking signals to the AIC The C31 s TIMERO pin drives the master input clock to the AIC The C31 s XFO signal resets the AIC The AIC s analog input and output are connected to RCA plugs These signals are line level compatible 3 V peak and can be connected to audio line level inputs and outputs The output can also be connected directly to a speaker but it does not have a significant output level as the output drive is limited by the AIC output driver and a series isolation resistor For best results use an external amplifier or high impedance speaker such as a headphone qpo 71 Note If the AIC is used with parameters outside the tested range the AIC perfor mance may be degraded from that specified in the data sheet See the TLC32040 Data Sheet SLASO14 for more information LLLLLLL DSK memory map DSK Hardware Interface Because host communications occur through the C31 parallel bus the PAL decodes the address of the C31 to determine when it is accessing the host interface according to the memory map shown in
95. ication and a 0 data word Functional Overview 4 19 TLC32040 AIC Initialization Example 4 2 Setting the TA and TB Registers the TLC32040 The analog output LOOPAIC ASM is an example program which shows how to initialize and use DAC output is either a ramp signal RAMPEN 1 or a loopback of the analog input RAMPEN 0 Sect Start AICTES AICTES 0x809802 y Define constants used by program r RAMPEN set TO ctrl set TO count set TO prd set S0 gctrl set SO xctrl set S rctrl set S0 xdata set S0 rdata set TA Set TB Sot RA Set RB Set GIE eL 1 0x808020 0x808024 0x808028 0x808040 0x808042 0x808043 0x808048 0x80804C 12 15 12 15 0x2000 Define some constant storage data r A REG B REG C REG S0 gctrl val S0 xctrl val S0 rctrl val RAMP ADC last word word word word word word word word 10000011b 0x0E970300 0x00000111 0x00000111 0 0 Start assembling here Set to 1 to generate ramp at AOUT TIMO gl control TIMO count TIMO prd SP 0 global control SP 0 FSX DX CLKX port ctl SP 0 FSR DR CLKR port ctl SP 0 Data transmit SP 0 Data receive AIC timing register values This bit in ST turns on interrupts TA 9 RA 2 0 A registers TB 9 RB 2 2 B registers control Serial port co
96. iewed in the debugger DSK Circuit Board Dimensions and Schematic Diagrams B 3 Hardware Component Overview B 2 Schematics B 4 Voltage Regulators The DSK uses a 7 12 Vdc or 6 9 Vac wall mount power supply The 7 12 Vdc supply voltage is full wave rectified and then regulated up to 5 volts by the LM7805 It is also converted to 5 volts by the capacitive switching circuit LT1054 and then regulated by the LM7905 The 6 9 Vac supply is full wave rectified and then regulated by the LM7805 and LM7905 to 5V and 5V respectively The 5V and 5V supplies are used to power all of the DSK on board circuitry The TLC32040 AIC requires a negative poser supply of 5 volts XDS Emulator Port An 11 pin header that connects the XDS510 emu lator to the C31 The emulator allows you to upgrade to the full featured XDS debugger to debug your application code while using the DSK as the XDS target board The schematic diagrams included here show all of the internal and external connections in the DSK circuitry Schematics 9 Jo T 3eeus 966T LZ doxew eqed XNHVIO r NOILVOI TIddV S r Ez HS v LE 009G V arva eH Amt zequnn queunsoalezts NOSXOWD N NO dHS ASSW LXAN wv v wv wv v ASH aawa DAN Mp See dec ERO TEENE INWNOSIHM f LSEL SE 009d HS eraTL arva vo SVXHiL NOLSNOH SHWOOO i ASH 4noNbD NOLOnaNOOIWHS Eus EI HS SWHLSAS LNZSAdOTSAS
97. ii AT is a trademark of International Business Machines Corp IBM PC and PC DOS are trademarks of International Business Machines Corp MS DOS is a registered trademark of Microsoft Corporation Windows is a trademark of Microsoft Corporation OS 2 is a trademark of International Business Machines Corp Contents Introduction eor ERR RR RR Eu RE RRAE CN EN RR NEN EN RR NUN RUNS 1 1 Describes the key features and provides an overview of the TMS320C3x DSP Starter Kit 1 14 Key Features of the DSK 0 ccc s 1 2 1 2 DSK Overview Installing the DSK Assembler and Debugger Lists the hardware and software you ll need to install the DSK assembler and debugger pro vides installation instructions for PC systems running DOS 2 44 WhatYoulNeed enr Ree aiaia a a a a chee eae ENTRA Ea a aa ee dea ae ts Hardware checklist Software checklist 2 0 0 0 teen e teen eens DSK module connections 0 ccc cette ene tne e eens 2 2 Step 1 Connecting the DSK to Your PC 2 3 Step 2 Installing the DSK Software 0 0 ccc ee 2 4 Step 3 Modifying Your config sys File 2 5 Step 4 Modifying the PATH Statement 2 6 Step 5 Verifying the Installation Installation errors Overview of a Code Development and Debugging System Provides an overview of the assembler and debugger and describes the overall code develop ment process 3 1 Description of the DSK Assembler Key features of the assemb
98. inal safe value in DXR Fix the receiver underrun by reading main the DRR before going to the main loop zc GORGE EATERS EERE EE hs er es bee e ies T ISR handler directly into ion it will be used for H cd eee eae dece de eie e e e eR e He e EKEK ES Start SPOVECTS 0x809FC5 SPOVECTS DAC2 XINTO ADC2 RINTO 4 22 4 4 Host Software Host Software The DSK software includes several source code files that manipulate the par allel printer port and perform the necessary functions to initialize and commu nicate with the C31 The commands in each of the source code files are sum marized in the following subsections The source files that are typically linked include driver cpp target cpp object cpp dsk coff cpp errormsg cpp symbols cpp helpmsg cpp includes driver level routines that control the host s parallel printer port interface includes the low level routines that manipulate the data transmissions into packets that are recognized by the C31 communications kernel uses the target and driver level routines to initialize and download programs to the C31 includes DSK and COFF file loader and utilities includes text strings associated with function returns includes symbol table support routines includes command line help message The following subsections describe the routines contained in each of these files DSK software also includes an assembler and a debugger These are de scrib
99. ion on soft ware changes and DSK operation C AAAA AMAA Note Other applications for the DSK can also be downloaded from the TMS320 BBS or Internet FTP site See the f You Need Assistance subsection on page vii for the Internet address LLLLLL v DSK module connections You need a parallel printer port cable to connect your PC to your DSK board The DSK board is designed with a DB25 parallel printer port connection mounted on the board Installing the DSK Assembler and Debugger 2 3 Step 1 Connecting the DSK to Your PC 2 2 Step 1 Connecting the DSK to Your PC Follow these steps to connect your DSK board to your PC 1 Turn off your PC s power 2 Connect your parallel printer port cable to the parallel communication port LPT on your PC This port can be identified by its size and pin type which should be the female matching equivalent to the DSK RS232 ports which use DB25 connectors use the opposite pin configuration 3 Plug the parallel printer port cable into the DSK DB25 connector 4 Plug 7 12 Vdc or 6 9 Vac power supply into the DSK power supply connector See Figure 2 1 for details Figure 2 1 Connecting Your Parallel Printer Port Cable and Transformer Into Your DSK Board PAL 22V10 System clock Power O supply LED connector RCA
100. ions Mnemonic and Syntax Description Page data Assemble source code into data memory 6 18 sect section name Assemble source code into a named initialized sec 6 27 tion text Assemble source code into program memory 6 32 b Directives that initialize constants data and memory Mnemonic and Syntax Description Page byte value values Initialize one or more 8 bit integers 6 16 fill size in words Reserve size words in the current section note that 6 29 a label points to the beginning of the reserved space float expression Initialize a 32 bit TMS320C3x floating point constant 6 21 float16 expression Initialize a 16 bit TMS320C3x floating point constant 6 21 float8 expression Initialize an 8 bit TMS320C3x floating point constant 6 21 ieee expression Initialize one or more 32 bit IEEE single precision 6 22 floating point constants int value valuen Initialize one or more 16 bit integers 6 16 long value values Initialize one or more 32 bit integers 6 16 pfloat16 Initialize 16 bit TMS320C3x floating point constants 6 21 into a single word pfloat8 Initialize 8 bit TMS320C3x floating point constants 6 21 into a single word qxx value values Initialize a 16 bit signed 2s complement integer 6 25 whose decimal point is displaced xx places from the LSB space size in words Reserve size words in the current section note that 6 29 a label points to the beginning of the
101. ister SGCRO SPCXO SPCRO SINIT SINIT ndo Set Bet Bet word word ldp ldi sti ldi sti sti ldi sti 808040h Serial port 0 global control register 808042h Serial port 0 FSX DX CLKX control reg 808043h Serial port 0 FSR DR CLKR control reg 0e973300h Enable RINT amp 16 bit transfers 111h Configure as serial port pins SGCRO Set Data Page Oh R4 Initialize R4 to zero R4 SGCRO SINIT1 R7 Reset and R7 SPCXO x initialize serial port R7 SPCRO A initialize serial port SINITO R7 Reset and R7 SGCRO initialize serial port Referto the example code supplied with the DSK for help on setting up the AIC Initializing the AIC Equation 4 1 4 16 Once the C31 supplies MCLK initializes its serial port and resets the AIC you caninitialize the AIC to a specified sample rate The AIC sampling rate is deter mined by the values of two registers called A and B in the AIC s transmit and receive sections These values are loaded into the respective counter when ever the counter counts down to 0 Tx counter A and B determine the D A con version timing Rx counter A and B determine the A D conversion timing For more information refer to the TLC32040 AIC Data Sheet Literature number SLASO 1 4 The formula for the conversion frequency is given in Equation 4 1 Conversion Frequency MCLK Conversion frequency freq 2 XAXB TLC32040 AIC Ini
102. lates the 32 bit IEEE floating point representation of a single precision floating point value The int directive places one or more 16 bit values into consecutive words in the current section The upper 16 bits are not used and are filled with Os The long directive places one or more 32 bit values into consecutive by tes in the current section The pfloat16 directive converts an expression value into a 16 bit floating point constant The values are packed into consecutive fields of memory The pfloat8 directive converts an expression value into an 8 bit floating point constant The values are packed into consecutive fields of memory The qxx directive places one or more 16 bit signed 2s complement val ues into consecutive words in the current section Note that the decimal point is displaced xx places from the LSB least significant bits Directives That Initialize Constants Directives That Reference Other Files The space directive reserves a specified number of bits in the current section The assembler advances the SPC and skips the reserved words When you use a label with space it points to the firstword of the reserved block _j The string directive places 8 bit characters from one or more character strings into the current section The word directive places one or more 32 bit values into consecutive bytes in the current section 6 4 Directives That Reference Other Files The copy and include dir
103. ler 000 c cece eee e ete e n 3 2 Description of the DSK Debugger Key features of the debugger 3 83 Developing Code for the DSK 3 4 Getting Started Functional OVerVIeW 54 oracio rhe Rn nrc cade ate nes with a avila tvs ee ACA aca TR RAT CA GR 8 a n Describes the DSK hardware and software functionality 4 1 DSK Hardware Interface Host hardware interface Host communications sseeee RR RR RI e as TLC32040 AIC hardware interface Contents DSK memory map xesessezeczhbesebrdbieet8S 4k AR ERA RE REIR LERe Ia pid 42 DSK Communications Kernel ssssesselssee e BEWWerie cim EEUU ordures Debugging functions sise tori 20 0c Rn Interr ptS 2 s eiodeeniesensuerereweedane per uundgpsba duo e bdo pd dorus a eru dae du 4 3 TLC32040 AIC Initialization llssesesseeesees IRI Resetting the AIC 0 e rn Initializing the C31 timer 2 2 III Initializing the C31 serial port 0 6 cee nets Initializing the AIC isses dace nda qe dene deo Deda eue eae Dede Primary communications 0 eect ees Secondary communications 00 cee 44 Host Sonwa 602 ccddienteterdes aida Ou actui i ova x oa cie iod eta RR enka Host communications target routines sssaaa nannan ene tne esses Host communications driver routines sels Host communications object routines 0 nett ees 5 Using the DSK Assembler 0cc cece eee eee eee eee nnn
104. les Table 5 1 Indirect Addressing Operand ARn ARn disp ARn disp ARn disp _ ARn disp ARn disp t ARn disp t ARn IRO B Description Indirect with no displacement Indirect with predisplacement or preindex add Indirect with predisplacement or preindex subtract Indirect with predisplacement or preindex add and modifica tion Indirect with predisplacement or preindex subtract and modification Indirect with postdisplacement or postindex add and modifi cation Indirect with postdisplacement or postindex subtract and modification Indirect with postindex IRO and bit reversed modification t Optional circular modification specified by For more information on indirect addressing and bit reversed addressing refer to the TMS320C3x User s Guide Creating DSK Assembler Source Files Commenting your source file A comment can begin in any column and extends to the end of the source line A comment can contain any ASCII character including blanks Comments are printed in the assembly source listing but they do not affect the assembly You can comment your source file in one of two ways The most common way is to place a semicolon anywhere on the line you want to comment All text placed after the semicolon is ignored by the DSK assembler For example Memory map register locations SGRO set 0x808040 Serial port SPCXO set 0x808042 Serial port SPCRO set 0x808043 Serial
105. ll with ISR Pipeline continues to fill with ISR Execute first instruction of DSK Communications Kernel Fetch Decode Read Execute BUD R5 or 2000h ST BUD R5 ldi Q R5 or 2000h ST BUD R5 R5 ldp _DP DP ldi G R5 R5 or 2000h ST BUD R5 USER1 ldp _DP DP ldi _R5 R5 or 2000h ST USER2 USER1 ldp _DP DP ldi _R5 R5 in pipeline XINT1 USER1 ldp _DP DP XINT1 USER1 XINT1 XSTEP ISR ISR2 XSTEP ISR ISR3 ISR2 XSTEP ISR ISR4 ISR3 ISR2 XSTEP ISR ISR Table 4 1 describes the pipeline flow that sets the XINT1 interrupt and branches to your code This table shows that the activities in the pipeline are coordinated so that the code is fetched at the same time global interrupts are enabled In this way the interrupt is placed in the pipeline right after fetching the second instruction This instruction is discarded and the pipeline is filled with the interrupt service routine ISR D E Note Another way of interpreting CPU interrupts is to treat them as a special kind of opcode that is inserted into the pipeline Instructions that are in the pipeline before the interrupt occurs must complete execution LLLLS S S OOOOO Functional Overview 4 13 TLC32040 AIC Initialization 4 3 TLC32040 AIC Initialization Resetting the AIC To u
106. m timer frequency of 12 5 MHz CLKIN 4 which is above the AIC s tested master clock frequency maximum of 10 MHz If you use fre quencies beyond those listed in the TLC32040 data sheet the resulting performance may not be predictable If the timer is run in pulse mode con trol value is OX2C1 the minimum period of 1 results in 12 5 MHz master pulse rate and 2 results in 6 25 MHz See the TLC32040 Data Sheet SLASO14 for more information TLC32040 AIC Initialization Maximum Timer Period Register Value The AIC s minimum master clock frequency is 75 kHz Taking into account the C31 maximum timer frequency of 12 5 MHz and the AIC s minimum master clock frequency the C31 s timer counter register maximum value should be 165 12 5 MHz 75 kHz 166 7 The C31 s timer counts down to 0 therefore you need to subtract 1 from this number 166 1 165 Note that the TLC32040 specification describes a minimum clock frequency since the internal signals of the AIC are stored in capacitors that must be periodically updated Timer Initialization The following C31 assembly code initializes the tim erin clock mode with a timer period of 1 The following code initializes timer 0 to generate a square wave clock mode on the TCLKO pin at a frequency of 6 25 MHz timer period 1 TGCRO set 808020h Timer 0 global control register TCNTO set 808024h Timer 0 counter register TPRO set 808028h Timer 0 period register TIMVAL word 3
107. nctional Overview 4 27 recv long xmit long xmit byte Host Software recv long Syntax Description Arguments Return Value Syntax Description Arguments Return Value xmit byte Syntax Description Arguments Return Value 4 28 Heceive Long MSGS recv long ulong rcv data The recv long routine receives a 32 bit value in eight 4 bit data transfers to be used in bidirectional and unidirectional parallel printer ports rcv data Address of the value to receive NO ERR Successful reception RECV ERR Failed reception Transmit Long MSGS xmit long ulong snd data The xmit long routine transmits a 32 bit value in four 8 bit data transfers to be used in bidirectional and unidirectional parallel printer ports snd data Value to transmit NO ERR Successful transmission XMIT ERR Failed transmission Transmit Byte MSGS xmit byte char snd data The xmit byte routine transmits an 8 bit value in a single data transfer to be used in bidirectional and unidirectional parallel printer ports snd data Value to transmit Successful transmission Failed transmission NO ERR XMIT ERR Host Software LF Host communications object routines Syntax Description Arguments Return Value Using the low level driver routines the DSK software provides several high level routines that allow the loading of programs or data from dsk3a files or COFF Common Object File Format that move binary data fr
108. ne Symbols at Assembly Time 6 6 Directives That Align the Section Program Counter These directives affect the section program counter SPC The align directive aligns the SPC ata 1 byte to 32K byte boundary This ensures that the code following the directive begins on the byte value that you specify If the SPC is already aligned at the selected boundary it is not incremented The entry directive identifies the starting address of the section program counter By default the current address is used or you can specify an op tional address 6 7 Directives That Define Symbols at Assembly Time Assembly time symbol directives equate meaningful symbol names to constant values or strings The set directive equates meaningful symbol names to constant values or strings The symbol is stored in the symbol table and cannot be rede fined for example bval set 0100h byte bval b bval The sdef directive equates meaningful symbol names to constant values or strings the symbol name can be redefined Assembler Directives 6 11 Miscellaneous Directives 6 8 Miscellaneous Directives These directives enable miscellaneous functions or features m m The brstart directive aligns the named section to the next 2 address boundary following the current section The end directive terminates assembly It should be the last source state ment of a program This directive has the same effect as an end of file The s
109. necting the DSK to Your PC 2 3 Step 2 Installing the DSK Software 2 5 2 4 Step 3 Modifying Your config sys File s p 5 2 5 Step 4 Modifying the PATH Statement 2 6 Step 5 Verifying the Installation uuseseuuueee 2 1 What You Need 2 1 What You Need The following checklists detail items that are shipped with the DSK assembler and debugger and any additional items you ll need to use this tool The DSK module connections with a parallel printer port are also discussed in this section Hardware checklist 2 2 Host An IBM PC AT or 100 compatible PC with a hard disk system and a 1 2 megabyte floppy disk drive and parallel printer port communication link Memory Minimum of 640K bytes Display Monochrome or color color recommended Power requirements A UL Class Il power supply with a 2 1 mm power jack connector that provides 7 12 Vdc or 6 9 Vac and at least 400 1500 mA which is common to most wall mounted DC transformers For isolated wall mount supplies the polarity of the 2 1 mm power jack does not matter Laboratory type power supplies with case grounds are not recommended since they can create ground loops and possibly create a short circuit through the DSK full wave rectifier Note You may want to use the DSK s on board power supply and regulators f
110. nes Setting a software breakpoint 0 0 c cece eee eens Clearing a software breakpoint 000 c cece eee Finding the software breakpoints that are set 0 00 cece eee eee eee eee 7 5 Debugger Commands sceau due ceed ae saii aa i a re dd edid edes 7 6 Quick Reference Guide 0 nee teen ene eens Communications Kernel Source Code c cce cece eee eee eee eee eee Contains the source code for the TMS320C3x DSK communications kernel DSK Circuit Board Dimensions and Schematic Diagrams usesee Contains the circuit board dimensions and the schematic diagrams for the DSP Starter Kit B 1 Hardware Component Overview 000 cece eee eens B 2 Schematics 0 ccc eee eee hh Host Interface Control Design Notes 0 0 0 c cece teens GIOSSANY aisaen sonora Goel de en ee ade eke Boel Be eka ie ee Defines acronyms and key terms used in this book Contents xi Figures 1 1 TMS320C3x DSK Block Diagram 0 c cece n 2 1 Connecting Your Parallel Printer Port Cable and Transformer Into Your DSK Board 2 2 DOS Command Setup for the DSK Environment Sample autoexec bat File 2 3 Basic Debugger Display sssueussssssssses eese 3 1 Basic Debugger Display sssssessssssessse ee 3 2 DSK Software Development Flow ssssssssssssssss n 4 1 TMS320C3x DSK Functional Circuit Diagram 0c
111. nt decimal format in the register window Modify reg register in the CPU REGISTER window with the value from expression For example PC 0x809800 RO 1 34 Table 7 7 Managing Breakpoints To do this Set a breakpoint at address addr Clear a breakpoint at address addr Clear all the breakpoints Display a list of all the breakpoints that are set Table 7 8 Loading Programs To do this Load an object file Load symbols Load binary only Clear symbols Using the DSK Debugger Debugger Commands Use this command MEM adar MM addr MM adar leng val DASM addr REG40 FLOAT reg expression Use this command SB addr CB addr CB DB Use this command LOAD filename SLOAD filename BLOAD filename SCLEAR 7 11 Debugger Commands Table 7 9 Performing System Tasks To do this Reset the DSK Quit or exit the debugger Enter the DOS shell and optionally execute the ex pression Enter EXIT to return to debugger Enter the DOS shell and execute the editor to edit filename If no filename is given the name of the presently loaded file is used Enter the DOS shell and execute the DSK assembler to assemble file Use this command RESET QUIT or EXIT DOS expression to Run EDIT filename dsk3a filename asm Quick Reference Guide 7 6 Quick Reference Guide The following tables provide a quick reference guide of the function key defini tions Table 7 10 Function Key Shortcu
112. ntrol register values RAMP count value Last received ADC value 4 20 TLC32040 AIC Initialization Example 4 2 Setting the TA and TB Registers Continued J RRR RRR KER ko kk KK kk KEK KR KKK KKK KER KK KEK KEK KEK koe ko k ke koc ke KKK Begin main code loop here Ge Roe eges deseo dede eges BE Fe ee ET A desea de eoe lese IEDR BE PIE ue ie BE ie main or GIE ST Turn on INTS ldi 0x34 IE Enable XINT RINT INT2 b main Do it again DAC2 push ST DAC Interrupt service routine push R3 eat RAMPEN If RAMPEN 1 assemble this code ldi RAMP R3 addi 256 R3 Add a value to RAMP sti R3 RAMP s else Else assemble this tdr GADC last R3 H endif A andn 3 R3 3 sti R3 SO_xdata Output the new DAC value pop R3 i pop ST reti ADC2 push ST push R3 3 ldi SO_rdata R3 sti R3 QG0ADC last pop R3 pop ST reti z PRR RRR KERR RRR KER ke ko ko KEK KR KEK KER KKK KK ck ke kc ke e kk ke ek ke e ke ke e kv The startup stub is used during initialization only and can be safely overwritten by the stack or data SERRE RRR AE RRR RR RR RR eoe dee deo dee ease de e dee eec een entry ST STUB Debugger starts here ST STUB ldp TO ctrl Use kernel data page and stack ldi 0 RO Halt TIMO amp TIM1 sti RO GTO ctrl sti RO TO_count Set counts to 0 ldi 1 R0 Set periods to 1 sti RO GTO prd ldi 0x2C1 R0 Restart both timers in pulse mode
113. om the host to the DSK and that initialize the DSK system These routines assume an active communications kernel resident on the C31 to send and receive packets of data See Appendix A of the TMS320 Floating Point Assembly Language Tools User s Guide for a detailed description of the COFF format Load File Load File char file TASK task The Load File function performs several tasks depending on the enumerated TASK given to it DSK and COFF file formats are distinguished by the exten sion of the file The enumerated TASK list is defined in the file DSK COFF H An ASCII hexadecimal file format that contains the bootloader header informa tion and raw data is also supported Since the header information defines where and how long a section is this file format can be usedto either bootload or load files This file format is easily converted to ROM files with a user de fined post processor TASK Task to perform LOAD Loads a DSK or COFF file into the DSK target BOOT Boots a DSK or COFF file into the DSK target FILE2HEX Creates loadable bootloadable ascii HEX file BOOTHEX Bootloads FILE HEX into the DSK LOADHEX Loads using kernel FILE HEX into the DSK DSK2COFF Convert DSK file to COFF file SLOAD Loads symbols from the file file Pointer to the name of the file to load task Task to perform NO ERR Successful transmission OPEN ERR Cannot open file ACCESS ERR File not found INV COFF MGC COFF file not created for a TMS320C3
114. omplete system to halt Due to the low data transfer rates it is often inade quate for application data transfers Also external interrupts are often masked and can effectively freeze communications and other interrupt driven tasks Halting and restarting the processor causes many breaks in the CPU pipeline which defeats the purpose of real time operation Debugging functions provided in the communications kernel operate as a background task and they never disable the CPU or force a pipeline flush For example single stepping an opcode in scan based emulation executes the opcode flushes the pipeline and freezes the timers and DMA On the other hand real time debugging follows standard interrupt service routine rules for context switching Due to the real time nature of the debugging session debugging functions save andrestore the context of the CPU before and after executing the debug ging function The kernel implements this context save similar to atypical inter rupt service routine that saves and restores all CPU registers 28 registers Peripheral control registers are not preserved because the communications kernel does not modify them Note that the extended precision CPU registers require two memory locations to store the most significant 8 bits and the least significant 32 bits After saving the context the CPU enters a spin mode where it waits for additional commands During this time the context area can be downloaded displ
115. ong long Align the first value to the next address located by raising the second value to the power of 2 You can generate a table of values using certain assembler directives To gen erate a table of values use the loop endloop directives and the math library functions listed in Table 5 2 For example to create the twiddle table for an FFT use the following directives TWlength set 16 Table size is 16 brstart TwiddleTable 2 TWlength Align to valid br address TWstart create label OUTside loop i y loop TWlength 16 pairs of complex numbers float sin TWStart 2 pi TWlength sin n pi N float cos TWStart 2 pi TWlength cos n pi N endloop Table 5 3 shows the operators recognized by the DSK assembler Using the DSK Assembler 5 13 Expression Analyzer Table 5 3 Operators Used in Expressions Operator Description Addition Subtraction Multiplication Division Modulo Division Greater than Greater than or equal to Less than Less than or equal to Not equal Operator gt gt Description Not equal Equal to Equal to Logical AND Logical OR Logical XOR Bitwise negation 1s complement Logical NOT If expression 0 then 1 is returned else 0 is returned Shift left Shift right Assembling Your Program 5 6 Assembling Your Program Before you attempt to debug your programs you must first assemble them Here s the command for invoking the assembl
116. ontroled by adjusting the timers USING THE PWM AS A DAC If the output is filtered to a DC level by a low pass filter the DC level can be controlled by setting the two timers to identical freqencies seperated by a constant phase angle delay Since both the XOR and XOR are provided a differential signal is also available DSK Circuit Board Dimensions and Schematic Diagrams B 11 Host Interface Control Design Notes If TO T1 the output is a DC level proportional to the phase differenc i TO Tl XOR i USING THE PWM AS A TRIANGLE WAVE GENERATOR If TO and T1 are set to different frequencies a PWM modulated triangle wave at a frequency of F0 t0 F1 tl is produced Since the two XOR outputs are compliments a bridged output is created current in the LED to reverse resulting in an of R Y G Y R Y G Y If TO Tl the output is a continuous triangle wave This then allows the alternating color sequence TO x Yl XOR If an H bridge drive circuit is used with these signals an AC motor can be driven with an DSP controlled frequency By using an external PAL to provide additional references signals and phase detectors a 3 phase PWM driver can be easily constructed In this case the external PAL would contain a counter whose output is decoded to provi
117. or external circuits If so do not overload the circuit External loads will cause the regulators to operate at a higher temperature Loads gt 50 mA are not recommended Ifyou make modifications or you are using an external laboratory power supply be sure you connect it to the DSK correctly the DSK is not warranted after you make modifications to it To minimize risk of electric shock and fire hazard the power supply adapter should be rated UL class 2 The adapter and personal computer providing energy to this product should be certified by one or more of the following UL CSA VDE TUV What You Need Board DSK circuit board Cable Pass through parallel printer port cable Optional hardware An EGA or VGA compatible graphics display card and monitor Miscellaneous Blank formatted disks materials Software checklist Operating system MS DOS or PC DOS version 5 0 or later Windows or OS 2 Files dsk3a exe is an executable file for the DSK assembler Executing dsk3a exe produces all the files needed to use the DSK dsk3d exe is an executable file needed for running the DSK debugger interface Miscellaneous files Other files are included in your DSK package such as sample source files and additional documentation You can find a brief description of these files in the Readme file included on your disk Be sure to check the Readme file for the latest informat
118. output section which is Sect ISR not on a 32 word boundary for demo align set 64 Size of FIR filter ldp FIRCOEF ldi FIRCOEF ARO ARO address of h N 1 ldi FIRDATA AR1 ARl address of x n N 1 mpyf3 ARO 1 AR1 1 R1 ldf 0 0 R2 ldi FIRLENG 2 RC Be sure to unroll length by 2 rptb FIR Begin block repeat mpyf3 ARO 1 AR1 1 R1 addf3 RO R1 R2 b Done result is in R2 word 0x809900 Address for coefficient storage word 0x809A00 Address for input data storage 6 14 Syntax Description Example word brstart word Align to Address Boundary brstart brstart section name n The brstart directive aligns the section nameto the next 2 address boundary immediately following the current section This directive aligns data buffers in order to use the C3x circular and bit reversed addressing modes Another method for creating a section whose start is bit reversed is to use the br func tion within the start directive s address field Here is an example of the brstart directive The present address is Twiddle 128 Create a new section on a new 128 word boundary The new address is Assembler Directives 6 15 byte int long word nitialize a 32 bit Integer Syntax Description Example 1 byte value valuep int value values ong value value word value valueg These directives plac
119. r A windows oriented software interface that helps you to debug DSK programs running on a DSK board directive Special purpose commands that control the actions and func tions of a software tool like an assembler as opposed to assembly lan guage instructions which control the actions of a device disassembly Assembly language code formed from the reverse assembly of the contents of memory DSP Digital signal processing Glossary EGA Enhanced Graphics Adaptor An industry standard for video cards entry point The starting execution point in target memory expression 4A constant a symbol or a series of constants and symbols separated by arithmetic operators external symbol A symbol that is used in the current program module but defined in a different program module file header A portion of a COFF object file that contains general informa tion aboutthe object file such as the number of section headers the type of system the object file can be downloaded to the number of symbols in the symbol table and the symbol table s starting address global A kind of symbol that is either 1 defined in the current module and accessed in another or 2 accessed in the current module but defined in another input section A section from an object file that will be linked into an executable module label A symbol that begins in column 1 of a source statement and corre sponds to the address of that statement listin
120. rdware interface AIC faaton a AIC reset C31 timer initializing secondary communications control register bit fields data format serial port initializing 4 15 to 4 16 assembler l option constants definition description of key features source listings source statement format symbols Index assembler directives aligning the section program counter 6 11 alphabetical reference to 6 32 conditional assembly 6 10 defining assembly time symbols defining sections bso enabling conditional assembly endloop 6 24 loop 6 24 initializing constants e 8 to 5 9 miscellaneous 6 12 referencing other files summary table assembling your program assignment statement definition autoexec bat file definition BA command batch files definition BD command binary integers BL command block definition block diagram of TMS320C3x DSK board requirements 2 3 breakpoints See software ie breakpoints hardware definition breakpoints software definition brstart directive 6 12 6 15 byte definition byte directive Index 1 Index c or com debugger option C31 timer initializing 4 14 to 4 15 example code 4 15 maximum timer period register value 4 15 minimum timer period register value 4 14 cable requirements character constants circuit diagram clearing software breakpoints 7 9 code display windows definition COFF definition command line definition comment definition
121. rective places the 8 bit values into memory in a packed form in the order they are encountered If a word is not filled the remaining bits are filled with Os This example shows several 8 bit values placed into consecutive bytes in memory The label Str_3 has the value Oh which is the location of the first ini tialized byte Str 3 string ABCD string 51h 52h 53h 54h string Hoston string 36 412 Assembler Directives 6 31 lext Assemble Into text Section Syntax Description Example text The text directive tells the assembler to begin assembling into the text sec tion The text section usually contains executable code The section program counter SPC is set to 0 if nothing has been assembled into the text section If code has already been assembled into the text section the SPC is restored to its previous value in the section Note that the assembler assumes that text is the default section Therefore at the beginning of an assembly the assembler assembles code into the text section unless you specify one of the other sections directives data entry or sect This example shows the assembly of code into the data and text sections start text 0x809800 entry START START ldi 0 RO Initialize RO and R1 ldi 1 R1 text value int 0 1 2 3 4 5 integer values Chapter 7 Using the DSK Debugger This chapter tells you how to invoke the DSK debugger and use its function ke
122. rectives That Initialize Constants isssssesesee RR RI 6 4 Directives That Reference Other Files 00 0 0 0 0 ccc cece I 6 5 Directives That Enable Conditional Assembly 000 cee eee eee ees 6 6 Directives That Align the Section Program Counter 6 7 Directives That Define Symbols at Assembly Time 6 8 Miscellaneous Directives 000000 IR ne 6 9 Directives Reference 0 00 ee eee eee eee Using the DSK Debugger 0 0ce eee e eect Rn nn nnn nnn 7 1 Tells you how to invoke and use the debugger and describes the debugger environment Dis cusses valid debugger commands 7 4 Invoking the Debugger ccc cece tee nents Displaying a list of available options or Help option 0 eee eee Selecting the parallel printer port LPT 3 or LPT option Select the parallel printer port at a particular address PORT option Automatically search for a printer port TEST option 2 000 ee eee 7 2 Understanding the Debugger Windows esses DISASSEMBLY WINdOW stre RE RR REPE EFE CREE AERE CREER CPU REGISTER window ssssssssseel e eee ENERE MEMORY WIDndOW 4 rex hire Bardot xar dre OS ences dr loe vd due eda ha VC aA on COMMAND window ssssssssees RII nn 7 3 Using the Help Menu 0002 c cece eR hn 7 4 Using Software Breakpoints 000 cece eee ieis te
123. rogram and steps past calls CD Selects the DISASSEMBLY window Selects the MEMORY window Selects the CPU REGISTER window ESC Exits the active window Appendix A Communications Kernel Source Code This appendix contains the source code for the TMS320C3x DSK communica tions kernel A 1 Communications Kernel Source Code TMS320C3x DSK COMMUNICATIONS AND DEBUG MONITOR KERNAL Texas Instruments Incorporated C 1995 1996 Start vectors 0x809FCl1 Start kernel vectors O0xAB Use size report from DSK3A Start sstack 0x809F00 output to pack to end of RAM entry START COMMUNICATION MONITOR START STACK SPACE A section of unoccupied free memory of STACKSIZE size words just below the kernel is used on startup for initialization and stack space If more or less stack space is required a new stack pointer value can be initialized within the users applications code to any location or by re assembling this code with a new STACKSIZE When initialization is complete the startup stub can be safely overwritten since it is no longer needed In this case the startup S a tub is placed after the stack Another safe location would be section of memory which is used for I O or uninitialized data This section of code also initializes the timers which are used by the PAL to create the PWM signal which drives the LED The rate at which the LED changes color is F0 F1 where FO and FO
124. ry NO ERR XMIT ERR Block write completed successfully Failed transmission SSTEP CPU Syntax Description Arguments Return Value RUN_CPU Syntax Description Arguments Return Value HALT CPU Syntax Description Arguments Return Value Host Software SSTEP_CPU RUN CPU HALT_CPU Single Step Command MSGS SSTEP_CPU void The SSTEP_CPU routine single steps one instruction by restoring the context of the CPU executing one instruction and then saving the CPU context This command places the CPU in command mode None NO_ERR Command and data completed successfully XMIT_ERR Failed transmission RECV_ERR Failed reception Run Command MSGS RUN_CPU void The RUN_CPU routine executes instructions starting at the program counter obtained from the CPU context save area and ending at a breakpoint if one has been set None NO_ERR Command and data completed successfully XMIT_ERR Failed transmission Halt Command MSGS HALT_CPU void The HALT_CPU routine halts the execution of instructions This command places the CPU in command mode and saves the CPU context None NO_ERR Command completed successfully RECV_ERR Failed reception Functional Overview 4 25 GET DEBUG CTXT Host Software GET DEBUG CTXT Syntax Description Arguments Return Value 4 26 Return CPU Context Save Address MSGS GET DEBUG CTXT void The GET DEBUG CTXT routine retrieves the C31 context save
125. s file FILES 20 Once you edit your config sys file and add the line invoke the file by rebooting the PC press the reset switch or turn off the PC s power and turn it on again Installing the DSK Assembler and Debugger 2 5 Step 4 Modifying the PATH Statement 2 5 Step 4 Modifying the PATH Statement To ensure that your debugger and assembler are invoked from any directory in your PC you must modify the PATH statementto identify the dsktools direc tory Not only must you do this before you invoke the debugger for the first time you must do it any time you power up or reboot your PC You can accomplish this by entering individual DOS commands but it s simpler to put the commands in your system s autoexec bat file The general format for doing this is PATH C dsktools pathname2 pathname3 This allows you to invoke the debugger without specifying the name of the directory that contains the debugger executable file If you are modifying your autoexec bat file and it already contains the PATH statement simply include C dsktools at the end of the statement as shown in Figure 2 2 Figure 2 2 DOS Command Setup for the DSK Environment Sample autoexec bat File 2 6 DATE TIME ECHO OFF PATH statement gt PATH c dos c dsktools CLS If you modify the autoexec bat file be sure to invoke it before invoking the debugger for the first time To invoke this file enter autoexec Step 5
126. se the TLC32040 analog interface circuit AIC you must follow a se quence of steps to initialize and set up the C31 s timer and serial port and to reset and program the AIC The following subsections describe this process As shown in Figure 4 1 page 4 3 the C31 s XFO signal is connected to the RESET signal of the AIC By toggling the RESET signal the C31 can reset the AIC This is achieved by executing the following instructions rpts 40 E Execute next instruction 40x ldi 2h IOF Pull AIC into reset ldi 6h IOF H Pull AIC out of reset Initializing the C31 timer 4 14 As shown in Figure 4 1 page 4 3 the C31 s timer TCLKO signal is con nected to the AIC s master clock MCLK signal The MCLK signal drives all the key logic signals of the AIC such as the shift clock the switched capacitor filter clocks and the A D and D A timing signals The timer pulses the TCLKO signal whenever the C31 timer counter register memory mapped to 0x0080 8024h counts up to the timer period register memory mapped to 0x0080 8028h value Then the timer counter registers reset to zero and re peat For a detailed description of the C31 timer refer to the TMS320C3x User s Guide Because of differences between the maximum frequency of the C31 s timer and the maximum and minimum frequencies of the AIC the fol lowing constraints should be observed Minimum Timer Period Register Value The C31 50 MHz can generate a maximu
127. sembling into Mysect_2 Go back to assembling into Mysect 1 Assembler Directives 6 27 Set Define Assembly Time Constant Syntax Description Example symbol set value The set directive equates a constant value to a symbol The symbol can then be used in place of the value in assembly source This allows you to equate meaningful names with constants and other values The symbol must appear in the label field The value must be a well defined expression that is all symbols in the expression must be previously defined in the current source module This example shows how to assign symbols with set TA set 1 TB set 5 isch ARO TA RO ldi ARO c TB RO Syntax Description Example Reserve Space space fill space size in words fill size in words value Two directives reserve space in the current section The space directive reserves size number of words in the current section and fills them with Os The SPC is incremented to point to the word follow ing the reserved space The fill directive reserves size number of words in the current section and fills them with value The value must be an absolute value The SPC is incremented to point to the word following the reserved space When you use a label with the space or fill directive it points to the first word reserved This example shows how the space and fill directives reserve memory space 12 Fill 12 loc
128. sti RO GTO ctrl r ldi 8S0 xctrl val R0 sti RO GQSO xctrl transmit control ldi 8S0 rctrl val R0 Sti RO QGQSO rctrl receive control ldi 0 RO sti RO SO_xdata DXR data value ela QGS0 gctrl val R0 Setup serial port sti RO SO_gctrl global control Functional Overview 4 21 TLC32040 AIC Initialization Example 4 2 Setting the TA and TB Registers Continued prog AIC ldi SEI idle ldi or sti idle sti idle andn sti SO_xdata R1 R1 SO_xdata SO_xdata R1 3R R1 8050 xdata RO SO_xdata 3 R1 R1 SO_xdata ldi rets Install the XINT RIN the vector RAM locat j WX HORE RACE e RR COR CACHE RR oe Sect B B SO_rdata RO This section of code initializes the AIC R i AIC_INIT LDI 0x10 IE Enable only XINT interrupt andn 0x34 IF Idi 0 R0 sti RO SO_xdata RPTS 0x040 i LDI 2 LOF XF0 0 resets AIC rpts 0x40 LDI 6 IOF XF0 1 runs AIC i ldi C_REG RO Setup control register call prog AIC i ldi Oxfffc RO Program the AIC to be real slow call prog AIC E ldi Oxfffc 2 R0 call prog AIC x ldi 8B REG RO Bump up the Fs to final rate call prog_AIC smallest divisor should be last ldi A_REG RO F call prog_AIC B b main Use original DXR data during 2 ndy Use original DXR data during 2 ndy Request 2 ndy XMIT Send register valu Leave with orig
129. struments Litera ture Response Center at 800 477 8924 When ordering please identify the book by its title and literature number TMS320C3x User s Guide literature number SPRUO31 describes the C3x 32 bit floating point microprocessor developed for digital signal proces sing as well as general applications its architecture internal register structure instruction set pipeline specifications and DMA and serial port operation Software and hardware applications are included TMS320C32 Addendum to the TMS320C3x User s Guide literature num ber SPRU132 describes the TMS320C32 floating point microprocessor developed for digital signal processing as well as general applications Discusses its architecture internal register structure specifications and DMA and serial port operation Hardware applications are also included TMS320 Floating Point DSP Assembly Language Tools User s Guide lit erature number SPRUO35 describes the assembly language tools as sembler linker and other tools used to develop assembly language code assembler directives macros common object file format and symbolic debugging directives for the C3x and C4x generations of de vices TMS320 Floating Point DSP Optimizing C Compiler User s Guide litera ture number SPRU034 describes the TMS320 floating point C compiler This C compiler accepts ANSI standard C source code and produces TMS320 assembly language source code for the C3x and C4x gener
130. tart directive links the named section to start assembling at the location address This effectively gives the DSK assembler the func tionality of a linker Directives Reference 6 9 Directives Reference The remainder ofthis chapteris areference Generally the directives are orga nized alphabetically one directive per page however related directives such as if else endif are presented together on one page Here is an alphabetical table of contents for the directive reference Directive Page Directive Page align 6 14 include 6 17 brstart 6 15 int 6 16 byte long copy 6 17 loop 6 24 data 6 18 pfloat16 6 21 else pfloat8 end 6 19 QXX 6 25 endif 6 23 sdef 6 26 endloop sect entry set fill 6 29 Space 6 29 float Start floats string float16 6 21 text 6 32 eee word 6 16 if 6 23 Assembler Directives 6 13 align Align to a 32 Word Boundary Syntax Description Example Slightly FIRLENG Critical FIR n FIRCOEF FIRDATA align The align directive aligns the current section to a 32 word boundary filling the hole with NOPs If the hole is greater than 2 words align places a branch to the newly aligned address This directive is useful for placing critical code blocks on the boundaries that best use the cache resources of the C3x archi tecture Here is an example of the align directive modified FIR filter example from C3x Users Guide Start ISR 0x809808 Create an
131. th DSK daughterboards DSK Overview 1 2 DSK Overview Figure 1 1 depicts the block diagram of the TMS320C3x DSK hardware The basic components are the TMS320C31 DSP the TLC32040 AIC expansion connectors system clock parallel printer port interface and tri color LED The parallel printer port connects the DSK to a host PC and allows the TMS320C31 to communicate with PC programs All of the signals for the C3x are routed to expansion connectors The expan sion connectors include four 32 pin headers an 11 pin jumper block and a 12 pin XDS510 header The TLC32040 AIC interfaces to the TMS320C3x serial port A jumper block allows removal of this connection to route the serial port to a DSK daughter card that you supply Two RCA connectors provide analog input and output on the board Figure 1 1 TMS320C3x DSK Block Diagram 1 0 expansion connector Parallel port interface Analog TLC32040 in Serial port AIC Anal TMS320C31 50 DT A23 A0 D31 DO gt Control Emulation port XDS510 MPSD port See Appendix B DSK Circuit Board Dimensions and Schematic Diagrams for an explanation of the basic DSK components Introduction 1 3 IET a Installing the DSK Assembler and Debugger This chapter describes how to install the DSP Starter Kit DSK on a PC system running under DOS Topic Page 210g What You Need e tetas tera MU peat ener b 2 2 2 Step 1 Con
132. the loop count the number of loops to be performed If there is no expression the loop count defaults to 246 The endloop directive terminates a repeatable block of code it executes when the number of loops performed equals the loop count given by loop This example shows the loop directive F a Create an FFT Twiddle table TR TI Start X TABLES 0x809A00 sect TABLES set 3 1415926 Set 4 REAL twiddles loop N 2 float cos TR pi N endloop i IMAG twiddles loop N 2 float 1 sin TI pi N endloop Syntax Description Example qxx value values Initialize 2s Complement Integers QXX The qxx directive generates signed 2s complement fractional integers and long integers whose decimal point is displaced xx places from the LSB Here s an example of the qxx directive The value of xx can be either positive or negative q0 3 1415926 qi 3 1415926 q2 3 1415926 q16 3 1415926 All upper 32 bits are integers One fractional bit left shift 1 Two fractional bits left shift 2 Upper 16 are whole integers lower 16 are fractional Assembler Directives 6 25 sdef Define Assembly Time Constant Syntax Description Example symbol sdef value The sdef directive functions in the same manner as the set directive however sdef can redefine the symbol name multiple
133. tialization To ensure that the switched capacitor lowpass and bandpass filters meet their transfer function characteristics the frequency of the clock inputs of the switched capacitor filter must be 288 kHz otherwise the upper and lower cut off frequencies of the low pass and band pass are scaled accordingly Equation 4 2 shows the switched capacitor filter frequency Equation 4 2 Switched Capacitor Filter Frequency MCLK SCF Clock frequency zi _ frequency IXA For example using this equation for an 8 kHz sampling rate with a MCLK of 6 25 MHz results in a Tx counter A of 11 A MCLK 2 x SCF Using Equation 4 2 Tx counter B results in 36 B MCLK 2 x A x Conver sion Frequency To initialize the AIC s Tx counter A and B registers you must send a primary communication followed by a secondary communication explained in the Pri mary communications subsection below and Secondary communications subsection on page 4 18 Primary communications load values into the D A while secondary communications load A D internal registers such as the con trol register Tx counters A and B and Rx counters A and B Primary communications Primary communications have a data value in the 14 MSBs D15 D2 of data and a mode selection in the two LSBs D1 D0 This format is shown in Figure 4 7 Figure 4 7 Primary Communication Data Format D15 D14 D13 D12 D11 D10 DI D8 D7 D6 D5 D4 D3 D2 Di DO mode D A converter valu
134. times without generat ing an error All instances of sdef symbols are stripped from the symbol table at the end of pass 1 analysis When used with the if directive sdef can condi tionally assemble included blocks of code This is useful for turning on and off included library functions The symbol must appear in the label field The value must be a well defined expression that is all symbols in the expression must be previously defined in the current source module This shows how symbols can be assigned with sdef VarA Var Var B B Set Sdef word Sdef word 15 OxAAAA VarA Varl 0x5555 VarA Varl rd F Note the VarB value change Syntax Description Example sect section name Assemble Into Named Section sect The sect directive begins assembling source code into the named section The sect directive defines named sections that are used like default text and data sections The section name identifies the section The section name is significant to 80 characters and must be enclosed in double quotes Here s an example of the sect directive Start Start sect word sect word sect word Mysect 1 0x809800 Mysect 2 0x809880 Mysect 1 1 1 1 Mysect 2 2 2 2 Mysect 1 1 1 1 Moo We Ne Se Sa Create two output sections at different addresses Begin assembling into Mysect_1 gives present address Begin as
135. tion file header definition functional overview GET DEBUG CTXT getmem 4 24 getting started global symbol definition h debugger option HALT_CPU hardware checklist hardware component overview hardware interface 4 2 AIC 4 6 host PES host communications f 4 to 4 5 memory map TLC32040 hardware overview hardware requirements optional 2 3 hexadecimal integers 5 8 host requirements 2 2 host software 4 23 ieee directive 6 8 6 22 if directive 6 23 Index include directive 6 9 6 17 Init_System input section definition input_rdy installing the DSK software 2 1 to instructions possible errors int directive introduction 1 1 invoking assembler 5 15 key features of the DSK l option label definition labels b 3 to 5 18 case sensitivity in assembly language source 5 2 syntax LF Cmd listing file definition listing software breakpoints long directive loop directive 6 10 LSB defined LSByte defined member definition memory ree ee definition memory requirements miscellaneous files mnemonic definition mnemonic field syntax MSB 5 3 definition MSb definition Index 3 Index named section definition object file definition object cpp opcodes defining 5 4 to 5 18 operand definition operands label 5 11 prefixes operating syst options assembler debugger definition overview DSK system em 3 7 2 PATH stat
136. to the host The targetindex increments the target address after each read opera tion XCTXT Getthe C31 context save buffer address XRUNF Restore the context of the CPU and execute code until a breakpoint is encountered or a halt command is issued This command is used for debugging XSTEP Restore the context of the CPU execute a single instruction and then save the context of the CPU This command is used for debugging XHALT Save the context of the CPU and wait for a new command This command is used for debugging Functional Overview 4 9 DSK Communications Kernel Debugging functions 4 10 Several debugging functions are implemented within the communications ker nel by building upon the low level communications commands The kernel s debugging functions can execute as a background task that is integrated into the system Debugging does not halt the system but allows concurrent execu tion of other tasks Debugging is fast and efficient and requires only a host in terface although it does consume some amount of processor memory and bandwidth In contrast scan based emulation which is another popular debugging meth odology is extremely helpful since it does not consume system memory and it provides a snapshot in time of the processor s in the system The DSK board has an MPSD header that allows the use of the XDS510 scan based emulator However scan based emulation is a non real time emulation that requires the c
137. ts for DISASSEMBLY Window Active Function Key Description CFI Help screen CF2 Set breakpoint at cursor EZD Clear breakpoint at cursor CF4 Run to cursor C5 Run F6 Display breakpoints Ez Clears all breakpoints CF8 Single steps your program ED Grow window F10 Step over Selects the DISASSEMBLY window ESC or Escape Table 7 11 Function Key Shortcuts for CPU Window Active Function Key Description Help screen Exit CPU window Move to top END Move to bottom C or Move cell vertical Move cell horizontal Using the DSK Debugger 7 13 Quick Reference Guide Table 7 12 Function Key Shortcuts for MEMORY Window Active Function Key Description CFA Help screen CF Toggle window size ESC Exit memory window HOME Move to top END Move to bottom CC PAGEUP or PacEpowN Move by page up down CD or Move cell vertical CTAB Move cell horizontal Table 7 13 Function Key Shortcuts for COMMAND Window Active Function Key Description CFT Displays a list of commands CF2 Displays extended precision registers in 40 bit hex adecimal format B Displays extended precision registers in floating point decimal format B Toggles between displaying the source file and the memory disassembly C5 Executes your program to the next breakpoint CF6 Displays all breakpoints GYD Clears all breakpoints CF8 Single steps your program CF Toggles the DISASSEMBLY window size F10 Single steps your p
138. urther commands y r SSTEP push DP temp storage of user DP ldp _ST DP for kernal sti ST _ST store ST sti IRO _IRO IRO used as temp later for indexed store pop IRO Save user DP sti IRO _DP A pop IRO Save user PC sti IRO G PC A sti SP _SP save user SP sti BK _BK Block size sti IE _IE Internal int enable sti IF _IF CPU interrupt flags sti IOF _IOF IO flags sti RS _RS Repeat start sti RE _RE Repeat end sti RC _RC Repeat counter StL IRO G IRO Keep everything lt IRO Saved previously Sti IR1 _IR1 H Stir ARO _ARO Use parallel opcodes for squeeze sti AR1 _AR1 7 ldi GCPUCTXT ARO ldi ARO AR1 addi 1 AR1 i ldi 2 IRO 3 stf RO AR0O IRO Store floats stf R1 AR1 IRO stf R2 ARO IRO stf R3 AR1 IRO H stf RA ARO IRO stf R5 AR1 IRO H stf R6 ARO IRO stf R7 AR1 IRO H F Sti RO ARO IRO Store longs sti R1 AR1 IRO Stu R2 ARO IRO sti R3 AR1 IRO sti R4 ARO IRO sti R5 ARI IRO sti R6 ARO IRO Sti R7 AR1 IRO Communications Kernel Source Code A 5 Communications Kernel Source Code sti AR2 _AR2 sti AR3 _AR3 sti ARA ARA sti AR5 8 AR5 sti AR6 _AR6 sti AR7 _AR7 Ldi 0 RO sti RO _FREERUN H TRAP AK call W HOST b spinO ARO amp ARI Already saved Freerun 0
139. use these functions with the COFF toolset then extract the resulting hexadecimal values from the DSK listing file LLLLL o M MM Table 5 2 ANSI C Math Library Functions Supported by the DSK Assembler Function long abs long long labs long double fabs double double cos double double acos double double cosh double double sin double double asin double double sinh double double tan double double atan double double tanh double long ceil long double floor double double exp double double log double Description Absolute value Absolute value Floating point absolute Cosine Arc cosine Hyperbolic cosine Sine Arc sine Hyperbolic sine Tangent Arc tangent Hyperbolic tangent Ceiling operator Floor operator Natural exponent e raised to the power of a value Natural logarithm In Expression Analyzer Table 5 2 ANSI C Math Library Functions Supported by the DSK Assembler Continued Function Description double log10 double Logarithm based 10 double pow1 0 double 10 raised to the power of a value double sqrt double Square root double log2 double Logarithm based 2 double pow double double First value raised to the power of the second value long br long long Align the first value to the next address located by raising the second value to the power of 2 long circ l
140. used for connect ing printers to the computer system although the parallel port can also be used for other peripherals In this case the C3x DSK is connected to the parallel printer port Glossary raw data Executable code or initialized data in an output section section A relocatable block of code or data that ultimately occupies contig uous space in the memory map serial port The serial port that the DSK uses for communicating with the analog interface circuit AIC The port address is selected based on which communcation port the AIC is attached to single step A form of program execution that allows you to see the effects of each statement The program is executed statement by statement the debugger pauses after each statement to update the data display windows source file A file that contains C code or assembly language code that will be assembled to form a temporary object file symbol A string of alphanumeric characters that represents an address or a value VGA Video Graphics Array An industry standard for video cards window A defined rectangular area of virtual space on the display word A 32 bit addressable location in target memory Glossary C 5 debugger option in assembly language source C31 serial port initializing 4 15 to symbol for SPC 5 11 operand prefix in assembly language source operand prefix absolute address definition adding a software breakpoint AIC ha
141. word XREAD 2 0x809FF6 word XCTX 73 0x809FF7 word XRUNF 4 0x809FF8 word XSTEP 75 0x809FF9 word XHALT 6 0x809FFA word W HOST 1 0x809FFB word R HOST 8 0x809FFC word spinO 10 0x809FFD Use for spare command The last two locations of internal memory hold the two parameters j which define the printer ports bus return width Depending on the values either 8 bit bi directional or 4 bit nibble returns can be implimented These values control the loop count and shift F value needed to place the correct bits on the proper return buffer inputs E DO NOT OVERWITE THESE VALUES unless you are performing buswidth verification or setup For more details see the communications s initialization routines within the host side code 7 r WSCOUNT word 7 0x809FFE These locations hold the W HOST WSHIFT word 4 0x809FFF buswidth parameters Nibble Byte end Communications Kernel Source Code A 11 Appendix B DSK Circuit Board Dimensions and Schematic Diagrams Figure B 1 shows the dimensions of the DSK circuit board and the rest of the appendix contains a brief description of the hardware in the TMS320C3x DSP Starter Kit the schematic diagrams and design notes for host interface control B 1 Figure B 1 TMS320C3x DSP Starter Kit DSK Circuit Board Dimensions
142. x809FC8 0x080 lt ETRAP 0x74000008 INTO b Ox809FC9 0x100 INT1 b 0x809FCA 0x200 DINT b 0x809FCB 0x400 Communications Kernel Source Code A 9 Communications Kernel Source Code HOST HPI communications routines packed into himem A NOTE These routines can be called from a high level langauge compiler using the C31s TRAP commands by directly linking their resolved addresses or by using the jump table H W HOST performs of RO to the host host PC should be an interlocked Host Port write of the contents H using the HPSTB HPACK protocol When called the waiting for this function to send data W HOST push push push push ldp ldi ldi WH sti lsh db pop b ARO AR1 ST DP WSCOUNT OxF000 ARO0 WSCOUNT AR1 RO ARO 16 QWSHIFT RO AR1 WH DP COMNHST Used for HPI address Used for loop counter Keep flags Might not be on same page HPI address sign extends to 0xFFF000 Store lsbs to HPI shift to next lsbs loop until done A R_HOST performs an interlocked Host Port read from the printer port interface and places the result into RO R HOST push push push push ldi rdi RH lsh ldi lsh or db pop iii b COMNHST pop pop pop rets ARO AR1 ST R1 OxF000 ARO0 3 AR1 8 R0 ARO R1 24 R1 R1 RO AR1 RH R1 COMNHST ST ARI ARO HPI Address loop counter temp register HPI address sign extends
143. y to use window oriented interface The DSK debugger separates code data and commands into manageable portions Powerful command set Unlike many other debugging systems this debugger doesn t force you to learn a large intricate command set The DSK debugger supports a small but powerful command set Flexible command entry There are two main ways to enter commands You can enter commands at the command line or use the function keys choose the method that you like better Overview of a Code Development and Debugging System 3 3 Developing Code for the DSK 3 3 Developing Code for the DSK Figure 3 2 illustrates the DSK code development flow Figure 3 2 DSK Software Development Flow assemblers source assembler debugger 3 4 X ecutab debugger z 1 The following list describes the tools shown in Figure 3 2 The assembler translates DSK assembly language source files into machine language object files for the TMS320C3x family of processors Only the most essential assembler features are incorporated This is nota COFF assembler although executable object files created by the TI TMS320 floating point DSP assembly language tools will also load and run on the DSK The main purpose of the development process is to produce a module that can be executed in a DSK target system You can use the debugger to refine and correct your code Getting Started 3 4 Getting Started
144. ys and commands Topic Page 7 1 Invoking the Debuggen 7 2 7 2 Understanding the Debugger Windows 7 3 Usingitheilielp Menumg eer TESTE retener e eerte ees 7 4 Using Software Breakpoints eeeeeeeeeeeeee 7 5 Debugger Commands 99 om Er EE SES 7 6 Quick Reference Guide sesseeeeeeeeeeeee 7 13 7 1 Invoking the Debugger 7 1 Invoking the Debugger Here s the command for invoking the debugger dsk3d options dsk3d options is the command that invokes the debugger supply the debugger with additional information Table 7 1 lists the debugger options the following subsections describe some of the more commonly used options Table 7 1 Summary of Debugger Options Option or HELP AUTO BW 4 Nibble BW 8 Byte LPTx LPT x PORT 0x378 RESET TEST T Xx WIN 1 WIN 0 Brief Description Displays a listing of the available options Automatically detects if the parallel port supports 8 or 4 bit mode Forces communication using the parallel port in standard 4 bit unidirectional mode Forces communication using the parallel port in 8 bit bidirectional mode Selects a parallel printer port LPT1 is default Selects any port address Resets cold boots the DSK Searches automatically through LPT1 LPT2 and LPT3 for the presence of a DSK Adds extra xx I O bus cycles to each transfer
Download Pdf Manuals
Related Search
Related Contents
DeLOCK 0.2m SATA Cable 1. Introduction: - SDR-Kits Maytag MMV6190DS Use and Care Manual Chemlok 205、ロード・ファー・イーストInc TA54 Service SMS4DC Copyright © All rights reserved.
Failed to retrieve file