rtc.synced() always returns False on FiPy 1.20.0.rc0 and 1.20.0.rc1
-
Hi
A test program to reproduce the issue (on FiPy) is:
import machine import socket from network import WLAN import time import os rtc = machine.RTC() internet_access = False def check_internet(): packet=b'$\x1a\x01\x00\x00\x01\x00\x00\x00\x00\x00\x00'+\ '\x03www\x06google\x03com\x00\x00\x01\x00\x01' for timeout in [1,5,10]: length = 32 # DNS query and response packet size s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.settimeout(timeout) try: s.sendto(packet,('8.8.8.8',53)) except: return False try: res = s.recv(length) if len(res) == length: print('Internet access TRUE') return True # DNS response size OK except OSError: # Timeout on read: no connectivity. return False finally: s.close() return False print('FW:',os.uname()[2]) wlan = WLAN(mode=WLAN.STA, power_save=True) wlan.connect('Skynet', auth=(3, '12345678'), timeout=5000) while not wlan.isconnected(): print('Connecting to WIFI') time.sleep(1) print('WIFI connected') time.sleep(1) #Sync RTC via network #Loop till RTC is not synced and till device is running. i = 0 while not rtc.synced(): print('RTC not synced') if not internet_access: print('Checking internet access') internet_access = check_internet() if i < 1 and internet_access: i = 10 rtc.ntp_sync("pool.ntp.org") print('Current time:',time.gmtime()) print('Synchronizing time from pool.ntp.org') time.sleep(1) i -= 1 print('RTC synced')
Output on 1.19.0.b5:
FW: 1.19.0.b5 Connecting to WIFI Connecting to WIFI Connecting to WIFI Connecting to WIFI Connecting to WIFI WIFI connected RTC not synced Checking internet access Internet access TRUE Current time: (1970, 1, 1, 0, 0, 6, 3, 1) Synchronizing time from pool.ntp.org RTC not synced RTC not synced RTC not synced RTC not synced RTC not synced RTC not synced RTC synced
It works!!!
But on 1.20.0.rc0,
FW: 1.20.0.rc0 Connecting to WIFI Connecting to WIFI Connecting to WIFI Connecting to WIFI WIFI connected RTC not synced Checking internet access Internet access TRUE Current time: (1970, 1, 1, 0, 0, 5, 3, 1) Synchronizing time from pool.ntp.org RTC not synced RTC not synced RTC not synced RTC not synced RTC not synced RTC not synced RTC not synced RTC not synced RTC not synced RTC not synced Current time: (2018, 12, 19, 4, 52, 4, 2, 353) Synchronizing time from pool.ntp.org RTC not synced RTC not synced RTC not synced RTC not synced RTC not synced RTC not synced RTC not synced
Even though the time is synced, rtc.synced() is still returning False.
Similar on 1.20.0.rc1:
FW: 1.20.0.rc1 Connecting to WIFI Connecting to WIFI WIFI connected RTC not synced Checking internet access Internet access TRUE Current time: (1970, 1, 1, 0, 0, 4, 3, 1) Synchronizing time from pool.ntp.org RTC not synced RTC not synced RTC not synced RTC not synced RTC not synced RTC not synced RTC not synced RTC not synced RTC not synced RTC not synced Current time: (2018, 12, 19, 4, 59, 41, 2, 353) Synchronizing time from pool.ntp.org RTC not synced RTC not synced RTC not synced RTC not synced RTC not synced RTC not synced RTC not synced RTC not synced
-
@serafimsaudade glad to hear it :D
-
@paul-thornton Hi,
I'm testing the 1.20.0.rc4 and the rtc-synced is working ok.
-
Just to follow up on this. Yesterday 1.20.0.rc4 launched that should solve this issue. If you can reproduce it on this or later firmwares please let me know.
-
Same issue happening on my GPy. Further to this I've noticed that often when I upload to the pycom and run it won't get the current datetime and forever loop with the minimum datetime. However, when I press the button to reboot the pycom. It normally will pick up the latest datetime but synced() will still show false.
-
@testos If you do not think your GPS issue is related to the synced flag for NTP/RTC I suggest that you create a separate thread on the forum (or report it on https://github.com/pycom/pycom-micropython-sigfox/issues).
-
FWIW, also reported on GitHub: v1.20.0.rc2: machine.RTC.synced() always returns False (LoPy)
-
Hello,
I know that's not necessarily related to RTC, but I'm having issue with the Fipy and the GPS using 1.20.0.rc0, 1.20.0.rc1, 1.20.0.rc2, 1.20.0.rc3 and L76GLNS.py, it just never get a fix connection. It was working well with 1.17.
the version : (sysname='FiPy', nodename='FiPy', release='1.20.0.rc3', version='v1.9.4-c5b0b1d on 2018-12-17', machine='FiPy with ESP32', lorawan='1.0.2', sigfox='1.0.1');
Thanks by advance.
-
@reidfo super usefull to know. Thanks.
-
@paul-thornton Thanks. I can confirm the last version that ntp_sync worked in was 1.19.0.b4. b5 is where it broke for me.
-
thanks for the report I can reproduce this on 1.20rc3 (on a Gpy in this instance). and confirm it was working in 1.18. I've let the firmware team know.
-
Broken in 1.20.0.rc2 and 1.20.0.rc3 as well.
-
The GPy have the same issue.