Hi,
I'm trying to use the input edge count mode timer with a TM4C1294NCPDT on a launchpad kit (EK-TM4C1294XL).
I'm using the PM2 as the input for the clock signal and PK2 as a input for edge interrupt.
I just want to count 1 full clock cycle, not both edges.
The configuration code is below
// CCP on PM2 GPIOPinTypeGPIOInput(GPIO_PORTM_BASE, GPIO_PIN_2); GPIOPinConfigure(GPIO_PM2_T3CCP0); GPIOPinTypeTimer(GPIO_PORTM_BASE,GPIO_PIN_2); // T3CCP TimerDisable(TIMER3_BASE,TIMER_A); TimerConfigure(TIMER3_BASE,TIMER_CFG_A_PERIODIC_UP); TimerControlEvent(TIMER3_BASE,TIMER_A,TIMER_EVENT_POS_EDGE); TimerLoadSet(TIMER3_BASE, TIMER_A, 0); TimerMatchSet(TIMER3_BASE, TIMER_A, 24); IntRegister(INT_TIMER3A,pinCCP_interrupt); TimerEnable(TIMER3_BASE,TIMER_A);
My pinCCP_interrupt
void pinCCP_interrupt(void){ GPIOIntClear(GPIO_PORTM_BASE, GPIO_PIN_2); TimerDisable(TIMER3_BASE,TIMER_A); GPIOIntEnable(GPIO_PORTK_BASE, GPIO_PIN_2); cont_clock=0; }
And the edge interrupt, working fine:
void clk_lvds(void) { GPIOIntClear(GPIO_PORTK_BASE, GPIO_PIN_2); cont_clock++; if(cont4<FRAME_SIZE) { if(cont_clock<13) { //..some task } else { TimerEnable(TIMER3_BASE,TIMER_A); GPIOIntDisable(GPIO_PORTK_BASE,GPIO_PIN2); } if(cont_clock==36) cont_clock=0; } }
After a number of 24 clocks, i want to stop counting and activate an interrupt on 2 other pins, which afterwards will activate the counter again, but pinCCP_interrupt is never called.
Also, i also have a question: how fast an interrupt can be enabled and disabled? I have a clock signal with 1Mhz frequency, but every 12 clocks i'm using an edge interrupt for a specific task, working and tested fine, and the other 24 clocks i just want to skip. My actual code just counts every time i enter the edge interrupt and exits if the clock is between 13 and 36, but i want to optimize using the input edge counter. Is this possible?
Also, is there any example using such timer mode? I already checked those links but i couldnt figure out what's wrong.
https://e2e.ti.com/support/microcontrollers/tiva_arm/f/908/t/210016