From baf2c2098e5cd7f2b4f982b1228bd8f03d2486c4 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 7 Aug 2014 13:42:47 -0600 Subject: [PATCH] Change CONFIG_MSEC_PER_TICK to CONFIG_USEC_PER_TICK. This gives more options for system timers in general, but more importantly, let's us realize higher resolution for the case of CONFIG_SCHED_TICKLESS=y -- of course, at the risk of some new interger overvflow problems --- Documentation/NuttxPortingGuide.html | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Documentation/NuttxPortingGuide.html b/Documentation/NuttxPortingGuide.html index 0f54a3e871d..8eb13e2970b 100644 --- a/Documentation/NuttxPortingGuide.html +++ b/Documentation/NuttxPortingGuide.html @@ -2220,23 +2220,23 @@ The system can be re-made subsequently by just typing make.

System Timer In most implementations, system time is provided by a timer interrupt. - That timer interrupt runs at rate determined by CONFIG_MSEC_PER_TICKS (default 10 or 100Hz). - The timer generates an interrupt each CONFIG_MSEC_PER_TICKS milliseconds and increments a counter called g_system_timer. - g_system_timer then provides a time-base for calculating up-time and elapsed time intervals in units of CONFIG_MSEC_PER_TICKS. + That timer interrupt runs at rate determined by CONFIG_USEC_PER_TICKS (default 10000 microseconds or 100Hz. If CONFIG_SCHED_TICKLESS is selected, the default is 100 microseconds). + The timer generates an interrupt each CONFIG_USEC_PER_TICKS microseconds and increments a counter called g_system_timer. + g_system_timer then provides a time-base for calculating up-time and elapsed time intervals in units of CONFIG_USEC_PER_TICKS. The range of g_system_timer is, by default, 32-bits. However, if the MCU supports type long long and CONFIG_SYSTEM_TIME16 is selected, a 64-bit system timer will be supported instead.

System Timer Accuracy - On many system, the exact timer interval specified by CONFIG_MSEC_PER_TICKS cannot be achieved due to limitations in frequencies or in dividers. - As a result, the time interval specified by CONFIG_MSEC_PER_TICKS may only be approximate and there may be small errors in the apparent up-time time. + On many system, the exact timer interval specified by CONFIG_USEC_PER_TICKS cannot be achieved due to limitations in frequencies or in dividers. + As a result, the time interval specified by CONFIG_USEC_PER_TICKS may only be approximate and there may be small errors in the apparent up-time time. These small errors, however, will accumulate over time and after a long period of time may have an unacceptably large error in the apparent up-time of the MCU.

- If the timer tick period generated by the hardware is not exactly CONFIG_MSEC_PER_TICKS and if there you require accurate up-time for the MCU, then there are measures that you can take: + If the timer tick period generated by the hardware is not exactly CONFIG_USEC_PER_TICKS and if there you require accurate up-time for the MCU, then there are measures that you can take: