Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSError: [Errno 116] ETIMEDOUT on RPi PicoW #29

Open
bobkster opened this issue Jun 11, 2023 · 1 comment
Open

OSError: [Errno 116] ETIMEDOUT on RPi PicoW #29

bobkster opened this issue Jun 11, 2023 · 1 comment

Comments

@bobkster
Copy link

I have a Raspberry Pi Pico W Connected to a PiCowBell Proto - no other connections or modifications.
I am running CircutiPython latest stable for RPi Pico W: adafruit-circuitpython-raspberry_pi_pico_w-en_US-8.1.0.uf2 (downloaded 5/28/2023).
I have one lib installed: adafruit_ntp.mpy (from adafruit-circuitpython-bundle-8.x-mpy-20230610)

Summary:

  1. I get an "OSError [Errno 116] ETIMEDOUT" when running immediately following a reset.
  2. Running again, the code runs correctly.
  3. Following are: a) code.py, b) and c) output of two runs

Please let me know if there is any other data you need, and as I am new to CircuitPython and PicoW, please provide instructions.
if this is an existing issue, please direct me to it and I'll follow that.
Note: this does not appear [to me] to be: #19, though it has similarities.

Thank you.


a) code.py:
import os
import wifi
import socketpool
import time
import adafruit_ntp
import rtc

print("*** Initial time:", time.localtime())

ssid = os.getenv('CIRCUITPY_WIFI_SSID')
passwd = os.getenv('CIRCUITPY_WIFI_PASSWORD')

wifi.radio.connect(ssid, passwd)
pool = socketpool.SocketPool(wifi.radio)
ip = wifi.radio.ipv4_address

print("*** Connected to WiFi:", ip)

ntp = adafruit_ntp.NTP(pool, tz_offset=-6) # Denver
rtc.RTC().datetime = ntp.datetime

print("*** Current time:", time.localtime())


b) REPL output immediately following a RESET via PyCowBell (viewed using Mu editor):
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
*** Initial time: struct_time(tm_year=2020, tm_mon=1, tm_mday=1, tm_hour=0, tm_min=0, tm_sec=11, tm_wday=2, tm_yday=1, tm_isdst=-1)
*** Connected to WiFi: 192.168.1.131
Traceback (most recent call last):
File "code.py", line 30, in
File "adafruit_ntp.py", line 80, in datetime
OSError: [Errno 116] ETIMEDOUT

Code done running.


c) Running a second time via Ctrl-D, REPL output:

soft reboot

Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
*** Initial time: struct_time(tm_year=2020, tm_mon=1, tm_mday=1, tm_hour=0, tm_min=7, tm_sec=19, tm_wday=2, tm_yday=1, tm_isdst=-1)
*** Connected to WiFi: 192.168.1.131
*** Current time: struct_time(tm_year=2023, tm_mon=6, tm_mday=10, tm_hour=19, tm_min=53, tm_sec=6, tm_wday=5, tm_yday=161, tm_isdst=-1)

Code done running.

@bobkster
Copy link
Author

bobkster commented Jun 17, 2023

I have been able to workaround this issue using try/expect and adding 2s sleep during the expect:
try: wifi.radio.connect(ssid, passwd) # connect to your SSID except ConnectionError as ce: print("ConnectionError:", ce, ", trying again!") time.sleep(2) wifi.radio.connect(ssid, passwd)
Thus far, this has been successful after numerous resets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant