Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cpu/cc2538/periph/timer overhaul #4878

Merged
merged 9 commits into from
Mar 3, 2016

Conversation

hexluthor
Copy link
Contributor

  • Use the 32-bit counter mode.
  • Apply frequency scaling for non-16 MHz frequencies.
  • tests/periph_timer works now.

Tested on boards/cc2538dk. The previous implementation used 16-bit counters and did not work properly.

@OlegHahm OlegHahm added this to the Release 2016.03 milestone Feb 22, 2016
@OlegHahm OlegHahm added Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation Platform: ARM Platform: This PR/issue effects ARM-based platforms Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation Area: drivers Area: Device drivers labels Feb 22, 2016
@hexluthor
Copy link
Contributor Author

Just expanded the scope of this PR a bit. Added support to xtimer for a negative XTIMER_SHIFT. Now xtimers should work on cc2538-based boards. Specifically, the following tests seem to work, at least on boards/cc2538dk:

  • periph_timer
  • xtimer_drift
  • xtimer_hang
  • xtimer_msg
  • xtimer_msg_receive_timeout
  • xtimer_now64_continuity
  • xtimer_remove
  • xtimer_reset
  • xtimer_usleep_until

@A-Paul
Copy link
Member

A-Paul commented Feb 24, 2016

Hi @hexluthor , thanks for your effort and "rebooting" whole thing. I try to counter check the periph_timer and xtimer_* asap.

Have you noticed #4838 already? Maybe you can take it into account.

@A-Paul
Copy link
Member

A-Paul commented Feb 24, 2016

Couldn't resist and made a quick check with periph_timer xtimer_hang and xtimer_usleep_until (the stinkers in #4729). No hangups!
Congrats. 👏

And, do you mind enclosing the numeric defines in parenthesis?

@A-Paul
Copy link
Member

A-Paul commented Feb 24, 2016

@kaspar030 I would appreciate if you assist reviewing. In particular the xtimer stuff.

@jnohlgard
Copy link
Member

The macro names XTIMER_RSHIFT and XTIMER_LSHIFT are easy to understand when looking at the diff in this PR, but I think it can cause confusion in the future ("why is XTIMER_RSHIFT a left shift?"). Any ideas for easier to understand names?

@A-Paul
Copy link
Member

A-Paul commented Feb 24, 2016

@hexluthor, I ran all the tests. One fail.

  • xtimer_drift: FREEZES
2016-02-24 16:43:55,527 - INFO # main(): This is RIOT! (Version: 2016.03-devel-600-ge06e7-hedon-cc2538-periph-timer)
2016-02-24 16:43:55,530 - INFO # xtimer_drift test application
[...]
2016-02-24 16:43:55,599 - INFO # sending 4th msg
2016-02-24 16:43:55,600 - INFO # Starting thread 5
2016-02-24 16:43:55,620 - INFO # now=0.095278 (0 hours 0 min), diff=0
2016-02-24 16:43:56,619 - INFO # now=1.095381 (0 hours 0 min), diff=103
/exit
2016-02-24 16:44:16,658 - INFO # Exiting Pyterm

@hexluthor
Copy link
Contributor Author

@gebart, I agree the macro names aren't great. I'm open to suggestions. Originally I wanted XTIMER_SHIFT() and XTIMER_UNSHIFT(), but that was confusing too, and collided with the already defined XTIMER_SHIFT value. Suppose we use XTIMER_TO_1MHZ() and XTIMER_FROM_1MHZ()?

@kYc0o kYc0o added the Community: Hack'n'ACK candidate This PR is a candidate for review and discussion during one of RIOT's monthly Hack'n'ACK parties label Feb 28, 2016
@kYc0o
Copy link
Contributor

kYc0o commented Mar 1, 2016

So I can test this PR to ACK but I don't know if @gebart wants to change these macro names?

@jnohlgard
Copy link
Member

I don't have any good suggestions for names, but I think XTIMER_SHIFT_TO_1MHZ is better than XTIMER_RSHIFT etc.

@jnohlgard
Copy link
Member

needs rebase btw

@hexluthor hexluthor force-pushed the cc2538-periph-timer branch from 6887131 to 856c5e1 Compare March 1, 2016 20:19
@hexluthor
Copy link
Contributor Author

Ok, rebased and I changed the macro names to XTIMER_USEC_TO_TICKS() and XTIMER_TICKS_TO_USEC().

@kYc0o kYc0o added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Mar 1, 2016
@kYc0o
Copy link
Contributor

kYc0o commented Mar 1, 2016

I tested periph_timer and all xtimer, with success. Just waiting for travis to ACK.

@kYc0o
Copy link
Contributor

kYc0o commented Mar 3, 2016

Incredible, travis failed because a signature verification failed... restarted...

@kYc0o
Copy link
Contributor

kYc0o commented Mar 3, 2016

Done! ACK and go!

kYc0o added a commit that referenced this pull request Mar 3, 2016
@kYc0o kYc0o merged commit e730f1b into RIOT-OS:master Mar 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: drivers Area: Device drivers CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Community: Hack'n'ACK candidate This PR is a candidate for review and discussion during one of RIOT's monthly Hack'n'ACK parties Platform: ARM Platform: This PR/issue effects ARM-based platforms Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants