Using LSI for RTC

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
marc4444
Posts: 14
Joined: Sat Aug 03, 2019 12:16 pm

Using LSI for RTC

Post by marc4444 » Mon Mar 15, 2021 7:57 pm

Hi All,

I'm trying to do a small board using the STM32F412CE. I'm using HSI and also LSI to save space on the board (very size constrained). I have something working for the most part, but am having significant issues with time accuracy. Over a 120 second period micropython is only counting 104 seconds (ie >10% off). I realise the LSI is inaccurate but I'm surprised it is this inaccurate and am wondering if I have a setting wrong?

I have the below setup on the RTC:

Code: Select all

#define MICROPY_HW_RTC_USE_LSE      (0)
#define MICROPY_HW_RTC_USE_US       (0)
#define MICROPY_HW_RTC_USE_CALOUT   (0)
Are there any other values I need to be setting to get LSI/my time to run accurately? I have a few boards set up and they all seem off by a similar amount (within a couple of percent).

I noticed the file linked below defines a value for LSI of 40KHz? This is incorrect according to the datasheet that suggests it runs around 32KHz. I tried updating this value but it made no difference.

https://github.com/micropython/micropyt ... onf_base.h

Any help on this would be really appreciated!
Thanks

Post Reply