-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Adafruit ESP32-S2 Feather hard crashes with wifi.radio.ping #5745
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
Comments
I've reproduced your result (safe mode after about 15 loops). But this ran a few hundred loops without issue: import supervisor
import time
import random
import wifi
import socketpool
import ipaddress
from secrets import secrets
SERVERS = ("1.1.1.1", "1.0.0.1",
"1.1.1.2", "1.0.0.2",
"8.8.8.8", "8.8.4.4",
"9.9.9.9", "149.112.112.112",
"208.67.220.220", "208.67.222.222",
"208.67.220.123", "208.67.222.123")
print("Connecting...")
wifi.radio.connect(secrets['ssid'],secrets['password'])
pool = socketpool.SocketPool(wifi.radio)
loop = 0
while True:
ipv4 = wifi.radio.ipv4_gateway
result = wifi.radio.ping(ipv4)
print(f'LAN {loop:>3} {supervisor.ticks_ms():>9} {str(ipv4):15} {result}s')
port = random.choice((53, 80, 443))
# ipv4 = ipaddress.ip_address(random.choice(SERVERS)) # this is fine if all SERVERS are IP addresses
ipv4 = ipaddress.ip_address(pool.getaddrinfo(random.choice(SERVERS), port)[0][4][0])
result = wifi.radio.ping(ipv4)
print(f'WAN {loop:>3} {supervisor.ticks_ms():>9} {str(ipv4):15} {port:>3} {result}s')
print()
loop += 1
time.sleep(1) I'm not sure at this point what would account for the difference. |
I would think it's not ping then, perhaps something with the global variables being set in-loop or issues with time? If I remove the global variables and just have the function return True or False, it crashes in 2 loops or 4 pings. I just got into python. I have no clue. |
Can you try to see what minimal example still produces the hard fault? Get rid of everything not essential to the demo. |
It hard faults with this code very fast import ipaddress
import wifi
# Get wifi details and more from a secrets.py file
try:
from secrets import secrets
except ImportError:
print("WiFi secrets are kept in secrets.py, please add them there!")
raise
modemIP = ipaddress.ip_address("192.168.100.1")
# count the number of pings
ping_counter = 0
print("Connect wifi")
wifi.radio.connect(secrets['ssid'],secrets['password'])
def check_connectivity():
ping_result = wifi.radio.ping(modemIP)
if ping_result is None:
print("ping modem fail")
else:
print("Was able to ping modem, should be good to go!")
while True:
ping_counter += 1
print("loops",ping_counter)
check_connectivity() But if you remove the function completely, it simply hangs: import ipaddress
import wifi
# Get wifi details and more from a secrets.py file
try:
from secrets import secrets
except ImportError:
print("WiFi secrets are kept in secrets.py, please add them there!")
raise
modemIP = ipaddress.ip_address("192.168.100.1")
# count the number of pings
ping_counter = 0
print("Connect wifi")
wifi.radio.connect(secrets['ssid'],secrets['password'])
while True:
ping_counter += 1
print("loops",ping_counter)
ping_result = wifi.radio.ping(modemIP)
if ping_result is None:
print("ping modem fail")
else:
print("Was able to ping modem, should be good to go!") |
Closing in favor of #5980 (dupe). |
Sorry, forgot about this one, I should have searched first. |
CircuitPython version
Code/REPL
Behavior
After 30 pings, the board hard faults into safe mode.
The same behavior happens when using larger time intervals between pings.
Description
No response
Additional information
Nothing else is attached to the board.
The text was updated successfully, but these errors were encountered: