Hi,
I've noticed what appears to be a discrepancy between the family guide documentation, and the observed behavior of the TIMERA0 module of the FR5969. It could also be a misinterpretation on my part, but I'd like to figure out if I can resolve it. The part of the family guide in question is on page 427, and I am using the timer in UP mode:
"When the timer mode is either up or up/down, the timer may be stopped by writing 0 to TAxCCR0. The
timer may then be restarted by writing a nonzero value to TAxCCR0. In this scenario, the timer starts
incrementing in the up direction from zero."
In general the behavior I observe agrees with what is written. However, if I stop the timer by setting CCR0 to zero, then pre-load TA0R with a value before starting the timer I measure the timeout (with an o-scope) as running from the pre-load I put in until the CCR0 value. In general I like this behavior, but a strict interpretation of the documentation seems to indicate that the timer should start "incrementing from zero" which implies TA0R would be cleared as soon as the timer is started and I should measure a timeout of length zero to the CCR0 value. I included a code snippet which will hopefully demonstrate what I'm talking about.
Can someone confirm whether or not the timer is supposed to begin counting "from zero" with it is restarted with a CCR0 write? I'd like to rely on it being one way or the other in my code, so I don't get caught off guard in the future with a silicon revision. Thanks!
TA0CCR = 0;
TA0R = timeout/2;
TA0CCR0 = timeout;
P1OUT |= (1<<0); //set pin
LPM4;
P1OUT &= ~(1<<0); //clear pin -> measure a pulse that is timeout/2 long
TA0CCR = 0;
TA0R = 0;
TA0CCR = timeout;
P1OUT |= (1<<0); //setpin
LPM4;
P1OUT &= ~(1<<0); //clear pin -> measure a pulse that is timeout long