nspsck / STM32F411CEU6_BlackPill_Micropython

MIT License
5 stars 1 forks source link

RTC poor accuracy #9

Closed davefes closed 6 months ago

davefes commented 7 months ago

Trying to use pyb.stop(), but after a test run of 1 hour I got a "delay" of 1 hour 5 minutes. Reading through rtc.calibration for the PYboard it appears you can adjust it by +/-500ppm. This is only +/- 2 seconds.

In mpconfigboard:

// BlackPill has an optional 32kHz crystal

define MICROPY_HW_RTC_USE_LSE (1)

define MICROPY_HW_RTC_USE_US (0)

define MICROPY_HW_RTC_USE_CALOUT (1)

Doesn't that say it should be using the 32KHz oscillator?

nspsck commented 7 months ago

Ugh, I do not have any experience regarding the rtc module, all I can do is to explain to you what these macros are about:

MICROPY_HW_RTC_USE_CALOUT : Everything it does is to enable or disable the calibration output when your given value is out of range, and nothing more.

MICROPY_HW_RTC_USE_LSE: This enables the 32K crystal. Which is extenal. Hence Low Speed External.

MICROPY_HW_RTC_USE_US: This add a subseconds value to the function rtc.datetime(). And this is all it does.

Neither of these 3 macros shall have anything to do with the real time clock accuracy itself, at least in theorie for me.

nspsck commented 7 months ago

but after a test run of 1 hour I got a "delay" of 1 hour 5 minutes.

Also, what I have understood is, that your blackpill is deplayed by 1 hour 5 minutes, so it took totally 2 hours and 5 minutes to recover from pyb.stop(). Is that correct?

davefes commented 7 months ago

Sorry ... rtc.wakeup(3600000) took 1 hour 5 minutes. Probably similar to an ESP32 but I thought the BlackPill used the 32KHz crystal.

Thanks for the information.

davefes commented 7 months ago

Ouch! Another trap ... I was testing on a "pirated" board. On a WeAct board it was within the +/- 2 second window after 1 hour, so one could calibrate that board.

davefes commented 6 months ago

Finally closed. Didn't mean to click the emoji!