-
Notifications
You must be signed in to change notification settings - Fork 35
[w5500] DHCP hang and IndexError on static ip's. #67
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
Can you reproduce this without the intervening driver? That would make it easier for others to replicate and debug. |
I disabled mpy-cross optimization and it now produces different results: With dhcp it actually works now:
However manual still is broken:
Tried with dns being 1.1.1.1, 192.168.1.1 (ip -> isp's), 192.168.1.230 (trustworthy pihole) |
Replicated on import board
import busio
import digitalio
from adafruit_wiznet5k.adafruit_wiznet5k import WIZNET5K
import adafruit_wiznet5k.adafruit_wiznet5k_socket as socket
import adafruit_requests as requests
SPI0_SCK = board.GP18
SPI0_TX = board.GP19
SPI0_RX = board.GP16
SPI0_CSn = board.GP17
W5x00_RSTn = board.GP20
spi = busio.SPI(SPI0_SCK, MOSI=SPI0_TX, MISO=SPI0_RX)
cs = digitalio.DigitalInOut(SPI0_CSn)
interface = WIZNET5K(spi, cs, is_dhcp=False, debug=True)
print(interface.detect_w5500())
print(interface.link_status)
interface.ifconfig = ((192, 168, 6, 249), (255, 255, 252, 0), (192, 168, 4, 1), (1, 1, 1, 1))
requests.set_socket(socket, interface)
r = requests.get("http://wifitest.adafruit.com/testwifi/index.html")
print(r.status_code, r.reason, r.content) The device does not show up in the router. Output (ends with exception rather than infinite loop): |
I am very concerned as to why it broke even more when it was optimized.. |
Calling |
@bill88t Can you re-test and confirm the code from PR 81 solves this issue? |
Really busy these days, I will try to get it tested by tomorrow. |
Retested with latest commit. Using Anecdata's code snippet. The results differ is the module has been Files as By editing With
The device is responding to pings just fine through that ip though. Trying without On
Loops forever.
It actually worked! So something is definately wrong with optimisation and static ip's are still broken. |
Oh wait #81, that isn't merged, I tested latest commit, brb. |
Both static and dhcp work with #81, with |
Can you describe the .mpy optimization process? |
To sum it up |
Using the 8.x-mpy build artifacts from PR 81 with a WIZnet W5100s hat (chip detect changed to
I'll try it with a W5500... |
An |
Oh I didnt see it has mpy build artifacts, I will try them tomorrow for verification. It could be a matter of -O3. |
Same 8.x-mpy artifacts and code, with Adafruit Ethernet FeatherWing:
|
Everything works for me too with the 8.x-mpy build artifacts. By further testing I determined that optimisation level >0 is what breaks it. So the remaining issues are due to mpy-cross. |
Using any nonzero This is not compatible with the way that wiznet5k uses assert statements, because it depends on the assert statement's expression being evaluated for correct operation. For example, assert self._w5100_init() == 1, "Failed to initialize WIZnet module." Because Adafruit's circuitpython-build-tools never specify a However, fixing the way asserts are used (probably by replacing them with a variation on If you agree with this analysis, I recommend either re-titling and updating the initial comment on this issue, or closing it and opening a fresh one to reflect the conclusion. |
I have closed this issue in favor of #83, which says code needs a rewrite. |
Hi Dan, the original code was failing even in a |
This issue should only be closed by the merge of #81. However adafruit/circuitpython#7363 should stay closed. |
OK, I'll approve 81, which will close this issue when merged. |
Using this as a man-in-the-middle driver.
With 5f501fd loaded on the board.
The w5500 device I am using is a rando external w5500 i found for cheap:

(kapton tape on the bottom for safety)
With dhcp:
Without dhcp:
Same on cp 8.0-latest.
The text was updated successfully, but these errors were encountered: