forked from RIOT-OS/RIOT
-
Notifications
You must be signed in to change notification settings - Fork 0
Timer Task Force
Hauke Petersen edited this page Jan 29, 2015
·
7 revisions
This page is used to collect requirements and suggestions concerning a hwtimer/vtimer/RTC redesign.
- very efficient timers for use in time-critical drivers
- easy-to-use interface (unified interface)
- work with varying MCU timer widths (16, 24, 32-bit timers)
- adaptable to varying configurations of timers, RTTs, RTCs
- (use RTC if available for super-long-time timers)
- Wait for a time period (e.g. timer_usleep(howlong))
- receive message after given period of time (e.g. timer_msg(howlong))
- receive message periodically
- Await a point in time
- Wait for a (past) time + x
- what granularity to use? msec,usec,nsec, timer ticks, a combination?
-
timer.h: timer hardware abstraction, using ticks
-
hwtimer: low-level timer multiplexing, one timer.h timer using the same ticks
-
vtimer: higher-level timer multiplexing, using one hwtimer, usecs
-
first two look OK, are stable
-
vtimer sucks
- at 70Mhz ticks, theoretical timer granularity can reach 14ns. Factor 10 speed increase is probable before the next timer revamp. That means that we have to use nanoseconds granularity (in the API) if we want to not waste hardware potential now or in the future. That also means that 32bit timer values would overflow in seconds.
- using microseconds, 32bit can hold 71 minutes. Sounds like not much to me.
- using miliseconds, 32bit can hold 49days.
- a 64bit unsigned value can hold >584years in nanoseconds.
- using 64bit values simplifies code a lot (we could use signed values for easy comparision or the representation of negative time values, in code "c=a-b" looks a lot more readable than "c.sec=a.sec-b.sec, c.nsec=a.nsec-b.nsec" and handling overflows
- not sure how much this affects code size (one 32bit value vs. a struct with two 32bit values vs. one 64bit values) or how 8bit systems handle 64bit integers
- see here for some numbers on this
RIOT - The friendly Operating System for the Internet of Things
Homepage | [GitHub] (https://github.com/RIOT-OS/) | Developers Mailing List | Users Mailing List | Twitter @RIOT_OS
- Family: ARM
- Board: Airfy Beacon
- Board: Arduino Due
- Board: CC2538DK
- Board: HikoB Fox
- Board: IoT LAB M3
- Board: LimiFrog-v1
- Board: mbed_lpc1768
- Board: MSB-IoT
- Board: MSBA2
- Board: Nucleo-L1
- Board: Nucleo-F334
- Board: Nucleo-F303
- Board: Nucleo-F091
- Board: Mulle
- Board: OpenMote
- Board: PCA1000x (nRF51822 Development Kit)
- Board: Phytec phyWAVE-KW22
- Board: RFduino
- Board: Samr21 xpro
- Board: Spark Core
- Board: STM32F0discovery
- Board: STM32F3discovery
- Board: STM32F4discovery
- Board: UDOO
- Board: yunjia-nrf51822
- Family: ATmega
- Board: Arduino Mega2560
- Family: MSP430
- Board: MSB-430H
- Board: TelosB
- Board: WSN430
- Board: Zolertia Z1
- Board: eZ430-Chronos
- Family: native
- Board: native
- Family: x86
- Board: Intel Galileo