RTC/utime issues in 1.20.2.r2

  • Since updating to 1.20.2.r2 from 1.20.2.r0 it seems there are some strange issues going on between rtc and utime. It seems they are disconnected in some ways, and switched in others...

    For instance, the command rtc.init() effects utime commands but does not effect rtc.

    >>> from machine import RTC
    >>> import utime
    >>> rtc=RTC()
    >>> rtc.now()
    (1970, 1, 1, 0, 2, 24, 162482, None)
    >>> rtc.now()
    (1970, 1, 1, 0, 2, 24, 168121, None)
    >>> rtc.init((2014, 5, 1, 4, 13, 0, 0, 0))
    >>> rtc.now()
    (1970, 1, 1, 0, 2, 24, 180033, None)
    >>> utime.gmtime()
    (2014, 5, 1, 4, 13, 1, 3, 121)

    You can see that the init command set the time for utime, but not for rtc.

    Furthermore, if I use ntp_sync with rtc, it only syncs the rtc time, and completely messes up the utime:

     >>> rtc.ntp_sync('de.pool.ntp.org')
    >>> rtc.now()
    (2020, 12, 2, 2, 42, 27, 478607, None)
    >>> utime.gmtime()
    (2065, 4, 1, 6, 55, 26, 2, 91)

    Does anyone have any idea what's going on here?


  • Global Moderator

    This bug was fixed in the following version. If you update to the latest version using the firmware updater tool, the issue will be gone


  • Hello Support Team,
    I was wondering if you can provide any timing to correct this bug ?
    Is there a new firmware release available that correct it ?
    or.. the downgrade looks to be the best option in the short time.
    Thanks for your kind help

  • I temporarily got around it by adding rtc.init(rtc.now()) after using an ntp sync. This is a total bandaid fix, but it works for now.

    Also I noticed that the timezone is applied backwards now I used set timezone as -8, now it has to be +8. Thats fine with me, just noting this in case it was accidental.

  • Global Moderator

    Thanks for informing us about the issue. It seems to be related to the issue described here: https://forum.pycom.io/topic/6289/new-release-candidate-1-20-2-rc11-for-pygate. As we merged the pygate sourcecode into the same branch, we also copied over the bug, we are currently working on fixing the issue!

  • Sadly i don't know whats going on, but I'm in the same boat.
    I've reverted to 1.20.1 for the meantime.

Log in to reply

Pycom on Twitter