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++;

}
}

0