Turned up the rtimer resolution to 32678 Hz.

This commit is contained in:
adamdunkels 2010-12-16 22:50:21 +00:00
parent 1d090ea0f5
commit f370b217a5
2 changed files with 14 additions and 9 deletions

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.25 2010/04/04 12:29:50 adamdunkels Exp $ * @(#)$Id: clock.c,v 1.26 2010/12/16 22:50:21 adamdunkels Exp $
*/ */
@ -49,12 +49,14 @@
static volatile unsigned long seconds; static volatile unsigned long seconds;
static volatile clock_time_t count = 0; static volatile clock_time_t count = 0;
/* last_tar is used for calculating clock_fine, last_ccr might be better? */ /* last_tar is used for calculating clock_fine */
static unsigned short last_tar = 0; static volatile uint16_t last_tar = 0;
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
interrupt(TIMERA1_VECTOR) timera1 (void) { interrupt(TIMERA1_VECTOR) timera1 (void) {
ENERGEST_ON(ENERGEST_TYPE_IRQ); ENERGEST_ON(ENERGEST_TYPE_IRQ);
watchdog_start();
if(TAIV == 2) { if(TAIV == 2) {
/* HW timer bug fix: Interrupt handler called before TR==CCR. /* HW timer bug fix: Interrupt handler called before TR==CCR.
@ -63,9 +65,7 @@ interrupt(TIMERA1_VECTOR) timera1 (void) {
/* Make sure interrupt time is future */ /* Make sure interrupt time is future */
do { do {
/* TACTL &= ~MC1;*/
TACCR1 += INTERVAL; TACCR1 += INTERVAL;
/* TACTL |= MC1;*/
++count; ++count;
/* Make sure the CLOCK_CONF_SECOND is a power of two, to ensure /* Make sure the CLOCK_CONF_SECOND is a power of two, to ensure
@ -94,7 +94,9 @@ interrupt(TIMERA1_VECTOR) timera1 (void) {
/* if(process_nevents() >= 0) { /* if(process_nevents() >= 0) {
LPM4_EXIT; LPM4_EXIT;
}*/ }*/
watchdog_stop();
ENERGEST_OFF(ENERGEST_TYPE_IRQ); ENERGEST_OFF(ENERGEST_TYPE_IRQ);
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
@ -142,7 +144,10 @@ clock_init(void)
/* TACTL = TASSEL1 | TACLR | ID_3; */ /* TACTL = TASSEL1 | TACLR | ID_3; */
/* Select ACLK 32768Hz clock, divide by 2 */ /* Select ACLK 32768Hz clock, divide by 2 */
TACTL = TASSEL0 | TACLR | ID_1; /* TACTL = TASSEL0 | TACLR | ID_1;*/
/* Select ACLK 32768Hz clock */
TACTL = TASSEL0 | TACLR;
/* Initialize ccr1 to create the X ms interval. */ /* Initialize ccr1 to create the X ms interval. */
/* CCR1 interrupt enabled, interrupt occurs when timer equals CCR1. */ /* CCR1 interrupt enabled, interrupt occurs when timer equals CCR1. */

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: rtimer-arch.h,v 1.8 2010/09/13 20:51:10 nifi Exp $ * $Id: rtimer-arch.h,v 1.9 2010/12/16 22:50:21 adamdunkels Exp $
*/ */
/** /**
@ -44,7 +44,7 @@
#include <io.h> #include <io.h>
#include "sys/rtimer.h" #include "sys/rtimer.h"
#define RTIMER_ARCH_SECOND (4096U*4) #define RTIMER_ARCH_SECOND (4096U*8)
rtimer_clock_t rtimer_arch_now(void); rtimer_clock_t rtimer_arch_now(void);