This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

issues in ISD51 debugging

Hello all,
I have a problem using ISD51 to debug my board with C515C processor. In order to test the serial port and basic ISD51 functionality, I used a small piece of code below (Test.c).
First under the Keil PK51 software simulator, it works fine. I could use the Hyperterminal to receive or to send any character to my board. Then I switched from simulator to Keil In-System ISD51 Debug and it failed. I don't know why as I tried everything in Keil's online documentation.
One thing I need to point out is that I didn't burn the code into flash and instead used a flash simulator Flex III.
Can someone giveme a hand with this issue?

Thanks in advance,
Frank


/*------------------------------------------------------------------------------
TEST.C: ISD51 Demo for Infineon C868

Copyright 2003 Keil Software, Inc.
------------------------------------------------------------------------------*/

#include <intrins.h>
#include <stdio.h>
#include "ISD51.h"
#include "reg515a.h"

/* parameters to initialize serial communication */
#define B_38400 0x05 /* 38400 baud */
#define B_19200 0x04 /* 19200 baud */
#define B_9600 0x03 /* 9600 baud */
#define B_4800 0x02 /* 4800 baud */
#define B_2400 0x01 /* 2400 baud */
#define B_1200 0x00 /* 1200 baud */

void Delay(unsigned int i) {

unsigned int j;

while(i--) { // delay

WDT = 1; // reset
SWDT = 1;

j = 0x200;
while (j--);
}
}

void Project_Init(serBaud) {
switch ( serBaud )
{ /* oscillator frequency = 10 Mhz */

case B_38400:
SRELH = 0x03; /* Reloadwert für 38400 Baud */
SRELL = 0xF0;
PCON |= 0x80; /* SMOD = 1 */
break;

case B_19200:
SRELH = 0x03; /* Reloadwert für 19200 Baud */
SRELL = 0xDF;
PCON |= 0x80; /* SMOD = 1 */
break;

case B_9600:
SRELH = 0x03; /* Reloadwert für 9600 Baud */
SRELL = 0xBF;
PCON |= 0x80; /* SMOD = 1 */
break;

case B_4800:
SRELH = 0x03; /* Reloadwert für 4800 Baud */
SRELL = 0x7E;
PCON |= 0x80; /* SMOD = 1 */
break;

case B_2400:
SRELH = 0x02; /* Reloadwert für 2400 Baud */
SRELL = 0xFC;
PCON |= 0x80; /* SMOD = 1 */
break;

case B_1200:
SRELH = 0x01; /* Reloadwert für 1200 Baud */
SRELL = 0xF7;
PCON |= 0x80; /* SMOD = 1 */
break;

default:
return;
break;
}

ADCON0 |= 0x80; /* enable baud rate generator */
SCON = 0x50; /* mode 1: 8-bit UART, enable receiver */
// ES = 1; /* enable serial interrupt IE.ES */
}


#if 1 // uncomment this function to verify serial communication

/*
* Test Function: verify serial communication with HyperTerminal
*/
void TestSerial (void) {
char c = 'A';

TI = 1;
while (1) {

Delay(200);

if (RI) {
c = SBUF;
RI = 0;
}
while (!TI);
TI = 0;
SBUF = c;
}
}

#endif



void main (void) {
unsigned int i;

Project_Init(B_9600); // Initialize Chip and Serial Interface

#ifndef ISD51 // init ISD51 only when the uVision2 Debugger tries to connect
TestSerial();
#endif

#if 0 // init ISD51 and start user program until the uVision2 Debugger connects
ISDinit (); // initialize uVision2 Debugger and continue program run
#endif

#if 0 // init ISD51 and wait until the uVision2 Debugger connects
ISDwait (); // wait for connection to uVision2 Debugger
#endif


while (1) {
#ifdef ISD51 // init ISD51 only when the uVision2 Debugger tries to connect
ISDcheck(); // initialize uVision2 Debugger and continue program run
#endif

i++;

}
}

Parents
  • I think I did everything using all Keil website info. Below is my updated ISD51.h matching C515C processor. Can you help find out anything wrong in this file? Thanks.



    Frank



    //---------------------------------------------------

    #define RAMSIZE 0xF8 // default is 0x100 => 256 bytes IDATA RAM



    #define CMP_START 0x0 // default is 0

    #define CMP_END 0x7FFF // default is 64KB (0xFFFF)



    //------------------------------------------------------------------------------



    #ifndef __C51__



    /* 8051 SFR Register addresses for on-chip 8051 UART */

    sfr SCON = 0x98;

    sfr SBUF = 0x99;

    sfr IEN0 = 0xA8;



    /* SCON Bits */

    sbit TI = SCON^1;

    sbit RI = SCON^0;



    /* IEN0 Bits */

    sbit ES = IEN0^4;



    CLR_TI MACRO ; Clear Transmit Interrupt Flag

    CLR TI ; No CPU register may be changed here

    ENDM



    SET_TI MACRO ; Set Transmit Interrupt Flag

    SETB TI ; No CPU register may be changed here

    ENDM



    JNB_TI MACRO label ; Jump if Transmit Interrupt Flag not set

    JNB TI,label ; PSW may be modified without saving it

    ENDM



    WR_SBUF MACRO ; Write ACC to SBUF

    MOV SBUF,A ; ACC and PSW may be modified without saving it

    ENDM



    CLR_RI MACRO ; Clear Receiver Interrupt Flag

    CLR RI ; No CPU register may be changed here

    ENDM



    JB_RI MACRO label ; Jump if Receiver Interrupt Flag set

    JB RI,label ; ACC and PSW may be modified without saving it

    ENDM



    JNB_RI MACRO label ; Jump if Receiver Interrupt Flag not set

    JNB RI,label ; ACC and PSW may be modified without saving it

    ENDM



    RD_SBUF MACRO ; Return SBUF in ACC

    MOV A,SBUF ; ACC and PSW may be modified without saving it

    ENDM



    CLR_ES MACRO ; Disable Serial Interrupt

    CLR ES ; No CPU register may be changed here

    ENDM



    SET_ES MACRO ; Enable Serial Interrupt

    SETB ES ; No CPU register may be changed here

    ENDM



    JNB_ES MACRO label ; Jump if Receiver Interrupt Flag not set

    JNB ES,label ; ACC and PSW may be modified without saving it

    ENDM



    SAVE_ES MACRO ; Save Serial Interrupt enable bit to Carry

    MOV C,ES ; ACC and PSW may be modified without saving it

    ENDM



    RESTO_ES MACRO ; Restore Serial Interrupt enable bit from Carry

    MOV ES,C ; ACC and PSW may be modified without saving it

    ENDM



    SINTRVEC EQU 0x23 ; Interrupt Vector Address of UART interrupt



    #endif

    //------------------------------------------------------------------------------

    //

    // ISD51 CODE MEMORY ACCESS FUNCTIONS FOR HARDWARE BREAKPOINTS

    // ===========================================================

    //

Reply
  • I think I did everything using all Keil website info. Below is my updated ISD51.h matching C515C processor. Can you help find out anything wrong in this file? Thanks.



    Frank



    //---------------------------------------------------

    #define RAMSIZE 0xF8 // default is 0x100 => 256 bytes IDATA RAM



    #define CMP_START 0x0 // default is 0

    #define CMP_END 0x7FFF // default is 64KB (0xFFFF)



    //------------------------------------------------------------------------------



    #ifndef __C51__



    /* 8051 SFR Register addresses for on-chip 8051 UART */

    sfr SCON = 0x98;

    sfr SBUF = 0x99;

    sfr IEN0 = 0xA8;



    /* SCON Bits */

    sbit TI = SCON^1;

    sbit RI = SCON^0;



    /* IEN0 Bits */

    sbit ES = IEN0^4;



    CLR_TI MACRO ; Clear Transmit Interrupt Flag

    CLR TI ; No CPU register may be changed here

    ENDM



    SET_TI MACRO ; Set Transmit Interrupt Flag

    SETB TI ; No CPU register may be changed here

    ENDM



    JNB_TI MACRO label ; Jump if Transmit Interrupt Flag not set

    JNB TI,label ; PSW may be modified without saving it

    ENDM



    WR_SBUF MACRO ; Write ACC to SBUF

    MOV SBUF,A ; ACC and PSW may be modified without saving it

    ENDM



    CLR_RI MACRO ; Clear Receiver Interrupt Flag

    CLR RI ; No CPU register may be changed here

    ENDM



    JB_RI MACRO label ; Jump if Receiver Interrupt Flag set

    JB RI,label ; ACC and PSW may be modified without saving it

    ENDM



    JNB_RI MACRO label ; Jump if Receiver Interrupt Flag not set

    JNB RI,label ; ACC and PSW may be modified without saving it

    ENDM



    RD_SBUF MACRO ; Return SBUF in ACC

    MOV A,SBUF ; ACC and PSW may be modified without saving it

    ENDM



    CLR_ES MACRO ; Disable Serial Interrupt

    CLR ES ; No CPU register may be changed here

    ENDM



    SET_ES MACRO ; Enable Serial Interrupt

    SETB ES ; No CPU register may be changed here

    ENDM



    JNB_ES MACRO label ; Jump if Receiver Interrupt Flag not set

    JNB ES,label ; ACC and PSW may be modified without saving it

    ENDM



    SAVE_ES MACRO ; Save Serial Interrupt enable bit to Carry

    MOV C,ES ; ACC and PSW may be modified without saving it

    ENDM



    RESTO_ES MACRO ; Restore Serial Interrupt enable bit from Carry

    MOV ES,C ; ACC and PSW may be modified without saving it

    ENDM



    SINTRVEC EQU 0x23 ; Interrupt Vector Address of UART interrupt



    #endif

    //------------------------------------------------------------------------------

    //

    // ISD51 CODE MEMORY ACCESS FUNCTIONS FOR HARDWARE BREAKPOINTS

    // ===========================================================

    //

Children