AnsweredAssumed Answered

how to realize BF609 width capture based on CCES1.0.2.0?

Question asked by wxlwwxlw on Feb 27, 2015
Latest reply on Apr 27, 2015 by wxlwwxlw

Hi engineer,

     I used the BF609 TM0_TMR3 pin to receive the square wave which is created by  AC singal with realtime frequency variation. I want to use the "TIMER Width Capture(WIDCAP) Mode" to caculate the realtime frequency about the singal.

     Certainly, I use the CCES1.0.2.0 to write programs running on Core1 and the another Core0 running the Linux OS.


The following is my part code written by CCES:

add the following code to pinmux_config.c file:

/* PORTx_MUX registers */


    /* PORTx_FER registers */


add the following code to main function:

uint8_t TimerMemory[ADI_TMR_MEMORY];

static void TimerHandler(void *pCBParam, uint32_t Event, void *pArg);

static ADI_TMR_HANDLE ghTimer;

static volatile bool gbTimerInt = false;

static void TimerHandler(void *pCBParam, uint32_t Event, void *pArg)



   adi_tmr_Enable(ghTimer, false);

   gbTimerInt = true;



void main(int argc, char *argv[])

{   ......


adi_tmr_SetMode(ghTimer, ADI_TMR_MODE_CAPTURE_DEASSERT);

eTmrResult |= adi_tmr_EnableGracefulStop(ghTimer, true);

eTmrResult |= adi_tmr_SetPulsePolarity(ghTimer, true);

eTmrResult |= adi_tmr_SetClkInSource(ghTimer, ADI_TMR_CLKIN_ALTCLK0);





  while(gbTimerInt== true);   

             gbTimerInt = false;






I can not get value from freqcount by "adi_tmr_GetPeriod(ghTimer,&freqcount);"

Hope to hear your guidance ASAP!

Happy New Year!

Thanks & Best Regards!