Hello,I am trying to build an input capture function into my controller. I have enabled the pin/timer as specified as below. Every edge, I jump into the timer ISR and increase the edge count. After one second, of monitoring a squarewave I read the edge count. It appears the edge count is always double what it should be. I have confirmed I am only triggering an ISR jump on the one edge specified. Does anyone else have suggestions of why my edge count would be double what I expect?
ENABLE PIN/TIMER: IC_Properties[DIN01].ICstatus = TRUE; IC_Properties[DIN01].ICEdgeCount = 0; IC_Properties[DIN01].TimerInterrupt = INT_TIMER5A; ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER5); ROM_GPIOPinTypeTimer(GPIO_PORTM_BASE, GPIO_PIN_2); ROM_GPIOPinConfigure(GPIO_PM2_T5CCP0); ROM_IntMasterEnable(); ROM_TimerLoadSet(TIMER5_BASE, TIMER_A, 1); ROM_TimerMatchSet(TIMER5_BASE, TIMER_A, 0); ROM_TimerControlEvent(TIMER5_BASE, TIMER_A, TIMER_EVENT_NEG_EDGE); if (IC_Properties[DIN02].ICstatus == FALSE) { ROM_TimerConfigure(TIMER5_BASE, (TIMER_CFG_SPLIT_PAIR | TIMER_CFG_A_CAP_COUNT)); IC_Properties[DIN01].TimerConfig = TIMER_A; } else { ROM_TimerConfigure(TIMER5_BASE, (TIMER_CFG_SPLIT_PAIR | TIMER_CFG_B_CAP_COUNT | TIMER_CFG_A_CAP_COUNT)); IC_Properties[DIN01].TimerConfig = TIMER_BOTH; } ROM_IntEnable(INT_TIMER5A); ROM_TimerIntEnable(TIMER5_BASE, IC_Properties[DIN01].TimerConfig); ROM_TimerEnable(TIMER5_BASE, TIMER_A); void Timer_5_subtimer_A_ISR(void) { ROM_IntDisable(IC_Properties[DIN01].TimerInterrupt); ROM_TimerIntClear(TIMER5_BASE, IC_Properties[DIN01].TimerConfig); IC_Properties[DIN01].ICEdgeCount += 1; ROM_TimerEnable(TIMER5_BASE, IC_Properties[DIN01].TimerConfig); ROM_IntEnable(IC_Properties[DIN01].TimerInterrupt); }
firmed I am only triggering an ISR jump on the one edge specified. Does anyone else have suggestions of why my edge count would be double what I expect?