When I run my project in the debugger by selecting the start button (F5), it stops running immediately and I get ILLEGAL_BP in the command window. After some testing I found any code outside the main loop executes as expected. As soon as it gets to the for(;;) statement it stops. I have tried it with code in the for(;;) statement and without code. Makes no difference.
This is my main function.
void main(void) {
/* put your own code here */
EnableInterrupts;
for(;;) {
_FEED_COP(); /* feeds the dog */
} /* loop forever */
/* please make sure that you never leave main */
}
What is ILLEGAL_BP. To me this is "Illegal Break Point" Correct ?
Ray.
An Illegal Breakpoint usually means that the processor has been reset, this is typically due to a COP- or Illegal address reset. The Illegal address reset can be caused by an interrupt that do not have an ISR.
/Sten
As StenS correctly mentioned, ILLEGAL_BP means that debugger get lost (MCU behavior is different from behavior which debugger expects). Typical root cause is unexpected interrupt or BDM communication lost.
Interrupt catcher you can use for debugging or directly in your software. Few general notes:
a) You should replace lines for expected interrupt by your interrupts routines as in example of SCI0 interrupt routine.
b) All interrupt vectors are only 16bit addresses, therefore all your interrupt routines must be placed in non banked memory (for example by #pragma commands)
c) Interrupt number 0 presents POR reset vector, 1 is CM reset, 2 is COP reset, … , 119 is Spurious Interrupt. Interrupt number = (0xFE-Vector Address)/2. See Table Interrupt Vector Locations at RM. For Example: Interrupt number of SCI0 = (0xFE-D6)/2 = 0x14 = 20.
3. Please check stability of your bus clock (ECLK pin) and stability of power supply voltage(s).
4.…