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.

How to set timer0 TOUT high/low with DM642?

Dear Sir,

I write the following code and try to make timer0 TOUT high/low, but it doesn't work.

      hTimer0 = TIMER_open(TIMER_DEV0, TIMER_OPEN_RESET);

      TIMER_configArgs(hTimer0,
                      TIMER_CTL_RMK(TIMER_CTL_SPND_DEFAULT,
                                  TIMER_CTL_INVINP_NO,
                                TIMER_CTL_CLKSRC_CPUOVR8,
                                TIMER_CTL_CP_CLOCK,
                                TIMER_CTL_HLD_NO,
                                TIMER_CTL_GO_NO,
                                TIMER_CTL_PWID_ONE,
                                TIMER_CTL_DATOUT_1,
                                TIMER_CTL_INVOUT_NO,
                                TIMER_CTL_FUNC_TOUT),
                    TIMER_PRD_OF(TIMER_PER_REG),
                    TIMER_CNT_OF(0));

      TIMER_start(hTimer0);    // Enable the timer

Should I program other register to set the pin as TOUT0?

I see some info about TOUT0/MAC_EN in the spec but I don't know how to set related registers.

Thanks for your help in advance!!

 

Best Regards,

 

Eric Fang

 

 

 

  • Eric,

    Have you taken a look at the 32-bit Timer Reference Guide (SPRU582)?  You can see the register field descriptions for the Timer Control Register (CTL) in Figure 5.  You can view the current contents of this register at address 0x0194 0000 in a CCS View->Memory window to make sure everything is being setup correctly.

    Looking at your code, I see that you have used TIMER_CTL_FUNC_TOUT instead of TIMER_CTL_FUNC_GPIO.  This is likely the source of your problem.

    Regards,

    Brad

  • Hi, Brad,

    I find my timer 0 handle is not right after calling TIMER_open().

    Please refer to the following:

    Do I miss anything before calling TIMER_open()?

    In my project, I also have timer 1. But the timer 1 handle is correct after calling TIMER_open().

    Really appreciate your help!!

     

    Best Regards,

     

    Eric Fang

     

  • Eric,

    Sorry for delayed response.

    You mentioned that your code works fine for timer1. Are you using exactly the same code for both Timer0 and Timer1?

    Regards, Srirami.

  • Dear Sir,

     

    I already find the root cause and fix the problem.

    In my DSP/BIOS setting, there is a PRD timer using the timer 0.

    I delete the timer 0 PRD timer, and my timer 0 can work normally.

    Just to let you know and thank you for your help!

     

    Best Regards,

     

    Eric Fang