We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello, I have a problem using ISD51 to debug my code. AT first, I used the simulator to run my code and it works fine. Then I added ISD51.A51 into my project and also added ISDinit() and ISDcheck() to my code, changed the OPTION menu to enable ISD51 and compiled. The problem is that the code doesn't start running after loading (seems waiting). Can anyone help with it? Another thing: during compiling, I saw there were a few bytes overlap in code space. Does it matter? Thanks Frank ------------------------------------------- compiling LOG.C... compiling test.c... assembling Conf_tny.a51... assembling STARTUP.A51... assembling ISD51.A51... linking... *** WARNING L5: CODE SPACE MEMORY OVERLAP FROM: 0023H TO: 0025H Program Size: data=68.3 xdata=454 code=16180 creating hex file from ".\output\snake"... ".\output\snake" - 0 Error(s), 1 Warning(s).
hi, *** WARNING L5: CODE SPACE MEMORY OVERLAP FROM: 0023H TO: 0025H ISD51 installs UART communication so it declares
CSEG AT SINTRVEC ; Serial Interrupt LJMP SerialInterrupt
SINTRVEC EQU 0x23 ; Interrupt Vector Address of UART interrupt
Thanks. But I checked the file *.m51. It seems nothing wrong. Please see below. * * * * * * * C O D E M E M O R Y * * * * * * * CODE 0000H 0003H ABSOLUTE BL51 BANKED LINKER/LOCATER V5.03 08/20/2004 09:47:10 PAGE 3 0003H 0008H *** GAP *** CODE 000BH 0003H ABSOLUTE 000EH 0015H *** GAP *** CODE 0023H 0003H ABSOLUTE 0026H 00DAH *** GAP *** CODE 0100H 061FH UNIT ?C?LIB_CODE CODE 071FH 0460H UNIT ?PR?DISPLAYTASK?DISP
Sorry, I copied wrong one. Below shows that I have a overlap problem. * * * * * * * C O D E M E M O R Y * * * * * * * CODE 0000H 0003H ABSOLUTE 0003H 0008H *** GAP *** CODE 000BH 0003H ABSOLUTE 000EH 0015H *** GAP *** CODE 0023H 0003H ABSOLUTE * OVERLAP * CODE 0023H 0003H ABSOLUTE 0026H 00DAH *** GAP *** CODE 0100H 061FH UNIT ?C?LIB_CODE
so here is the question comes: have you utilized UART with your program? Does it have something like:
void serial (void) using 4
hi, sorry I did wrong post too (= I meant:
void timer0 (void) interrupt 4
Actually I have a line "void serial( void ) interrupt 4" to define my serial port. Maybe I should remove this function?
oh no, it is last day of work week... Finally, I meant (help me type right now :)
void serial (void) interrupt 4
yes, you should delete because ISD51 utilizes UART for debug purposes. Regards, Oleg
Thank you very much for your help.
Sorry, I still have a problem with ISD51. I disabled the serial interrupt 4. Also I changed the RAMTOP FROM 0xFF TO 0xF8 in ISD51.A51, RAMSIZE from FF to F8 and CMP_END from 0xFFFF to 0x7FFF, IE to IEN0 as I'm using RTX51 Tiny with C515C processor. After clicking "debug" button, an error message said "please check contents...." But I have to say the contents in ROM is the same as in my PC, I don't know the Keil software keeps asking... Frank
Hello Frank, I have the same question, did you find any answers? With best wishes, S.
Unfortunately no. Frank
Seems like we all have had our trials and tribulations with ISD51. I offer some insights from my own painful experiences: 1. The ISD51 User Guide is skimpy and only warns indirectly about the interrupt vector 0x23, which is the Serial UART interrupt for most 8051 devices. (This vector is defined in symbol SINTRVEC within ISD51.h.) The Guide does warn, however, that interrupt vector 0x33 is used for hardware breakpoints in certain chips. This code is assembled if the TI_MSC1210_BREAKS symbol is defined at the bottom of ISD51.h. This latter interrupt is re-vectored to 0x6B by ISD51, so you need to change your code to capture that vector if you use it (you are NOT removing your Interrupt service routine in this case -- you are merely relocating it). 2. BEWARE the Watchdog Timer! For example, when enabled via configuration bytes on a Philips LPC935 chip, the Watchdog starts with a default timeout of roughly 2 seconds. This is NOT enough time for ISD51 to establish its connection with the chip! You need at least 5 seconds. Remember that most Watchdogs have their own clock source, and this runs regardless of what ISD51 is doing, so if you execute a breakpoint, the Watchdog keep ticking (and eventually bite you in the ass)! A Watchdog Timeout that Resets the MCU will typically result in the appearance of a NO CONNECTION or ERRONEOUS COMMUNICATION failure within ISD51 -- exactly the problem most often described in this and similar threads. This took me forever to figure out. I now disable the Watchdog Timer entirely whenever I am using ISD51! 3. Don't forget to enable global interrupts by setting the EA bit. ISD51 cannot take control if this bit (or the ES bit) is cleared. 4. Among the ISDinit, ISDwait, and ISDcheck functions, I have found ISDwait is most useful. When using this function, use it by itself! DO NOT precede it with a call to ISDinit or you will likely find your program looping within the wait function without breaking. ISDwait stops execution nicely and neatly. Then you can set breaks and issue commands from the debugger console and continue on from there. WARNING: If you use ISDinit by itself, your program can get VERY far into its execution before the ISD51 interrupt takes control -- and your code can do a lot to foul up ISD51 in that time. For example, clearing the global interrupt OR looping within an interrupt service routine will prevent the UART interrupt from ever occuring -- and ISD51 will appear dead in the water! 5. Last, but not least, DISABLE any code that uses the TxD and/or RxD pins of the UART port. If you need to communicate data via the UART, the ISD51 functions provided will do a fairly good job of allowing you to use the UART at the same time as ISD51. If you go around these functions (or the stdio.h) to directly manipulate the UART I/O, you are likely headed for frustration. Hope somebody finds these tips useful! Steve
Thanks Steve for your valid points. Unfortunately, I'm still having troubles in debugging ISD51. Below is my piece code for my testing purpose. Can you find out something wrong in it?
/* 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 j = 0x200; while (j--) { #ifndef ISD51 // init ISD51 only when the uVision2 Debugger tries to connect WDT = 1; // reset SWDT = 1; #endif }; } } 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 */ } /* 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; } } void main (void) { unsigned int i; #ifndef ISD51 // init ISD51 only when the uVision2 Debugger tries to connect Project_Init(B_9600); // Initialize Chip and Serial Interface TestSerial(); #else SRELH = 0x03; /* set up 9600 Baud */ SRELL = 0xBF; PCON |= 0x80; /* SMOD = 1 */ ADCON0 |= 0x80;/* enable baud rate generator */ SCON = 0x50; /* mode 1: 8-bit UART, enable receiver */ ISDinit(); // initialize uVision2 Debugger and continue program run #endif ES = 1; EAL = 1; /* Enable global interrupt flag */ // TimerInit(); while (1) { #ifdef ISD51 // init ISD51 only when the uVision2 Debugger tries to connect ISDcheck(); // initialize uVision2 Debugger and continue program run Delay(200); #endif i++; } }
Frank, Let's start with the obvious: 1) To generate your ISD51 code, make sure you have the symbol ISD51 defined. I don't see a header file included anywhere so I cannot tell. (Sorry if that is TOO obvious.) 2) You are calling ISDinit() BEFORE enabling interrupts. Try moving the call to ISDinit() to AFTER the ES and EAL settings. This may not be a big problem, but it could cause a timing issue in the handshake. 3) Better yet, remove the call to ISDinit() and just use ISDcheck() by itself. This function actually does the ISDinit() for you, after it sees the incoming 0xA5 from the debugger. ---- Note: The ISDwait() and ISDcheck() functions really don't do ANYTHING after the Serial Interrupt (ES) is enabled by ISDinit(). (In fact, ISDinit() doesn't do anything if called more than once, because it sees that the ES flag is already enabled.) ISDwait() and ISDcheck() are different from ISDinit() only in that they LOOK for an incoming 0xA5 from the debugger BEFORE they invoke ISDinit() which, in turn, merely enables the Serial Interrupt (by setting ES). Thereafter, just about everything (including further 0xA5 handshakes) is controlled by the Serial Interrupt servicing routine contained within ISD51.A51 (until such time as you explicitly disable the interrupt). ISDcheck() is useful if you want your code to run semi-normally in the ABSENCE of the debugger. ISDcheck() essentially performs a No-Op when it is called, UNLESS a 0xA5 is present on the UART Receive pin. Then, and only then, does ISDcheck() launch the ISD51 Interrupt as described above. Steve