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.

Timer A OUTx Signal Change



Hi

When really does the OUTx signal of the Timer A Output Units change? In the description of the Set/Reset Output Mode in Table 12-2 of the Family User's Guide it says, the OUTx signal is reset when the timer counts to TACCR0 value. However, in the Output Example description on page 12-14 it says, the signal is changed when the timer rolls from TACCR0 to zero. I suppose the second one is correct. Am I right?

Regards

Roman

  • It depends on the output mode. In the single-action modes, the action should take place when TAR counts to CCRx.
    Why should it take place when TAR rolls over to zero? For any CCRx except 0 this would be independently of the CCRx value. And why should CCR0 behave different as the others? And then only if the timer is in up mode, which is NOT under control of the CCRx unit at all

    the outmode is one of the double-action modes, the first action takes place when TAR counts to CCRx and the second one when TAR rolls over.
    In case of CCR0, it will still generate a 1-tick spike.

    The description isn't that clear here, but the above is what many people observed. And what makes sense logically too.

    Internally, all CCRx units are 100% identical. The only thing that makes CCR0 special is, that the compare trigger signal is additionally routed to the timer's reset logic (causing an overflow in up mode) and to a separate interrupt vector. Which in turn changes/limits the effective use of its outmodes.

    It's like connecting P1.0 with the reset pin externally. This does not make P1 itself different from P2, it just limits/changes its use, as this connections causes a side effect P2 does not have.

  • Hi Roman,

    Yes, you're right, but only when the counter is in "up" mode.  It sounds like that's the mode you plan to use.

    The counting mode (up, continuous, or up/down) makes all the difference.

    In "up" mode, the second action of the double-action OUT modes occurs when the counter rolls from TACCR0 to zero.

    In "continuous" and "up/down" modes, the second action occurs when the counter counts to the TACCR0 value.  Counting to zero has no effect on the output in these counting modes.

    This small distinction is the reason behind the confusing information in User's Guide.  It's no wonder so many of us in the forum have been confused!

    Jeff

  • Yes, I was talking about the Up Mode. According to your information, the description of the Output Modes in Table 12-2 is not entirely correct. It should be mentioned that in double-action modes the second action not always occurs when the timer counts to TACCR0 but it depends on the counting mode.

    Thanks

    Roman

  • Roman said:
    It should be mentioned that in double-action modes the second action not always occurs when the timer counts to TACCR0 but it depends on the counting mode.


    Which rises the question what happens when the timer is running in UP/DOWN mode. There the timer counts up to CCR0, then down again. Here the double-action modes of CCR0 won't generate a spike, but a symmetrical signal (well, sames as in up mode, toggle outpmode and half the CCR0 value).
    But what happens for the other CCRs? They will do the first action when TAR counts to CCRx, on its way up and on the way down, and the second action happens when it counts down to 0. That finally gives the toggle/reset mode a sense (else it would be always identical to set/reset).

    Well, the best way to figure out is to play with it and have a good oscilloscope or logic analyzer ready. :)

  • Jens-Michael Gross said:

    Which rises the question what happens when the timer is running in UP/DOWN mode. There the timer counts up to CCR0, then down again. Here the double-action modes of CCR0 won't generate a spike, but a symmetrical signal (well, sames as in up mode, toggle outpmode and half the CCR0 value).

    Don't you mean double the CCR0 value? If in up/down mode the OUT0 signal is once set when counting to CCR0 an the other time reset, the period will be double the length as in up mode an toggle output mode. Hence, the CCR0 value has to be doubled to get the same signal whend using up mode and toggle output mode.

     

    Jens-Michael Gross said:

    But what happens for the other CCRs? They will do the first action when TAR counts to CCRx, on its way up and on the way down, and the second action happens when it counts down to 0. That finally gives the toggle/reset mode a sense (else it would be always identical to set/reset).

    Well, the best way to figure out is to play with it and have a good oscilloscope or logic analyzer ready. :)

    According to the User's Guide, the OUTx signal doen's change when counting down to 0 but when counting to CCR0.

     

  • I did some experimenting with my scope.

    Configuring CCR0 for a double-action output mode is mostly useless when the counter is in "up" mode and totally useless in "up/down" and "continuous" modes.

    In up mode, the double action modes allow OUT0 to produce a tiny pulse of one clock period of either polarity.  Limited usefulness there, but not totally useless.

    In "up/down" and "continuous" modes, configuring CCR0 for a double-action mode is totally useless.  It leaves OUT0 steady high or low -- it never changes.  The output module is trying to do both actions of the double-action sequence at the same time.  The notes in the User's Guide about this being useless are absolutely correct -- but they didn't distinguish between the counting modes.  So really it's the same User's Guide omission -- not carefully noting the unique match behavior of "up" mode with the double-action output modes.

     

     

  • Thanks for your work, I appreciate it. That leaves no questions open for now :)

  • Jeff Tenney said:
    I did some experimenting with my scope.

    Thanks. Now I don't have to do it myself :)

    Jeff Tenney said:
    In "up/down" and "continuous" modes, configuring CCR0 for a double-action mode is totally useless. 

    Sure? In continuous mode, one should happen at TAR=CCR0 and the other at TAR=0. In up/down mode it was unclear, as of course there is a difference if TAR overflows to 0 (by 16 bit overflow or CCR0 overflow) or counts down to 0. Which does not mean that it must be a difference for the action trigger too.

    Anyway, the documentation requires some overhaul.

  • Yes, I'm confident about these findings.  It might help if somebody else duplicated them so we can all feel confident about them.

    All of the individual examples in the User's Guide are correct.  The examples for "up" mode even describe the 1-count delay in the second match of the double-action output modes.  (Second match at 0 not at TACCR0.)  And the examples for the other counting modes are also correct in describing the second match at TACCR0 not at 0.  The only problem is in the summary descriptions, which omit this nuance.

    The nuance is tricky to explain.  Even looking at my previous attempt to explain it here in the forum, I'm still not sure it's clear to other readers.  Uggh.  I can feel the pain of TI tech writers!

  • Jeff Tenney said:
    The nuance is tricky to explain.  Even looking at my previous attempt to explain it here in the forum, I'm still not sure it's clear to other readers. 

    Yes, it is tricky to explain. And as many posts in this forum show, the whole timer thing (well, not only) isn't too clear for many people. Even for the parts where the documentation is correct and exhaustive.

    Jeff Tenney said:
    Uggh.  I can feel the pain of TI tech writers!

    I know it from own experience. I'm very reluctant to write documentations. You can put as much time in it as you like, there will always be open questions (including 'what is this at all' :) )

**Attention** This is a public forum