Other Parts Discussed in Thread: EK-TM4C1294XL
Hi, Mr Expert
I configure the General Purpose Timer 1 to work in Input Edge-Time mode to capture rising edge on T1CPP0 assigned to pin PD2, but when the low level pulse is applied to the PD2 pin, the relevant interrupt is not triggered.
Below are the code for Timer1 initializing and GPIO pin PD2 configuration.
......
#define AFSEL_T1CCP0 4
#define PMC2_T1CCP0 0x30
#define DEN_T1CCP0 4
#define ODR_T1CCP0 4
......
//Initialize Timer1_A to Input Edge-Time Mode
HWREG(GPIO_PORTD_BASE + GPIO_O_AFSEL) |= AFSEL_T1CCP0;
HWREG(GPIO_PORTD_BASE + GPIO_O_PCTL) |= PMC2_T1CCP0; //set PD0 to T0CCP0 function, use PWM function as DQ output
HWREG(GPIO_PORTD_BASE + GPIO_O_DEN) |= DEN_T1CCP0;
HWREG(SYSCTL_RCGCTIMER) |= SYSCTL_RCGCTIMER_R1;
HWREG(TIMER1_BASE + TIMER_O_CTL) &= ~TIMER_CTL_TAEN;
HWREG(TIMER1_BASE + TIMER_O_CFG) = TIMER_CFG_16_BIT;
HWREG(TIMER1_BASE + TIMER_O_TAMR) = TIMER_TAMR_TACMR | TIMER_TAMR_TAMR_CAP | TIMER_TAMR_TACDIR; //Timer counts up from 0
HWREG(TIMER1_BASE + TIMER_O_CTL) |= TIMER_CTL_TAEVENT_BOTH;
HWREG(TIMER1_BASE + TIMER_O_TAPR) = 0xFF;
HWREG(TIMER1_BASE + TIMER_O_TAILR) = 0xFFFF;
bBitPatternRecognized = false;
ui32BitLength = 0;
HWREG(TIMER1_BASE + TIMER_O_IMR) = TIMER_IMR_CAEIM;
TimerIntRegister(TIMER1_BASE, TIMER_A, Timer1IntHandler);
......
After I set the TAEN bit, and pull down the voltage on PD2 and then release voltage on PD2 to high.
HWREG(TIMER1_BASE + TIMER_O_CTL) |= TIMER_CTL_TAEN;
The interrupt has not triggered as expected. Could you help to check if I missed something on the pin configuration?
bBitPatternRecognized = false;
ui32BitLength = 0;
HWREG(TIMER1_BASE + TIMER_O_IMR) = TIMER_IMR_CAEIM;
TimerIntRegister(TIMER1_BASE, TIMER_A, Timer1IntHandler);
EV2500_TM4C_003