← index #1546Issue #1559
Related · high · value 0.916
QUERY · ISSUE

RTC LSE/LSI selection

openby peterhinchopened 2015-10-28updated 2015-10-29
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.

  1. 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?
  2. If it is relevant, is there a reason for performing the selection at runtime, rather than making it a target specific compile time option?
  3. 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?
  4. 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 · ISSUE

stmhal: Improve RTC startup

closedby dpgeorgeopened 2015-10-30updated 2016-12-02
ports

We can improve the way stmhal starts up and initialises the RTC. This is tied into the way that the device resets, either by power up, hard reset, soft reset, or exiting standby mode. Some desired features:

  1. Detect exactly when RTC initialisation is needed, and when calendar reset is need. This may already be solved but needs to be tidied up.
  2. Support LSE/LSI detection on startup, see #1546.
  3. Perform LSE startup "in the background" while booting, because currently it can take up to 500ms.
  4. Provide a way to indicate to the user what the reset cause was. machine.reset_cause() and machine.wake_reason() are used for this.
  5. It would be good to set the CPU clock to it's previous value when exiting standby mode, since in low power applications you wan't a slower clock and having it 168MHz on boot (even for a few ms) wastes power. This is not really RTC related, but is related to detecting what kind of reset occurred.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied