You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using a repurposed particle xenon board with circuitpython with a particle ethernet featherwing. I have the same issue as this - the ethernet connection works with a fixed IP but fails with dhcp. Shows an error:
* socket_available called on socket 4, protocol 2
* socket_available called on socket 4, protocol 2
* socket_available called on socket 4, protocol 2
* socket_available called on socket 4, protocol 2
* socket_available called on socket 4, protocol 2
* socket_available called on socket 4, protocol 2
*** Closing socket #4
Traceback (most recent call last):
File "code.py", line 108, in <module>
File "/lib/adafruit_wiznet5k/adafruit_wiznet5k.py", line 230, in __init__
RuntimeError: Failed to configure DHCP Server!
Code done running.
Here is my circuitpython code:
import board
import busio
import digitalio
import adafruit_requests as requests
from adafruit_wiznet5k.adafruit_wiznet5k import WIZNET5K
import adafruit_wiznet5k.adafruit_wiznet5k_socket as socket
print("Wiznet5k WebClient Test")
TEXT_URL = "http://wifitest.adafruit.com/testwifi/index.html"
JSON_URL = "http://api.coindesk.com/v1/bpi/currentprice/USD.json"
def get_mac(i2c_obj):
"Read MAC from 24AA02E48 chip and return it"
mac_addr = bytearray(6)
while not i2c_obj.try_lock():
pass
i2c_obj.writeto(0x50, bytearray((0xFA,)))
i2c_obj.readfrom_into(0x50, mac_addr, start=0, end=6)
i2c_obj.unlock()
return mac_addr
# Initialize SPI bus
spi_bus = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)
# Chip Select for Particle Ethernet FeatherWing
cs = digitalio.DigitalInOut(board.D5)
try:
# Initialize the I2C bus to read the MAC
i2c = busio.I2C(board.SCL, board.SDA)
# Read the MAC from the 24AA02E48 chip
mac = get_mac(i2c)
except (RuntimeError, OSError):
# Hard coded MAC if there is no 24AA02E48
mac = b"\xFE\xED\xDE\xAD\xBE\xEF"
# Initialize Ethernet interface with DHCP
eth = WIZNET5K(spi_bus, cs, mac=mac, is_dhcp=True, debug=True)
print(eth.detect_w5500())
print(eth.link_status)
# Initialize a requests object with a socket and ethernet interface
requests.set_socket(socket, eth)
print("Chip Version:", eth.chip)
print("MAC Address:", [hex(i) for i in eth.mac_address])
print("My IP address is:", eth.pretty_ip(eth.ip_address))
print(
"IP lookup adafruit.com: %s" %eth.pretty_ip(eth.get_host_by_name("adafruit.com"))
) # type: ignore
#eth._debug = True
print("Fetching text from", TEXT_URL)
r = requests.get(TEXT_URL)
print('-'*40)
print(r.text)
print('-'*40)
r.close()
print()
print("Fetching json from", JSON_URL)
r = requests.get(JSON_URL)
print('-'*40)
print(r.json())
print('-'*40)
r.close()
print("Done!")
The text was updated successfully, but these errors were encountered:
I am using a repurposed particle xenon board with circuitpython with a particle ethernet featherwing. I have the same issue as this - the ethernet connection works with a fixed IP but fails with dhcp. Shows an error:
Here is my circuitpython code:
The text was updated successfully, but these errors were encountered: