Part Number: TM4C1294NCPDT
Other Parts Discussed in Thread: SYSBIOS
Hello, I am using TM4C1294XL board for my work.As I want capture positive edge using Timer1A and Timer1B whereas I want to get the value of input signal at every positive cycle . I have created a small program but timer interrupt event is not working.
Here is my Code,
void Timer1AIsr(void)
{
ROM_TimerIntClear(TIMER1_BASE, TIMER_CAPA_EVENT); // Clear the timer interrupt
}
void Timer1BIsr(void)
{
ROM_TimerIntClear(TIMER1_BASE, TIMER_CAPB_EVENT); // Clear the timer interrupt
}
void Config_Timer(void)
{
// ENABLE TIMER PERIPHERAL
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER3);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER1);
GPIOPinTypeGPIOOutput(GPIO_PORTN_BASE, GPIO_PIN_0);
GPIOPinTypeGPIOOutput(GPIO_PORTD_BASE, GPIO_PIN_0);
GPIOPinConfigure(GPIO_PD2_T1CCP0);
GPIOPinTypeTimer(GPIO_PORTD_BASE, (GPIO_PIN_2 | GPIO_PIN_3));// enable the GPIO pins for timer
// Configure
ROM_TimerConfigure(TIMER3_BASE, TIMER_CFG_PERIODIC);
ROM_TimerLoadSet(TIMER3_BASE, TIMER_A, (ui32SysClock / 2)); // Divide by 20 for 50mSec Delay
ROM_TimerConfigure(TIMER1_BASE, (TIMER_CFG_A_CAP_TIME)); // timer1A configured 16 bit time capture
ROM_TimerConfigure(TIMER1_BASE, (TIMER_CFG_A_CAP_TIME)); // timer1B configured 16 bit time capture
ROM_TimerControlEvent(TIMER1_BASE, TIMER_A, TIMER_EVENT_POS_EDGE);
ROM_TimerControlEvent(TIMER1_BASE, TIMER_B, TIMER_EVENT_POS_EDGE);
ROM_TimerLoadSet(TIMER1_BASE, TIMER_A,0);
ROM_TimerLoadSet(TIMER1_BASE, TIMER_B,0);
// IntRegister(INT_TIMER1A, edge_capture);
TimerIntRegister(TIMER3_BASE, TIMER_A, Timer3Isr); // Registering ISR
TimerIntRegister(TIMER1_BASE, TIMER_A, Timer1AIsr); // Registering ISR
TimerIntRegister(TIMER1_BASE, TIMER_B, Timer1BIsr); // Registering ISR
//
// Setup the interrupts for the timer timeouts.
//
TimerIntClear(TIMER3_BASE, TIMER_TIMA_TIMEOUT); // Clear the timer interrupt
IntEnable(INT_TIMER3A);
TimerIntEnable(TIMER3_BASE, TIMER_TIMA_TIMEOUT);
TimerIntClear(TIMER1_BASE, TIMER_CAPA_EVENT); // Clear the timer interrupt
IntEnable(INT_TIMER1A);
TimerIntEnable(TIMER1_BASE, TIMER_CAPA_EVENT);
TimerIntClear(TIMER1_BASE, TIMER_CAPB_EVENT); // Clear the timer interrupt
IntEnable(INT_TIMER1B);
TimerIntEnable(TIMER1_BASE, TIMER_CAPB_EVENT);
//
// Enable the timers.
//
TimerEnable(TIMER3_BASE, TIMER_A);
TimerEnable(TIMER1_BASE, TIMER_A);
TimerEnable(TIMER1_BASE, TIMER_B);
}
PS- Ignore Timer3 part from my code as it is for other function.
Thank You.
