This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC26XX GP Timers.

I am using a pair of general purpose timers to capture the rising and falling edge of an input signal.  The technical reference seems to indicate that when the timers are configured in edge capture mode, the upper 24 bits of the timer can be retrieved from the prescaler register.  However, I never see this value change (it always reads zero).  I would have expected it to increment when the timer rolls over from 0xFFFF to 0x0000.   

Here's my setup:

HWREG(IOC_BASE + IOC_O_IOCFG2) |= (IOC_IOCFG2_EDGE_DET_POS | IOC_IOCFG2_PORT_ID_PORT_EVENT0);
HWREG(IOC_BASE + IOC_O_IOCFG26) |= (IOC_IOCFG26_EDGE_DET_NEG | IOC_IOCFG26_PORT_ID_PORT_EVENT1);

// Set the pins to trigger PORT_EVENT0 and PORT_EVENT1 respectively

// NOTE FROM TI: IOC_PORT_MCU_TIMER0 is equivalent to PORT_EVENT0
PINCC26XX_setMux(hPinHandle, Board_VXBOOST_CMP, IOC_PORT_MCU_TIMER0);
PINCC26XX_setMux(hPinHandle, Board_VXBOOST_CMP2, IOC_PORT_MCU_TIMER1);

// Set EVENT0 and EVENT1 to trigger the edge capture of the GP timers.
HWREG(EVENT_BASE + EVENT_O_GPT0ACAPTSEL) = EVENT_GPT0ACAPTSEL_EV_PORT_EVENT0;
HWREG(EVENT_BASE + EVENT_O_GPT0BCAPTSEL) = EVENT_GPT0BCAPTSEL_EV_PORT_EVENT1;

// Enable GPT0

HWREG(PRCM_BASE + PRCM_O_GPTCLKGR) |= PRCM_GPTCLKGR_CLK_EN_GPT0;
PRCMLoadSet();

TimerConfigure(GPT0_BASE, TIMER_CFG_SPLIT_PAIR | TIMER_CFG_A_CAP_TIME_UP | TIMER_CFG_B_CAP_TIME_UP);

// Sets timer A to save value on rising edge.
TimerEventControl(GPT0_BASE, TIMER_A, TIMER_EVENT_POS_EDGE);

// Sets timer B to store value on falling edge.
TimerEventControl(GPT0_BASE, TIMER_B, TIMER_EVENT_NEG_EDGE);

// Enable both timers

TimerEnable(GPT0_BASE, TIMER_BOTH);

TimerIntRegister(GPT0_BASE, TIMER_A, processRisingEdge);

TimerIntRegister(GPT0_BASE, TIMER_B, processFallingEdge);

----

When the interrupt triggers, I use the following to read the positive edge capture:

lastRising = HWREG(GPT0_BASE + GPT_O_TAPV) << 16;
lastRising += (HWREG(GPT0_BASE + GPT_O_TAR) & 0x0000FFFF);

And similarly for the falling:

lastFalling = HWREG(GPT0_BASE + GPT_O_TBPV) << 16;
lastFalling += (HWREG(GPT0_BASE + GPT_O_TBR) & 0x0000FFFF);

There seems to be a number of register that map in some way to the prescaler register (TxPV, TxPS, TxPR), but these don't have much documentation behind them.  I've tried them all, but none seem to ever change.

Any ideas what I may be doing wrong?

  • Hi Todd,

    We are looking into this.

    Cheers,
    Fredrik
  • Hi Todd,

    Please try the following:
    Instead of reading out the actual counter value, the value stored on compare should be in TAMATCHR [0:15] and TAPMR [16:23].

    Cheers,
    Fredrik
  • ???

    That did not work.  TAMATCHR always contains 0xFFFF and TAPMR always conatins 0x00.  

    According to your own documentation, those registers contain a target value that triggers an interrupt when a timer hits that value, not a time value stored upon an edge trigger.

    Please reread my original question and try again.  I simply want to grab the 24-bit value of the timer when the edge was detected.  Lower 16 bits show up properly in TAR, but the upper 8 bits in TAPV always read zero.  I've also tried finding upper 8 bits in TAPS or TAPR, but these also read zero.