QUERY · ISSUE
RTC LSE/LSI selection
ports
The patches offered by @chuckbook aimed to solve two problems. The first was an issue with oscillator initialisation, now subject to a PR. The second, by my (incomplete) understanding of the code, aimed to select the LSE or LSI oscillator at runtime. The aim of this issue is to solicit comments on the relevance and design of this proposed feature, notably from @chuckbook.
The LSI oscillator is a low precision RC oscillator internal to the chip, while the LSE is an oscillator requiring external components to achieve substantially improved accuracy. The LSE is implemented with a 32.768KHz crystal on the Pyboard.
To initiate the discussion I'd like to raise the following questions.
- Does the LSI have merit other than in extremely cost constrained systems? Is it relevant to actual or proposed MicroPython target boards? Or does it have other relevance e.g. fault tolerance?
- If it is relevant, is there a reason for performing the selection at runtime, rather than making it a target specific compile time option?
- If done at runtime, when should selection occur? At initial power up? On soft boot or recovery from standby? Or must the choice be iterated or event driven and, if so, in response to what events?
- If hardware containing an LSE can fall back to the LSI at runtime, from the user perspective this is a fault condition. I would submit that this should raise an exception.
CANDIDATE · PULL REQUEST
Use LSI OSC for RTC clock when LSE is not detected
ports
- Fix rtc_init to use LSI for RTC clock source when LSE is not detected.