Hi everybody,
I try to generate interrupt from the PIT, channel 0. I use INTC_InstallINTCInterruptHandler(compteurISR,59,1); where compteurISR is my subroutine and 59 is the IRQ number for PIT, channel0. The subroutine is never executed but why? I set the bit that enables interrupts from PIT, and when the counter has finished, the bit PIT.CH[0].TFLG.B.TIF is correctly set.
I also add the function enableIrq that sometimes causes a reset.
void enableIrq(void) {
INTC.CPR_PRC0.B.PRI = 0;/* Lower INTC PRC0's current priority */
asm(" wrteei 1"); /* and make sure external interrupts are enabled */
}
void Setup_Timer()
{
PIT.PITMCR.R &=0xFFFFFFFC; //periph actif
PIT.CH[0].LDVAL.B.TSV=0x005AF07F;//load value
PIT.TCTRL0.B.TIE=1;//enable interrupt
}
int main(void) {
volatile int i = 0;
int debut=1;
InitHW();
Setup_Timer();
INTC_InstallINTCInterruptHandler(compteurISR,59,1);
enableIrq();
PIT.TCTRL0.B.TEN=1;
for (; {
i++;
}
}
void compteurISR(void)
{
//INTC.SSCIR[4].R = 2;
SIU.GPDO52.B.PDO=~SIU.GPDO52.B.PDO;
PIT.CH[0].TFLG.B.TIF=1;
}
解決済! 解決策の投稿を見る。
It is a bug coming from Code Warrior v2.7. it lacks the initialization of IVOR_TABLE in interrupts_p0.c
It is a bug coming from Code Warrior v2.7. it lacks the initialization of IVOR_TABLE in interrupts_p0.c