micropython-Chinese-Community/mpy-lib

RTC Calibration

Gbouna opened this issue · 5 comments

Thanks for the library, its been helpful for my application.

I am trying to use your library to get my RTC working with OpenMV Cam H7, I have read about the calibration of RTC which basically set the the RTC time and stores it in the battery-backed memory. So if a backup cell is used the RTC will run accurately in the event of a power outage.

I was wondering how do you I can set the RTC time and store it in the memory with your library. I will appreciate any suggestion on how to do this.
Thanks.

Which chip do you use?

I am using OpenMV Camera H7.

What I just want to do is to be able to set the RTC time according to the current time and save it to the back up memory so that when there is power outage, the time will still be accurate since the RTC has a back up battery.

Any idea on how to do this will be appreciated

Which RTC chip do you used with OpenMV Camera H7?

I am using DS3231

DS3231 use registry 10h to calibration RTC (Aging Offset). I didn't implement the calibration function alone, but you can use setReg function to calibration RTC, such as:

ds = DS3231.DS3231(i2c)
ds.setReg(0x10, val)

image