One other very odd thing I saw again yesterday was the WIZ850io gets stuck in a mode with both LEDs apparently on solid. I can reset the Teensy, which has code to drive the WIZ850io line low for 1 msec (W5500 datasheet asks for 500 usec min Reset(L)). During this startup period after the HW reset, the LEDS go out but then when my
TempServer app starts both LEDs come on solid again and the app can't get any data out the WIZ850io.
The only cure is to pull the power. Then TempServer app starts up again, only now it can init the WIZ850io and carry on, until it fails with socket issues. Tempserver is a minimal change to the provided demo Ethernet>Webserver which I should go back to. Tempserver/Webserver makes a very different use of sockets than say
NTP_clock_set which runs for days.
So somehow it's possible to get the WIZ850io into a state where even a HW reset input won't recover it, it needs a
POR. I'm baffled and concerned what this could be. I've seen this "both LEDs on, can't recover without power cycle" twice now, the other time running
DhcpStressTest-T3 which normally runs for days, but does have a fair amount of exception recovery built in (and apparently I can't even be consistent about program naming, sorry about that). When it failed this time the IP address it reportedly got back was 0.0.0.0 but not according to my router, so it seems to be a WIZ850io communication failure, not a DHCP server failure.
In EthernetClass socket.cpp, line 42 and following, normally (e.g. NTP_clock_set) I see only socket begin (step 1) execution. I have Step 3 uncommented. When things fail (TempServer) there is a blast of repeated attempts at Step 3 and the response to a client seems to timeout due to client.println() inability to get any data out in a response from Teensy. Teensy doesn't hang, it still outputs temperature to an attached ILI9341 display.
If the Arduino Keepers want things to be "good for beginners", a starting point would be to have superb documentation of libraries so that you could learn a lot by reading the code. There's not a single function comment explaining socketBegin(). This file has 12 "gotos" in it...
goto generally not a Good Thing. There are lines such as #80:
delayMicroseconds(250); // TODO: is this needed??
with no explanation of why it is there or what the issues may be: nothing to help anyone else pursue this question to a useful end.
OK, end of mini-rant. For now.
I have a lot of the socket.cpp debug printf uncommented (if only we had a
real debugger!) so I can see where the trouble may lie. I'll add output of socket use. My goal is to get the code I need (interface to another machine) working reliably and figure out what is causing socket issues under specific circumstances, and fix or patch around it.
If anyone wants to see the mangled version of Ethernet I've forked, it's
here.
This probably is not the best thread for discussion of Ethernet/WIZ850io socket issues...