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.

TMS320F28375S: Timer Frequency Divide by two

Part Number: TMS320F28375S
Other Parts Discussed in Thread: C2000WARE

Hi,

    Using TMS320F28375S , timer frequency is get divide by TWO. Bellow my timer configurations are

void IntCPUTimer(void)
{



    Interrupt_register(INT_TIMER0, &cpuTimer0ISR);
    Interrupt_register(INT_TIMER1, &cpuTimer1ISR);

        //
        // Initializes the Device Peripheral. For this example, only initialize the
        // Cpu Timers.
        //
        initCPUTimers();

        //
        // Configure CPU-Timer 0, 1, and 2 to interrupt every second:
        // 1 second Period (in uSeconds)
        //
        configCPUTimer(CPUTIMER0_BASE, DEVICE_SYSCLK_FREQ,  1000000);
        configCPUTimer1(CPUTIMER1_BASE, DEVICE_SYSCLK_FREQ, 1000000);
        //
        // To ensure precise timing, use write-only instructions to write to the
        // entire register. Therefore, if any of the configuration bits are changed
        // in configCPUTimer and initCPUTimers, the below settings must also
        // be updated.
        //
        CPUTimer_enableInterrupt(CPUTIMER0_BASE);
        CPUTimer_enableInterrupt(CPUTIMER1_BASE);
        //
        // Enables CPU int1, int13, and int14 which are connected to CPU-Timer 0,
        // CPU-Timer 1, and CPU-Timer 2 respectively.
        // Enable TINT0 in the PIE: Group 1 interrupt 7
        //
        Interrupt_enable(INT_TIMER0);
         Interrupt_enable(INT_TIMER1);
        //
        // Starts CPU-Timer 0, CPU-Timer 1, and CPU-Timer 2.
        //
        CPUTimer_startTimer(CPUTIMER0_BASE);
        CPUTimer_startTimer(CPUTIMER1_BASE);

    }


//
// initCPUTimers - This function initializes all three CPU timers
// to a known state.
//
void initCPUTimers(void)
{
    //
    // Initialize timer period to maximum
    //
    CPUTimer_setPeriod(CPUTIMER0_BASE, 0xFFFFFFFF);
    CPUTimer_setPeriod(CPUTIMER1_BASE, 0xFFFFFFFF);
    //
    // Initialize pre-scale counter to divide by 1 (SYSCLKOUT)
    //
    CPUTimer_setPreScaler(CPUTIMER0_BASE, 0);
    CPUTimer_setPreScaler(CPUTIMER1_BASE, 0);
    //
    // Make sure timer is stopped
    //
    CPUTimer_stopTimer(CPUTIMER0_BASE);
    CPUTimer_stopTimer(CPUTIMER1_BASE);
    //
    // Reload all counter register with period value
    //
    CPUTimer_reloadTimerCounter(CPUTIMER0_BASE);
    CPUTimer_reloadTimerCounter(CPUTIMER1_BASE);
    //
    // Reset interrupt counter
    //



}

void configCPUTimer(uint32_t cpuTimer, float freq, float period)
{
        CPUTimer_setPeriod(cpuTimer, 20);   // For 1ms sec set value as 2000

         //
         // Set pre-scale counter to divide by 1 (SYSCLKOUT):
         //
         CPUTimer_setPreScaler(cpuTimer, 9999);

         //
         // Initializes timer control register. The timer is stopped, reloaded,
         // free run disabled, and interrupt enabled.
         // Additionally, the free and soft bits are set
         //
         CPUTimer_stopTimer(cpuTimer);
         CPUTimer_reloadTimerCounter(cpuTimer);
         CPUTimer_setEmulationMode(cpuTimer,
                                   CPUTIMER_EMULATIONMODE_STOPAFTERNEXTDECREMENT);
         CPUTimer_enableInterrupt(cpuTimer);
}

Device Frequency set  as

Thanks & Regards,

Rani

  • Hi Rani,

    Are you using a custom board or a controlCARD? Just want to verify that you are using a 20MHz XTAL.

    You can change the period of the timer when you call the configCPUTimer() function by passing in a different value versus changing the code within the function. If you run the timer_ex1_cputimers project (C:\ti\c2000\C2000Ware_version\driverlib\f2837xd\examples\cpu1\timer) without modifying it do you get the correct results?

    Best Regards,

    Marlyn

  • Hi,,

    Yes Custom Board...

    Just want to verify that you are using a 20MHz XTAL.

    Yes.. 20mhz XTal..

    You can change the period of the timer when you call the configCPUTimer() function by passing in a different value versus changing the code within the function. If you run the timer_ex1_cputimers project (C:\ti\c2000\C2000Ware_version\driverlib\f2837xd\examples\cpu1\timer) without modifying it do you get the correct results?

    We come back to you after taking trial.
    thanks for your guidance ,,until l i make resolved..

    Rgds

    Rani