bug fix, msp430 hw bug (undocumented):

when in continuous/compare mode the interrupt handler may get called before CCR==TR.

behavior observed when the timer is toggled between STOP/CONT in an external interrupt handler (serial input).

possibly this problem may also affect watchdog timer/timer B
This commit is contained in:
fros4943 2008-09-16 12:00:48 +00:00
parent 8aa8e26c54
commit b90075ea0a

View file

@ -28,7 +28,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* @(#)$Id: clock.c,v 1.14 2008/07/07 23:38:09 adamdunkels Exp $ * @(#)$Id: clock.c,v 1.15 2008/09/16 12:00:48 fros4943 Exp $
*/ */
@ -56,6 +56,11 @@ static unsigned short last_tar = 0;
interrupt(TIMERA1_VECTOR) timera1 (void) { interrupt(TIMERA1_VECTOR) timera1 (void) {
ENERGEST_ON(ENERGEST_TYPE_IRQ); ENERGEST_ON(ENERGEST_TYPE_IRQ);
if(TAIV == 2) { if(TAIV == 2) {
/* HW timer bug fix: Interrupt handler called before TR==CCR.
* Occurrs when timer state is toggled between STOP and CONT. */
while (TACTL & MC1 && TACCR1 - TAR == 1);
/* Make sure interrupt time is future */ /* Make sure interrupt time is future */
do { do {
TACCR1 += INTERVAL; TACCR1 += INTERVAL;