Settime() function issue in ESP32

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
hetvishah08
Posts: 7
Joined: Tue Jan 22, 2019 12:00 pm

Settime() function issue in ESP32

Post by hetvishah08 » Wed Jan 30, 2019 8:56 am

I am trying to receive current time for an application on ESP32 DevkitC. I am using Ethernet as my network and using ntptime library and settime() function. I keep on getting this error.
Code and Debug Messages:

Code: Select all

>>> from machine import Pin
>>> import network
>>> l = network.LAN(mdc = Pin(23), mdio = Pin(18), power = Pin(17), phy_type = network.PHY_LAN8720, phy_addr=1)
I (65320) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
>>> l.active(1)
I (84810) emac: emac start !!!
I (84810) emac: emac resetting ....
I (84820) emac: emac reset done
I (84830) emac: emac start success !!!
I (84830) network: event 20
True
>>> I (88830) emac: eth link_up!!!
I (88830) network: event 22
I (89720) event: eth ip: 192.168.29.71, mask: 255.255.255.0, gw: 192.168.29.1
I (89720) network: event 24
>>> l.ifconfig()
('192.168.29.71', '255.255.255.0', '192.168.29.1', '192.168.29.1')
>>> from ntptime import settime
I (123450) modsocket: Initializing
>>> settime()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "ntptime.py", line 30, in settime
  File "ntptime.py", line 22, in time
OSError: [Errno 110] ETIMEDOUT
I want to receive current time so that i can check it for some condititons to work. How do I get it?

Post Reply