cpu/nrf5x_common: properly calibrate RC-based low-frequency clock#20669
Merged
maribu merged 1 commit intoRIOT-OS:masterfrom May 14, 2024
Merged
cpu/nrf5x_common: properly calibrate RC-based low-frequency clock#20669maribu merged 1 commit intoRIOT-OS:masterfrom
maribu merged 1 commit intoRIOT-OS:masterfrom
Conversation
benpicco
approved these changes
May 14, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contribution description
@BOZHENG001 encountered the issue where all NimBLE-based examples would fail to establish connection while advertising works normally on
feather-nrf52840-sense, while they work properly onnrf52840dk. As suggested by @andrzej-kaczmarek in apache/mynewt-nimble#1777 (comment), this is an issue with the internal RC low-frequency clock which needs to be calibrated.While RIOT already tries to do so, it currently ignores the fact that the high-frequency clock needs to be manually started for the calibration to succeed. This is documented for nRF51 here on page 53 and for nRF52-series for example here for nRF52832 and here for nRF52840. The documentation of nRF5240 does not explicitly mention the necessity to manually start the HFCLK, but it shouldn't harm there either.
Testing procedure
make -C examples/nimble_heart_rate_sensor BOARD=feather-nrf52840-sense flash termfails to establish a connection (e.g. to the Android app "nRF Connect"). This is also possible to reproduce withBOARD=nrf52840dkafter switching to the internal RC oscillator:With this PR, connection can be reliably established.
Issues/PRs references
The issue has also been discussed on Matrix with @maribu, thanks for your input!