AnsweredAssumed Answered

wdth_cap timer mode problem  adsp21364

Question asked by brenneke on Apr 3, 2012
Latest reply on Apr 5, 2012 by Harshit.Gaharwar

Hello! I need to measure 300-500 ns continuous pulses with 1-20 us periods.

N-1 Pulse width and period may be different with N pulse width and period.

So as I understand I should use width capturing mode. My code is:

 

void timer_interrupt(int sig_int)

 

{

   period = * (volatile int *) TM1PRD;

    width  = * (volatile int *) TM1W;

 

PERIODS[TIMES_pntr] = period;

WIDTHS [TIMES_pntr] = width;

 

TIMES_pntr++;

TIMES_pntr = TIMES_pntr % PULSE_NUMBER;

 

    NOP();

    NOP();

    NOP();

 

}

 

 

 

main () {

 

interrupt(SIG_GPTMR1,timer_interrupt);

 

*(volatile int *) TM1CTL = TIMODEW|

PULSE|

IRQEN|

PRDCNT;

    NOP();

    NOP();

    * (volatile int *) TMSTAT = TIM1EN;            /* enable timer 1 */

 

}

 

 

I generate test pulses by using core timer and FLAG1 pin then route this signal to timer1 DAI pin externally. All I have is the first value of the first pulse period in  all cells of PERIODS[] and width in all cells of WIDTHS[]. I use EZ-kit evaluation board.

 

I need an advice! Thank you.  Source code attached.

Attachments

Outcomes