← index #1546Issue #5549
Related · high · value 0.873
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

Pyboard D RTC calibration does not work

closedby peterhinchopened 2020-01-18updated 2020-01-20
port-stm32

On a Pyboard 1.1 the following works:

>>> from pyb import RTC
>>> rtc=RTC()
>>> rtc.calibration()
0
>>> rtc.calibration(1)
>>> rtc.calibration()
1
>>> rtc.calibration(-1)
>>> rtc.calibration()
-1

On a Pyboard D SF2W and on an SF6W I get

>>> from pyb import RTC
>>> rtc=RTC()
>>> rtc.calibration()
0
>>> rtc.calibration(1)
>>> rtc.calibration()  # +ve values seem to be negative sign extended
-511
>>> rtc.calibration(-1)  # It likes -ve values
>>> rtc.calibration()
-1
>>> 

Actual RTC behaviour matches the reported values - i.e. passing 1 yields a frequency which is substantially in error. This behaviour is odd as the definition of the RTC_CALR register appears identical for all three chips.

While the examples I have show good RTC performance the data for the SiT1533 oscillator indicates that calibration may sometimes be required (up to 20ppm error).

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