Interrupt problem with card S12X. Help pls!

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Interrupt problem with card S12X. Help pls!

994 Views
glad86
Contributor I

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

Labels (1)
0 Kudos
2 Replies

385 Views
kef
Specialist I

           PITINTE = 0x07;    // Activation des interruptions de rebouclage pour les Timer 0, 1 et 2

 

It seems you enabled interrupts for 3 PIT channels. But I see only one PIT0_ISR defined.  Hope PIT1 and PIT2 ISRs are also defined.

Did you setup PIT0-PIT2 interrupt vectors?

0 Kudos

385 Views
glad86
Contributor I

Hi kef

I made some changes following your suggestions (PITCE = 0x01; // enable only the chanel 0 timer) 

I also add the address interrupt vector in the .prm file

VECTOR ADDRESS 0xFF7A PIT0_ISR

but i have still the problem.

when i debug, the caution ILLEGAL_BP always appears and i cannot jump into ISR

best rergards

 

0 Kudos