Hi,
I am trying capture signal duration on gpio pin using cp module
So here is my init code for timer
void CCPEnable(void){
MAP_PinConfigSet(PIN_05,PIN_TYPE_STD_PU,PIN_STRENGTH_6MA); // Enable pull up
MAP_TimerIntRegister(TIMERA2_BASE,TIMER_A,TimerIntHandler); // Register timer interrupt hander
MAP_TimerPrescaleSet(TIMERA2_BASE,TIMER_A,0xff); // Setting Prescaler to 255
MAP_TimerConfigure(TIMERA2_BASE, (TIMER_CFG_SPLIT_PAIR | TIMER_CFG_A_CAP_TIME_UP)); // Configure the timer in edge count mode
MAP_TimerControlEvent(TIMERA2_BASE,TIMER_A,TIMER_EVENT_BOTH_EDGES); // Set the detection edge
MAP_TimerLoadSet(TIMERA2_BASE,TIMER_A,0x0); // Set the reload value
TimerValueSet(TIMERA2_BASE,TIMER_A,0x0);
MAP_TimerIntEnable(TIMERA2_BASE,TIMER_CAPA_EVENT); // Enable capture event interrupt
MAP_TimerEnable(TIMERA2_BASE,TIMER_A); // Enable Timer
}
AND interrupt handler for this is here
static void TimerIntHandler()
{
capturedValues[CCPindex] = MAP_TimerValueGet(TIMERA2_BASE,TIMER_A);
CCPindex++;
}
here are some samples stored in capturedValues
16605223 16642853 32442 71683
1)Timer is running in 24 bit mode(0x000000-0xFFFFFF) HOW can i change it to 32 bit????
2)When timer overflows i am getting wrong values
means my signal is 425us which gave me two capture samples as 16642853 32442 which equals to (0xFFFFFF-16642853 + 32442)/80 = 2085
This behavior is happening only at overflow condition.
Except at overflow all the values are accurate.
WHY is this issue occurring???