-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Labels
Area: timersArea: timer subsystemsArea: timer subsystemsType: bugThe issue reports a bug / The PR fixes a bug (including spelling errors)The issue reports a bug / The PR fixes a bug (including spelling errors)
Description
On platforms where xtimer is using a <32bit counter, xtimer_now() might cause a wrong time to be returned when called from ISRs, as the _high_count and _long_count interrupts might be missed (delayed). This is also true for xtimer_now64() for all platforms, and also for all calls while IRQ's are disabled.
Unfortunately this also affects all xtimer_set*(), as they call xtimer_now[64}().
Can anyone think of an algorithm to prevent this?
(something like, a) set a flag after e.g., half the underlying timer's tick count, b) unset on overflow, and if in isr the tick count is < half and the flag is not set, add one to the long counter...)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Area: timersArea: timer subsystemsArea: timer subsystemsType: bugThe issue reports a bug / The PR fixes a bug (including spelling errors)The issue reports a bug / The PR fixes a bug (including spelling errors)