AnsweredAssumed Answered

BF609 Timer EXTCLK mode can't use SCLK?

Question asked by ltruong on Mar 2, 2013
Latest reply on Mar 5, 2013 by Prashant

The BF609 Hardware reference pdf (TABLE 15-5) states that EXTCLK can count clock ticks from SCLK or from an externally applied waveform, however figure 15-9 does not reference SCLK anywhere... the CLKSEL[9:8] bits of the cfg register has SCLK, but the timer cnt register does not increment at runtime....

 

Am I missing something here?  the same main() function fires off the interrupt properly when the code below is setup as continuous pwm (which seems like my 2nd choice of mode if EXTCLK isn't working as I planned)

 

My timer initialization code is as follows:

 

    adi_tmr_Open(1, timerMemory, ADI_TMR_MEMORY, timerHandler, NULL, &timerHandle);

    adi_tmr_SetMode(timerHandle, ADI_TMR_MODE_EXTCLK);

    adi_tmr_SetPulsePolarity(timerHandle, true);

    adi_tmr_SetIRQMode(timerHandle, ADI_TMR_IRQMODE_PERIOD);

    adi_tmr_SetPeriod(timerHandle, 125000000);

    adi_tmr_SetInputSource(timerHandle, ADI_TMR_CLKIN_SYSCLK);

    adi_tmr_Enable(timerHandle, true);

 

The code above SHOULD jump to the IRQ handler every second... but the TIMER1_CNT register does not even increment.

 

The register values after the timer is enable are:

 

TIMER0_TMR1_CFG.EMURUN0Run Timer (Counter) During Emulation
TIMER0_TMR1_CFG.BPEREN0Broadcast Period Enable
TIMER0_TMR1_CFG.BWIDEN0Broadcast Width Enable
TIMER0_TMR1_CFG.BDLYEN0Broadcast Delay Enable
TIMER0_TMR1_CFG.OUTDIS0Output Disable
TIMER0_TMR1_CFG.TINSEL0Timer Input Select (for WIDCAP, WATCHDOG, PININT modes)
TIMER0_TMR1_CFG.CLKSEL0Clock Select
TIMER0_TMR1_CFG.PULSEHI1Polarity Response Select
TIMER0_TMR1_CFG.SLAVETRIG0Slave Trigger Response
TIMER0_TMR1_CFG.IRQMODE3Interrupt Modes
TIMER0_TMR1_CFG.TMODEETimer Mode Select

 

TIMER0_RUN.TMR011Start/Stop Timer n

 

TIMER0_TMR1_PER07735940TIMER0 Timer n Period Register

 

TIMER0_TMR1_WID00000000TIMER0 Timer n Width Register

(from table 15-6, WID and DLY registers are not used in EXTCLK mode so these are not initialized to anything.

 

TIMER0_TMR1_DLY00000000TIMER0 Timer n Delay Register

 

TIMER0_TMR1_CNT00000000TIMER0 Timer n Counter Register

<--------- this register never increments!





Outcomes