I'm using LM4F120H5QR launchpad. I'm using three timers in following configurations
SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER2); SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER1); SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0); TimerConfigure(TIMER2_BASE,TIMER_CFG_32_BIT_PER); int cycle=4*16000000; TimerLoadSet(TIMER2_BASE,TIMER_A,cycle); TimerIntClear(TIMER2_BASE, TIMER_TIMA_TIMEOUT); TimerConfigure(TIMER1_BASE, (TIMER_CFG_16_BIT_PAIR+TIMER_CFG_A_PERIODIC)); TimerLoadSet(TIMER1_BASE,TIMER_A,0x0640); TimerIntClear(TIMER1_BASE, TIMER_TIMA_TIMEOUT); TimerConfigure(TIMER0_BASE,TIMER_CFG_32_BIT_PER); TimerLoadSet(TIMER0_BASE,TIMER_A,0xA2C2A); TimerIntClear(TIMER0_BASE, TIMER_TIMA_TIMEOUT); IntMasterEnable(); // TimerIntEnable(TIMER0_BASE,TIMER_TIMA_TIMEOUT); TimerIntEnable(TIMER2_BASE,TIMER_TIMA_TIMEOUT); TimerIntEnable(TIMER1_BASE,TIMER_TIMA_TIMEOUT); // IntEnable(INT_TIMER0A); IntEnable(INT_TIMER1A); IntEnable(INT_TIMER2A); // TimerEnable(TIMER0_BASE,TIMER_A); TimerEnable(TIMER2_BASE,TIMER_A); TimerEnable(TIMER1_BASE,TIMER_A);
TimerIntEnable(TIMER0_BASE,TIMER_TIMA_TIMEOUT);
TimerIntEnable(TIMER2_BASE,TIMER_TIMA_TIMEOUT);
TimerIntEnable(TIMER1_BASE,TIMER_TIMA_TIMEOUT);
// IntEnable(INT_TIMER0A);
IntEnable(INT_TIMER1A);
IntEnable(INT_TIMER2A);
// TimerEnable(TIMER0_BASE,TIMER_A);
TimerEnable(TIMER2_BASE,TIMER_A);
TimerEnable(TIMER1_BASE,TIMER_A);
However when the control reaches the ISR of Timer1A, control moves to the Fault ISR after executing TimerIntClear instruction.
The ISRs are as follows
void TIMER1AIntHandler() // 100 uS to update coordinates { TimerIntDisable(TIMER1_BASE,TIMER_TIMA_TIMEOUT); TimerIntClear(TIMER1_BASE, TIMER_TIMA_TIMEOUT); int i; rtc_time+=0.0001; checkball(rtc_time); for(i=0;i<size_b;i++) { if(bl[i].in==1) bl[i].cur_time+=0.0001; } update(); TimerIntEnable(TIMER1_BASE,TIMER_TIMA_TIMEOUT); } void Timer0AIntHandler() // 42 ms to refresh GUI {/* TimerIntDisable(TIMER0_BASE,TIMER_TIMA_TIMEOUT); TimerIntClear(TIMER0_BASE, TIMER_TIMA_TIMEOUT); UARTCharPut(UART0_BASE,x); TimerIntEnable(TIMER0_BASE,TIMER_TIMA_TIMEOUT); */ } void TIMER2AIntHandler() // 4 s or according to per_app { TimerIntDisable(TIMER2_BASE,TIMER_TIMA_TIMEOUT); TimerIntClear(TIMER2_BASE, TIMER_TIMA_TIMEOUT); bl[count].in=1; bl[count].first=1; bl[count].cur_time=0; count++; TimerIntEnable(TIMER2_BASE,TIMER_TIMA_TIMEOUT); }
Can someone tell me why is the fault occurring?