Skip to content
New issue

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

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

Already on GitHub? # to your account

boards/common/nrf52: fix timer config #18948

Merged
merged 2 commits into from
Nov 23, 2022
Merged

Conversation

maribu
Copy link
Member

@maribu maribu commented Nov 22, 2022

Contribution description

The channels member should not be set to the number of hardware channels n, but to n - 1 instead. The last channel is implicitly used in timer_read(). Hence out of n hardware channels, only n - 1 are available to the application.

This fixes a bug introduced by 4d02e15 which incorrectly set the channel number to n rather than to n - 1.

Testing procedure

timer_read() should work again on nRF52 MCUs.

Issues/PRs references

Introduced in #18811

The `channels` member should not be set to the number of hardware
channels *n*, but to *n* - 1 instead. The last channel is implicitly
used in `timer_read()`. Hence out of *n* hardware channels, only *n* - 1
are available to the application.

This fixes a bug introduced by 4d02e15
which incorrectly set the channel number to *n* rather than to
*n* - 1.
@maribu maribu added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Nov 22, 2022
@github-actions github-actions bot added the Area: boards Area: Board ports label Nov 22, 2022
@benpicco benpicco requested a review from bergzand November 22, 2022 12:33
@benpicco
Copy link
Contributor

The last channel is implicitly used in timer_read(). Hence out of n hardware channels, only n - 1 are available to the application.

better add a comment to prevent this mistake in the future

@github-actions github-actions bot added Area: cpu Area: CPU/MCU ports Platform: ARM Platform: This PR/issue effects ARM-based platforms labels Nov 22, 2022
@maribu maribu enabled auto-merge November 22, 2022 14:04
@riot-ci
Copy link

riot-ci commented Nov 23, 2022

Murdock results

✔️ PASSED

b533fcf cpu/nrf5x_common: improve doc on timer_conf_t::channels

Success Failures Total Runtime
117849 0 117849 02h:16m:41s

Artifacts

@maribu maribu merged commit 232c70b into RIOT-OS:master Nov 23, 2022
@maribu maribu deleted the boards/common/nrf52 branch November 23, 2022 10:01
@maribu
Copy link
Member Author

maribu commented Nov 23, 2022

Thx :)

@kaspar030 kaspar030 added this to the Release 2023.01 milestone Jan 19, 2023
# for free to join this conversation on GitHub. Already have an account? # 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 Platform: ARM Platform: This PR/issue effects ARM-based platforms Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants