le duy hung

Interrupt problem with card S12X. Help pls!

Discussion created by le duy hung on May 19, 2010
Latest reply on May 19, 2010 by le duy hung

hello, i'm newbie with MCU MC9S12XDP512.

I want to enable an interrupt PIT on chanel 0 to send a message via port CAN0 , and I did the following configurations

// Configuration des PIT
        
   PITCE = 0x07;      // Activation des canaux 0, 1 et 2 du PIT
    PITMUX = 0x02;     // Timer 0 et 2 avec microtime base 0 & Timer 1 avec microtime base 1
    PITMTLD0 = 7;      // prediviseur toute les 1us
    PITLD0 = 999;    // IT toute les 1ms du PIT0
    PITLD2 = 65535;    // Chargement du PIT2 à sa valeur max -> IT toute les 65,5ms
    PITMTLD1 = 79;     // prediviseur toute les 10us
    PITLD1 = 19999;    // IT toute les 200ms du PIT1
    PITINTE = 0x07;    // Activation des interruptions de rebouclage pour les Timer 0, 1 et 2
    PITCFLMT = 0xA3;   // Chargement des Micro Timer 0 et 1   

//  enable portCAN and interrupt

    can0_init();  

    EnableInterrupts;

//  ISR on channel 0

#pragma CODE_SEG __NEAR_SEG NON_BANKED

interrupt void PIT0_ISR(void)
{

if(MSCAN0_CheckTxBufReady()==1)
        MSCAN0_Tx(&msg);

    PITTF = 0x01;
}

#pragma CODE_SEG DEFAULT

 

// The problem is when i debug my program, i met the caution : ILLEGAL_BP and the interrupt cannot execute. I think my module CAN works well because when i don't use the interrupt with channel 0,  it doesn"t happen like that.

can anyone help me pls!

best rerards

Outcomes