i wanted to calculate number of pulses in 2seconds but when ever i press PF4 code does not go in to interrupt handler event.I am new to tiva C programming.
Above picture shows debugging mode, bit IME is set before PF4 is pressed but once pressed RIS AND MIS shows 0x01 permanently as shown in figure.
when i close debugger pointer is placed next to fault ISR for few seconds.I think it might have been permanently struck in fault isr routine.
HOW can i resolve this issue? i am having no clue?I also have tried changing vector interrupt table but to no avail.
following is the code:
unsigned long currentClockCapture = 0;
unsigned long currentClockCapture1 = 0; // value at negative edge
unsigned long lastClockCapture = 0;
unsigned long time=0;// value at last negative edge
unsigned long currentClockCapture2=0;
//////////////////////////////////////////////////////////////////
int pulses=0;
//portf1 interrupt handler
void PortF1IntHandler(void){
GPIOIntClear(GPIO_PORTD_BASE, GPIO_PIN_4);
GPIOPinWrite(GPIO_PORTF_BASE,GPIO_PIN_2,4);
//SysCtlDelay(3000000);
pulses+=1;
}
int main(void)
{
SysCtlClockSet(SYSCTL_SYSDIV_2_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);
//enable and configure peripheral
SysCtlDelay(3);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
SysCtlDelay(3);
GPIOPinTypeGPIOInput(GPIO_PORTF_BASE, GPIO_PIN_4);
GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_2);
GPIOPadConfigSet(GPIO_PORTF_BASE,GPIO_PIN_4,GPIO_STRENGTH_2MA,GPIO_PIN_TYPE_STD_WPU);
GPIOIntTypeSet(GPIO_PORTF_BASE, GPIO_PIN_4,GPIO_FALLING_EDGE);
GPIOIntRegister(GPIO_PORTF_BASE,PortF1IntHandler);
GPIOIntEnable(GPIO_PORTF_BASE, GPIO_PIN_4);
GPIOIntClear(GPIO_PORTF_BASE, GPIO_PIN_4);
IntMasterEnable();
// IntEnable(INT_GPIOF);//i have commented and uncommented it but no effect still
//EnableInterrupts();//i have commented and uncommented it but no effect still
//SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0);
// SysCtlDelay(3);
//
// Period = SysCtlClockGet()/0.5; //100Khz
//ROM_TimerConfigure(TIMER0_BASE,TIMER_CFG_PERIODIC_UP);// timer0A configured 16 bit time capture
//ROM_TimerLoadSet(TIMER0_BASE, TIMER_BOTH,Period-1);
//ROM_TimerMatchSet(TIMER0_BASE, TIMER_A, 0xFFFFFFFE);
//ROM_TimerPrescaleSet(TIMER0_BASE, TIMER_A, 0xFFFF);
//ROM_TimerPrescaleMatchSet(TIMER0_BASE, TIMER_A, 0x01);
//IntEnable(INT_TIMER0A);
//TimerIntEnable(TIMER0_BASE, TIMER_TIMA_TIMEOUT);
//IntMasterEnable();
//TimerEnable(TIMER0_BASE, TIMER_A);
while(1)
{
// //GPIOPinWrite(GPIO_PORTF_BASE,GPIO_PIN_2,4);
//currentClockCapture1=ROM_TimerValueGet(TIMER0_BASE, TIMER_A) ;
//currentClockCapture2=TimerLoadGet(TIMER0_BASE,TIMER_A);
//GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, i);
}
}
void Timer0IntHandler(void)
{
TimerIntClear(TIMER0_BASE,TIMER_TIMA_TIMEOUT);
if(i==0){
i=4;
}else{
i=0;
}
pulses=0;
}