background image

 Contents

vii

 

 

1

Introduction

1-1

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 

2

Debug Strings

2-1

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 

3

In-System Debugging Using Keil’s ISD51 Feature

3-1

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 

3.1

Operation

3-2

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 

3.2

Resource Requirements

3-2

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 

3.3

Limitations

3-3

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 

4

File List

2-1

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 

4.1

C Source Code

4-2

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 

4.1.1

VOID rs232Initialization(VOID);

4-2

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 

4.1.2

VOID rs232PutChar(BYTE bData);

4-2

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 

4.1.3

VOID rs232PutHex(BYTE bData);

4-2

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 

4.1.4

VOID rs232PutString(char *str);

4-3

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 

4.1.5

char rs232GetChar(void);

4-3

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 

4.2

Header Files

4-4

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 

4.2.1

RS232DBG.h

4-4

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 

4.2.2

Types.h

4-5

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 

Summary of Contents for TUSB2136

Page 1: ... May 2004 MSDS Bus Solutions User s Guide SLLU027A ...

Page 2: ...tute a license from TI to use such products or services or a warranty or endorsement thereof Use of such information may require a license from a third party under the patents or other intellectual property of the third party or a license from TI under the patents or other intellectual property of TI Reproduction of information in TI data books or data sheets is permissible only if reproduction is...

Page 3: ...debugging purposes Chapter 3 In System Debugging Using Keil s ISD51 Feature gives general information and specific pointers for the use of Keil debugging software with the TUSBxxxx Chapter 4 File List contains a source code listing for each C routine and header file used for debugging Notational Conventions This document uses the following conventions Program listings program examples and interact...

Page 4: ... the brackets themselves Here is an example of an instruction that has an optional parameter LALK 16 bit constant shift The LALK instruction has two parameters The first parameter 16 bit constant is required The second parameter shift is optional As this syntax shows if you use the optional second parameter you must precede it with a comma Square brackets are also used as part of the pathname spec...

Page 5: ...LS442 TUSB3210 Universal Serial Bus General Purpose Device Controller Data Manual TI literature number SLLS466 Trademarks Hyperterminal is a trademark of Hilgraeve Incorporated IAR Embedded Workbench is a trademark of IAR Systems AB Sweden Windows is a trademark of Microsoft Corporation Other trademarks are the property of their respective owners ...

Page 6: ...vi ...

Page 7: ...source Requirements 3 2 3 3 Limitations 3 3 4 File List 2 1 4 1 C Source Code 4 2 4 1 1 VOID rs232Initialization VOID 4 2 4 1 2 VOID rs232PutChar BYTE bData 4 2 4 1 3 VOID rs232PutHex BYTE bData 4 2 4 1 4 VOID rs232PutString char str 4 3 4 1 5 char rs232GetChar void 4 3 4 2 Header Files 4 4 4 2 1 RS232DBG h 4 4 4 2 2 Types h 4 5 ...

Page 8: ...viii ...

Page 9: ... devices such as Keil s PK51 environment and IAR s Embedded Workbench Despite the simplicity of the 8052 it is still necessary to debug the code and to have the necessary tools and techniques for this task Because of their customized pinout and lack of JTAG or hardwired debug capability it is not possible to use existing in circuit emulation ICE tools with TUSBxxxx However alternative methods can ...

Page 10: ...1 2 ...

Page 11: ...rface that is attached to a terminal such as a PC running the Windows Hyperterminal application Simple function routines that output values to the UART are added to the code and are called periodically within the code For example to output the port 1 status of the 8052 rs232PutHex P1 To print a string rs232PutString Hello World Source code for these routines is shown in Chapter 4 Note that the nec...

Page 12: ...2 2 ...

Page 13: ...U registers and memory Access the special function registers SFRs ISD51 is available in Keil s C51 environment version 6 23 and later It is available only in the PK51 Professional Developer s Kit Keil provides full documentation for the feature and this documentation should serve as the ultimate reference For more details on ISD51 operation and additional features see http www keil com Topic Page ...

Page 14: ...debugger commands the interrupt function to resume the 8052 exits the ISD51 interrupt function and executes the user program Code execution can be controlled using software breakpoints If breakpoints are set the 8052 enters the interrupt routine after each instruction which checks whether a breakpoint address has been reached If so it connects to the µVision2 debugger otherwise it returns executio...

Page 15: ...tations The ISD51 feature has a few limitations Code banking is not supported PDATA variables cannot be reviewed Breakpoints and single stepping do not work in interrupt service routines Only part of the SFR can be changed in the ISD debugger see ISD51 A51 for the details ...

Page 16: ...3 4 ...

Page 17: ...List This chapter contains a source code listing for each C routine and header file used in TUSB2136 TUSB3210 TUSB3410 TUSB5052 firmware debugging Topic Page 4 1 C Source Code 4 2 4 2 Header Files 4 4 Chapter 4 ...

Page 18: ...smit ready RI 0 Set Receive Interrupt flag 0 to receive ready 4 1 2 VOID rs232PutChar BYTE bData Send an unsigned character to the 8052 serial interface Based on this routine you can create a print string routine and call the C standard library sprintf to do any translation VOID rs232PutChar BYTE bData while TI 1 wait until last byte transfer complete TI 0 clear Transmit Interrupt flag SBUF bData ...

Page 19: ...char str Send a string which is terminated by 0 to the 8052 serial interface void rs232PutString char str while str 0 rs232PutChar str 4 1 5 char rs232GetChar void Get one byte from the 8052 serial interface char rs232GetChar void while RI RI 0 RETURN SBUF ...

Page 20: ...E BAUD4800_12000 Constant Definition 11 0592MHz SMOD 0 define BAUD4800_11059 256 28800 4800 250 define BAUD9600_11059 256 28800 9600 253 24 48 96MHz SMOD 1 define BAUD4800_12000 256 62500 4800 242 9791666 define BAUD4800_24000 256 125000 4800 229 9583333 define BAUD9600_12000 256 62500 9600 249 4895833 don t use define BAUD9600_24000 256 125000 9600 242 9791666 define BAUD9600_48000 256 250000 960...

Page 21: ...t USHORT typedef long LONG typedef unsigned long ULONG typedef void VOID typedef unsigned long HANDLE typedef char PSTR typedef int BOOL typedef double DOUBLE typedef unsigned char BYTE typedef unsigned char PBYTE typedef unsigned int WORD typedef unsigned long DWORD Constant Definition define YES 1 define NO 0 define TRUE 1 define FALSE 0 define NOERR 0 define ERR 1 define NO_ERROR 0 define ERROR...

Page 22: ...4 6 ...

Reviews: