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

Fix RTC selection of frequency for LSI and HSE #468

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Rutherther
Copy link
Contributor

So far, Rtc::select_frequency did not consider frequencies other than LSE_HERTZ, which was valid only for LSE with 32.768 kHz. For LSI, which has 40 kHz, and HSE, which may have an arbitrary frequency in a given range, the frequency was selected based on the wrong RTC frequency.

This PR aims to fix that. I've also refactored the new methods a bit, using the select_frequency instead of repeating the same code.

I've solved this by adding frequency field to the Rtc, there is no other way I could think of, as HSE frequency may be different depending on the crystal selected for specific application. As far as I understand it, LSE does not necessarily have to be 32.768 kHz, so maybe adding the possibility to change the frequency of LSE could prove useful as well? Adding the frequency field unfortunately introduces redundancy for LSI and (maybe) LSE.

So far, Rtc::select_frequency did not
take into account other frequency than LSE_HERTZ,
that was valid only for LSE that has 32.768 kHz.

For LSI, that has 40 kHz, and HSE, that may
have arbitrary frequency in a given range,
the frequency was selected based on wrong
RTC frequency.
@Rutherther
Copy link
Contributor Author

In my previous PR #466, I forgot to add the change to CHANGELOG.md, this PR adds that change to CHANGELOG as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant