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/sam0: unified rtt configuration #14303

Merged
merged 6 commits into from
Jun 19, 2020

Conversation

fjmolinas
Copy link
Contributor

@fjmolinas fjmolinas commented Jun 17, 2020

Contribution description

This PR is split from #13874. It unifies rtt configuration for sam0 and make the RTT_FREQYENCY configurable.

As in #13874 max and min values for the RTT are documented.

I've notices that RT&DEV are unused here, but I would rather remove in a follow up. I did remove RTT_IRQ_PRIORITY since it was unused and misleading.

Testing procedure

Test for one board of every subfamily

  • samd21
  • saml1x
  • saml21
  • samd5x

i don't have any board of the other 3 ATM, maybe @benpicco @dylad can help?

  • tests/periph_rtt should still pass on sam0 boards with different frequencies

BOARD=samr21-xpro make -C tests/periph_rtt flash test --no-print-directory -j3

2020-06-17 12:50:59,314 # START
2020-06-17 12:50:59,321 # main(): This is RIOT! (Version: 2020.07-devel-1252-g69761-dev/sam0_unfied_rtt)
2020-06-17 12:50:59,321 #
2020-06-17 12:50:59,323 # RIOT RTT low-level driver test
2020-06-17 12:50:59,328 # This test will display 'Hello' every 5 seconds
2020-06-17 12:50:59,328 #
2020-06-17 12:50:59,330 # Initializing the RTT driver
2020-06-17 12:50:59,332 # RTT now: 2
2020-06-17 12:50:59,335 # Setting initial alarm to now + 5 s (163842)
2020-06-17 12:50:59,340 # Done setting up the RTT, wait for many Hellos
2020-06-17 12:51:04,331 # Hello
2020-06-17 12:51:09,331 # Hello
2020-06-17 12:51:14,331 # Hello
2020-06-17 12:51:19,331 # Hello
2020-06-17 12:51:24,331 # Hello
2020-06-17 12:51:29,331 # Hello
2020-06-17 12:51:34,331 # Hello
2020-06-17 12:51:39,331 # Hello

CFLAGS+=-DRTT_FREQUENCY=1024 BOARD=samr21-xpro make -C tests/periph_rtt clean flash test --no-print-directory -j3

2020-06-17 12:51:46,588 # START
2020-06-17 12:51:46,594 # main(): This is RIOT! (Version: 2020.07-devel-1252-g69761-dev/sam0_unfied_rtt)
2020-06-17 12:51:46,595 #
2020-06-17 12:51:46,597 # RIOT RTT low-level driver test
2020-06-17 12:51:46,601 # This test will display 'Hello' every 5 seconds
2020-06-17 12:51:46,602 #
2020-06-17 12:51:46,604 # Initializing the RTT driver
2020-06-17 12:51:46,605 # RTT now: 0
2020-06-17 12:51:46,609 # Setting initial alarm to now + 5 s (5120)
2020-06-17 12:51:46,613 # Done setting up the RTT, wait for many Hellos
2020-06-17 12:51:51,606 # Hello
2020-06-17 12:51:56,606 # Hello
2020-06-17 12:52:01,606 # Hello
2020-06-17 12:52:06,606 # Hello
2020-06-17 12:52:11,606 # Hello

Issues/PRs references

@fjmolinas fjmolinas added Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation Area: boards Area: Board ports Area: cpu Area: CPU/MCU ports labels Jun 17, 2020
@fjmolinas fjmolinas added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Jun 17, 2020
@fjmolinas fjmolinas removed the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Jun 17, 2020
@fjmolinas
Copy link
Contributor Author

I'll trigger a build to see there is some conflict and the fix the changes requested

@fjmolinas fjmolinas added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Jun 17, 2020
@benpicco
Copy link
Contributor

Murdock is reasonably happy.

Comment on lines 40 to 46
#define RTC_MODE0_PRESCALER \
(__builtin_ctz(RTT_CLOCK_FREQUENCY / RTT_FREQUENCY) << \
RTC_MODE0_CTRLA_PRESCALER_Pos)
#else
#define RTC_MODE0_PRESCALER \
(__builtin_ctz(RTT_CLOCK_FREQUENCY / RTT_FREQUENCY) << \
RTC_MODE0_CTRL_PRESCALER_Pos)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tested on iotlab for samr30-xpro and figure out there is a difference between samd21 and saml21 I'll add a patch.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

image

image

Copy link
Contributor Author

@fjmolinas fjmolinas Jun 18, 2020

Choose a reason for hiding this comment

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

Same applies for the other sub-families with CTRLA

Copy link
Contributor Author

Choose a reason for hiding this comment

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

c11dcf7 addresses this

@fjmolinas
Copy link
Contributor Author

Tested on sam30-xpro on iotlab:

IOTLAB_NODE=samr30-2.saclay.iot-lab.info BOARD=samr30-xpro make -C tests/periph_rtt flash test --no-print-directory -j3
main(): This is RIOT! (Version: 2020.07-devel-1254-gbeaec-pr_sam0_unified_rtt)

RIOT RTT low-level driver test
This test will display 'Hello' every 5 seconds

Initializing the RTT driver
RTT now: 0
Setting initial alarm to now + 5 s (163840)
Done setting up the RTT, wait for many Hellos
Hello
Hello
Hello
Hello
Hello

CFLAGS+=-DRTT_FREQUENCY=1024 IOTLAB_NODE=samr30-3.saclay.iot-lab.info BOARD=samr30-xpro make -C tests/periph_rtt flash test make: Entering directory '/home/francisco/workspace/RIOT/tests/periph_rtt'
READY
s
START
main(): This is RIOT! (Version: 2020.07-devel-1254-gbeaec-pr_sam0_unified_rtt)

RIOT RTT low-level driver test
This test will display 'Hello' every 5 seconds

Initializing the RTT driver
RTT now: 0
Setting initial alarm to now + 5 s (5120)
Done setting up the RTT, wait for many Hellos
Hello
Hello
Hello
Hello
Hello

@fjmolinas fjmolinas removed the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Jun 18, 2020
@fjmolinas
Copy link
Contributor Author

@benpicco do you think you could test on samd5x and saml1x if you have any?

@benpicco
Copy link
Contributor

benpicco commented Jun 18, 2020

Works as expected

same54-xpro
2020-06-18 23:57:44,498 # RIOT RTT low-level driver test
2020-06-18 23:57:44,502 # This test will display 'Hello' every 5 seconds
2020-06-18 23:57:44,502 # 
2020-06-18 23:57:44,504 # Initializing the RTT driver
2020-06-18 23:57:44,505 # RTT now: 0
2020-06-18 23:57:44,509 # Setting initial alarm to now + 5 s (163840)
2020-06-18 23:57:44,513 # Done setting up the RTT, wait for many Hellos
2020-06-18 23:57:49,505 # Hello
2020-06-18 23:57:54,505 # Hello
2020-06-18 23:57:59,506 # Hello
2020-06-18 23:58:04,506 # Hello
saml10-xpro
2020-06-19 00:01:55,678 # RIOT RTT low-level driver test
2020-06-19 00:01:55,682 # This test will display 'Hello' every 5 seconds
2020-06-19 00:01:55,683 # 
2020-06-19 00:01:55,685 # Initializing the RTT driver
2020-06-19 00:01:55,686 # RTT now: 0
2020-06-19 00:01:55,690 # Setting initial alarm to now + 5 s (163840)
2020-06-19 00:01:55,694 # Done setting up the RTT, wait for many Hellos
2020-06-19 00:02:00,686 # Hello
2020-06-19 00:02:05,686 # Hello
2020-06-19 00:02:10,686 # Hello

Please squash!

@fjmolinas fjmolinas added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Jun 19, 2020
@fjmolinas
Copy link
Contributor Author

@benpicco all green here!

@benpicco benpicco merged commit c3314e1 into RIOT-OS:master Jun 19, 2020
@fjmolinas
Copy link
Contributor Author

Thanks for reviewing and testing @benpicco!

@fjmolinas fjmolinas deleted the pr_sam0_unified_rtt branch June 19, 2020 09:38
@miri64 miri64 added this to the Release 2020.07 milestone Jun 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: boards Area: Board ports Area: cpu Area: CPU/MCU ports CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants