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.

OMAP-L138 ECAP O/P Frequency Calculation

Hi,

We are using the ECAP2 for generating certain frequencies (In APWM Mode).

Is there any formulae for calculating values to be programmed in the following registers APRD (CAP1) and ACMP (CAP2)?

or else we have to go for trial and error method?

Thank You & Regards,

GSR

  • The generated APWM signal is dependent on the ECAP module input frequency.

    • APRD is used to manipulate the frequency.
    • ACMP is used to change the duty cycle.

     

    The frequency is when the TSCTR register equals the value in APRD.  Therefore, once you find out the TSCTR period, you can use that value to calculate what the value for APRD should be.  For instance.

    • Assuming that the ECAP input frequency is running at 150Mhz with no divide-down for the TSCLK, each increment in the TSCTR register is equal to a period length of 6.67ns.
    • For a frequency of 15Mhz, the desired period would be 66.67ns.  You will need to set APRD to 10 (aka 10 TSCTR ticks) to get the desired period.

     

    The duty cycle is set by ACMP (CAP2).  Once you get the value for APRD, calculating the duty cycle is fairly easy.  For a duty cycle of 50%, it will be ACMP = 50% * APRD.   For a duty cycle of 10%, it will be ACMP = 10% * APRD. 

     

    Please see Figure 9 in the ECAP user guide (http://focus.ti.com/lit/ug/sprufl2a/sprufl2a.pdf) for a better diagram describing the relationship between APRD, ACMP and TSCTR.

     

    --Christina

  • Hi Christina,

    Thank You for reading and replying for the post.

    The information that you have shared is very useful.

    With the above explanation, able to generate a 4KHz waveform.

    Can you please tell what is TSCLK?

    I didn't find any register as such in ECAP registers. Can you please provide a URL for that.

    Regards,

    GSR

  • The TSCLK is the clock signal that increments the TSCNT register. 

    The ECAP module is running off of SYSCLK2.  Within the ECAP module, you can prescale the input SYSCLK2 clock via the ECCTL1[PRESCALE] register and that will be the frequency of TSCLK. By default, the ECCTL1[PRESCALE] is a value of 0, which is divide by 0.

    For instance, if SYSCLK2 is running at 150Mhz and you set the ECCTL1[PRESCALE] to 1 (divide by 2), the TSCLK will be running at 75Mhz.  Thus, the TSCNT register will increment based on the TSCLK frequency.

    --Christina