Skip to content

xtimer: allow initialisation of XTIMER to any ticks value#5592

Closed
kYc0o wants to merge 1 commit intoRIOT-OS:masterfrom
kYc0o:xtimer_fix_init
Closed

xtimer: allow initialisation of XTIMER to any ticks value#5592
kYc0o wants to merge 1 commit intoRIOT-OS:masterfrom
kYc0o:xtimer_fix_init

Conversation

@kYc0o
Copy link
Copy Markdown
Contributor

@kYc0o kYc0o commented Jul 1, 2016

This PR allows to the user to initialise the XTIMER to any ticks value. This is useful when on-board clocks are not compatible with the previous initialisation value (1000000).

@kYc0o kYc0o added the Area: timers Area: timer subsystems label Jul 1, 2016
@kYc0o kYc0o added this to the Release 2016.07 milestone Jul 1, 2016
@kYc0o
Copy link
Copy Markdown
Contributor Author

kYc0o commented Jul 1, 2016

PR created also to satisfy the clock configuration on #5301

* @brief Define default ticks initialisation if none is defined
*/
#ifndef XTIMER_TICKS_INIT
#define XTIMER_TICKS_INIT 1000000ul
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parenthesis + capital UL

@aabadie
Copy link
Copy Markdown
Contributor

aabadie commented Jul 2, 2016

ACK once comment is addressed.

@jnohlgard
Copy link
Copy Markdown
Member

NACK, It seems wrong that the ticks count should be passed through the usec to ticks macro. Why not modify the usec to ticks scaling instead of introducing another related definition?

@jnohlgard
Copy link
Copy Markdown
Member

I may have been a little too harsh and unreasonable in my previous comment. What I meant to say was that what this PR is doing is changing the definition of 1 second in the xtimer subsystem, which will make all timings wrong in the system. Instead of changing the number of microseconds in 1 second, what should be done is to change the number of hardware timer ticks in 1 second. The scaling from usec to ticks is done with the XTIMER_USEC_TO_TICKS macro, and that's what should be modified, not the argument to the macro.

@kYc0o
Copy link
Copy Markdown
Contributor Author

kYc0o commented Jul 5, 2016

Ok now it's very clear to me. Don't worry, it was me who didn't see the whole problem and trying something just too simple.

Even if the initialisation that I proposed for my specific case on the waspmote is near to 1000000 (921600), which is actually then shifted by 2, I think we should analyse a way to reduce the timing errors as much as possible.

Can we know what's the actual introduced error using values near to 1sec? I think that even initialising XTIMER at 1sec we are not 100% accurate, so maybe we can try to correct the inaccuracy by some other means.

@kYc0o
Copy link
Copy Markdown
Contributor Author

kYc0o commented Jul 7, 2016

Closed by #5608

@kYc0o kYc0o closed this Jul 7, 2016
@kYc0o kYc0o deleted the xtimer_fix_init branch July 7, 2016 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: timers Area: timer subsystems

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants