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.

About the TMS320f28335 timer

Hello

I am using (ConfigCpuTimer(&CpuTimer0,150,100);)  and as you can see that the period for the timer overflow is set to be (100 micro second)!

My question is what is the limit for minimum period, and what is the method to do a very low period so i can have high precision with the counter!

Regards

Ameer 

  • Hi Ameer,

    Ameer Janabi said:
    My question is what is the limit for minimum period, and what is the method to do a very low period so i can have high precision with the counter!

    The above routine can achieve as low as 1us.

    Here's the routine you can further analyze:

    void ConfigCpuTimer(struct CPUTIMER_VARS *Timer, float Freq, float Period)
    {
        Uint32     PeriodInClocks;
    
        // Initialize timer period:
        Timer->CPUFreqInMHz = Freq;
        Timer->PeriodInUSec = Period;
        PeriodInClocks = (long) (Freq * Period);
        Timer->RegsAddr->PRD.all = PeriodInClocks - 1;
    
        // Set pre-scale counter to divide by 1 (SYSCLKOUT):
        Timer->RegsAddr->TPR.all  = 0;
        Timer->RegsAddr->TPRH.all  = 0;
    
        // Initialize timer control register:
        Timer->RegsAddr->TCR.bit.TSS = 1;      // 1 = Stop timer, 0 = Start/Restart Timer
        Timer->RegsAddr->TCR.bit.TRB = 1;      // 1 = reload timer
        Timer->RegsAddr->TCR.bit.SOFT = 0;
        Timer->RegsAddr->TCR.bit.FREE = 0;     // Timer Free Run Disabled
        Timer->RegsAddr->TCR.bit.TIE = 1;      // 0 = Disable/ 1 = Enable Timer Interrupt
    
        // Reset interrupt counter:
        Timer->InterruptCount = 0;
    }

    Regards,

    Gautam