Skip to content

Conversation

kYc0o
Copy link
Contributor

@kYc0o kYc0o commented Jan 16, 2018

Contribution description

Some board configurations can vary according to the revision, especially on ST discovery and nucleo development boards.

This PR sets the default low speed clock source to LSI, which is always present regardless of the revision. While I acknowledge the preference for LSE (more accurate), for the sake of functionality, LSI should be set by default, unless we know all revisions have LSE. Otherwise, boards simply don't work when RTC is used, and it's used by default on all ST platforms.

According to UM1724, revision MB1136 C-01 on, as far as I can tell, all nucleo64 boards don't have neither HSE and LSE, thus risk to be broken on master.

In this PR I'm only fixing nucleo-l152 and stm32f4doscovery, but I'd advice to change all to LSI by default. Comments welcome!

Issues/PRs references

#7504 (3897d00) enabled LSE on nucleo-l152 and #7158 (b3e7dd8) for stm32f4discovery

Fixes #8240, though is already closed.

@kYc0o kYc0o added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) Platform: ARM Platform: This PR/issue effects ARM-based platforms Discussion: RFC The issue/PR is used as a discussion starting point about the item of the issue/PR CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Area: boards Area: Board ports labels Jan 16, 2018
@kYc0o kYc0o added this to the Release 2018.01 milestone Jan 16, 2018
@kYc0o kYc0o changed the title Set stm32 based boards LSI by default boards: set stm32 based boards LSI by default Jan 16, 2018
@smlng
Copy link
Member

smlng commented Jan 16, 2018

IMHO this needs discussion, also having label Request for Comments set, disqualifies for a release milestone on such short notice.

@olegart
Copy link
Contributor

olegart commented Jan 16, 2018

LSE presence can be autodetected on startup by adding timeout to "while (!(RCC->REG_LSE & BIT_LSERDY)) {}" in stmclk_enable_lfclk. E.g. enable LSI, then try to enable LSE, if after 60k LSI cycles LSE is not ready yet — stay with LSI.

P.S. We are doing the same thing for autodetecting HSE/HSI — some of our boards don't have HSE crystal installed and we don't want to bother users with separate firmware versions.

@kYc0o
Copy link
Contributor Author

kYc0o commented Jan 17, 2018

IMHO this needs discussion, also having label Request for Comments set, disqualifies for a release milestone on such short notice.

Yes I know, what I think is that it's important to have this board in a functional state for the release, which is not the case right now.

@kYc0o
Copy link
Contributor Author

kYc0o commented Jan 17, 2018

LSE presence can be autodetected on startup by adding timeout to "while (!(RCC->REG_LSE & BIT_LSERDY)) {}" in stmclk_enable_lfclk. E.g. enable LSI, then try to enable LSE, if after 60k LSI cycles LSE is not ready yet — stay with LSI.

P.S. We are doing the same thing for autodetecting HSE/HSI — some of our boards don't have HSE crystal installed and we don't want to bother users with separate firmware versions.

Wow great! Thanks @olegart, I'll implement that function instead.

@smlng smlng removed this from the Release 2018.01 milestone Jan 17, 2018
@kYc0o
Copy link
Contributor Author

kYc0o commented May 14, 2018

Superseded by #8545.

@kYc0o kYc0o closed this May 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: boards Area: Board ports CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Discussion: RFC The issue/PR is used as a discussion starting point about the item of the issue/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.

periph/rtc breaks nucleo-l152
3 participants