micropython-tinyrtc-i2c icon indicating copy to clipboard operation
micropython-tinyrtc-i2c copied to clipboard

DS1307 and HALT method

Open michalowskil opened this issue 2 years ago • 1 comments

Not sure is it a bug or not. When I disconnect and then connect battery DS1307 is resetting to (2000, 1, 1, 0, 0, 0, 0, 0) which is fine, but it is not ticking. When I run ds.halt() it returns FALSE. Clock start ticking when I manually set FALSE like this: ds.halt(False).

Shouldn't ds.halt() return TRUE when clock is halted?

I'm not using a module. I just connect DS1307 with oscillator and resistors like this: scheme

michalowskil avatar Jan 17 '23 14:01 michalowskil

Needs further investigation. I don't have one of these modules handy for the next few weeks.

Expected behaviour: ds.halt() - return the current value (self._halt), without reading the register ds.halt(True) - read the DATETIME_REG register, set bit 7 = 1, write back to the register ds.halt(False) - read the DATETIME_REG register, set bit 7 = 0, write back to the register

If the default halt bit 7 value in the register is True, I should update the constructor to set self._halt = True, or perhaps just make the halt() method always read the register and not try to cache it.

mcauser avatar Jan 18 '23 03:01 mcauser