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.

[TMS320f2812] Event Manager : Timer1 doesn't work

Hello everyone. I am beginner at programming. I want to start Timer 1 in Event Manager. I have this kind of code :

 

//[INICJALIZACJA ZEGARA : 150 mHz , x1 , Timer Compare na PRD i 0 , UP]
        EvaRegs.T1CNT = 0x0000 ;                //Zeruj licznik

        //==Rejestr kontrolny Timera 1==
        EvaRegs.T1CON.bit.TECMPR = 1;            //Timer 1 Compare : włączony
        EvaRegs.T1CON.bit.TCLD10 = 1;            //Rejestr Timer Compare załadowane przy 0, lub PRD
        EvaRegs.T1CON.bit.TCLKS10 = 0;            //Zegar : HSPCLK - 150 MHz , 6.67 ns
        EvaRegs.T1CON.bit.TENABLE = 1;            //Zegar włączony
        EvaRegs.T1CON.bit.TPS = 0;                //x1
        EvaRegs.T1CON.bit.TMODE = 2;            //Up-Count
        EvaRegs.T1CON.bit.FREE = 1;                //Set : Przy breakpointach leci dalej
        EvaRegs.T1CON.bit.SOFT = 1;                //0   : Stop przy breakpoincie , 1 : Stop przy breakpoincie, po zrobieniu okresu

        //==Rejestr kontrolny Timerów==
        EvaRegs.GPTCONA.all = 0x0000;

        //==Okres Timera 1==
        EvaRegs.T1PR = 0x00F0 ;                    //Ustaw okres

        //==Komparator Timera 1==
        EvaRegs.T1CMPR = 0x0000 ;                //Timer Compare


        EALLOW;

         GpioMuxRegs.GPAMUX.bit.T1PWM_GPIOA6 = 1;
        EDIS;

And when I am using watchdog, the T1CNT register is always on 0. Why ?

Thanks for help

Norbert

  • First, is the Event Manager A peripheral unit clocked?  If so, where does the clock come from?  HISPCLK?  How is the clock prescaled?

    Somewhere in your project, there should be a function which initializes the clocks for peripheral devices.  For 281x devices, it is in "DSP281x_SysCtrl.c" and called
    void InitPeripheralClocks(void) .  In there, you should have a line similar to this:

       SysCtrlRegs.PCLKCR.bit.EVAENCLK=1;

    If the line is absent or set equal to zero, the EVA unit is not clocked and Timer T1 will never increment.

    Hope this helps,

    Adam