Gustavo Pimentel

ILLEGAL_BP provoque by IRQ

Discussion created by Gustavo Pimentel on Nov 8, 2010
Latest reply on Nov 9, 2010 by David Simpson

Hi everybody,


I have developed a code for s12xdp512 that uses,

On s12x CPU:

 - 2 PITs(10us and 1ms) which one with interrupt,

 - 2 SPI (Masters at 10MHz and 1.67 MHz),

 - 1 SCI (115200 bps) with interrupt,

and on Xgate:

 - 1 SPI (Slave) on xgate working at 8MHz.


The xgate receives a SPI frame with length variable depending of a command byte defined in a proprietary protocol that comes from another processor. I have too a signal for framing all frame transmitted from the other processor (this signal in idle is high and comes to low when before any transmission between the other processor and Xgate and comes to high when the transmission comes to a end).


I was trying to program some fail-safe code, to prevent the case that previous transmission has being cut to half for some unknown reason, by using the IRQ interruption to stop any pending or running thread and restart the communication on xgate.


But my problem is this, everytime that I register #IRQ on interruption vector, I get approximaly between 30 seconds to 2 minutes from that I click on run button on debugger to get an ILLEGAL_BP. If I don't register the interruption I don't have any problem (the maximum time that I have left the board running was for  3 days consecutive).


I have have defined this sets:


on prm file:


VECTOR ADDRESS 0xFFF2 IRQ_INT             // Interrupt function for external interrupts


on main.c file:

(initialization code)


  IRQCR_IRQE=1;                             /* Falling edge selected */  IRQCR_IRQEN=1;                            /* External Interrupts Enabled */


(interruption definition)


interrupt void IRQ_INT(void){  IRQCR_IRQEN=0;  asm("CLI");  IRQCR_IRQEN=1;}



Can anyone have some idea about why is this happening?