ethernet library softReset()

Hi!
I've noticed that in the ethernet library there is a private softReset() function.
There is a reason for have it private?
Would be nice be able to do a softreset of the eth interface in case of problems.
Thanks!

Does your sketch cause problems for the Ethernet Library ? then you should fix your sketch :wink:

No, my sketch has no problems, but would be nice to be able to reset the eth interface in case of connectivity problems. I need to do a project 24h/24 that heavily depend on network, and would be nice the ability to reset the eth interface in case of "not predictable" problems (like a switch port hang).

There is code to solve a problem with sockets that are not closed. I don't know if that is included in the library by now.

This is for example a webserver that checks the sockets: Arduino Playground - WebServerST

With a ESP32 module you can use Wifi at a higher level. That is probably more reliable.
160+ ESP32 Projects, Tutorials and Guides with Arduino IDE​ | Random Nerd Tutorials.

Can you tell about your project ? With code for those sockets and a good sketch it should run continuously.
A Arduino board with Ethernet shield can not be used for life-depending projects.

Hardware side i'm using an Industruino, that (i hope) must be quite stable. It uses a W5500 ethernet module, SAMD21 mcu, protections, etc.
And yeah, as a first arduino based project i've realised that maybe it's not the most stable system to have as base (only for example i've noticed that a lot of sketch and libraries does't neither take in account the millis() rollover after 49 days). But i want to try it, fixing what i find wrong.
The project monitor several thing of an home, some quite critical (like starting a gasoline generator in case of line failure and manage a pump of a well, for not allow an overflow an conseguent flood). For sure there are hardware failsafe strategies to overcome a software problem, but i want to made it as "strong" as possible.

Seriously ? 70 euros ? Industruino Proto kit | Industruino.
They don't give a schematic ? Is that a secret ? So I can not check how they made the pins 5V tolerant ?
The quality of the official Arduino board is very good and Arduino has no secrets.

The W5500 is still very low level Ethernet. Some routers don't like the data because it is so low level. That increases the chance of something going wrong.
You should not rely on this alone. You need a parallel system in a different way.
Arduino is to learn programming and for fast prototyping.

An Arduino with a GSM shield could be more reliable than the Ethernet shield.

Every sketch and every library should take in account the rollover of millis() !
Have you seen libraries that can go wrong when millis() does a rollover ?
The rule of thumb is not to try to handle the rollover. The Blink Without Delay shows how to use millis(): https://www.arduino.cc/en/Tutorial/BuiltInExamples/BlinkWithoutDelay.
The led with the Blink Without Delay will blink with perfect timing, even when millis() is right in the middle of a rollover.
The trick is subtracting unsigned integers.

My middle name could be millis(): GitHub - Koepel/Fun_with_millis: Small Arduino examples using the millis() function..

I've bought the IND I/O + eth module... Yes, no schematics, i've reverse enginered the part of the input/outputs and it's quite well done. Also done proper cuts on the board for isolate better. All optoisolated, dc-dc converters for separate the power section from the supply, etc.
Costs a bit, but has a lot of features all together. Needed a ready-to-use reliable product and seemed to have all what i've needed..

Whoa for the millis() thing! Never noticed that if the result of a math operation that give a negative number, put on an unsigned variable gave the correct result :roll_eyes:

In any case, wouldn't a softreset (for example, if i not ping neither my internal gateway) made the ethernet a bit more reliable?

I don't know what to think about the softReset(). That's why I gave the most obvious answer in reply #1.

It is used internally. If you want to use it, then you have to recognize a problem. I don't even see how you could determine that a problem can be solved with a soft reset. Sorry, I don't know what else to say about it.

I think a softreset like a "set to default" of the network interface (then obviosly you need to set ip and so). I will try to make the function exposed and i'll try it.
Thanks!

Have found something interesting: i can access the registry for sw resetting via W5100Class::writePHYCFGR_W5500, setting to 0 the lsb.
But more interesting, seem that the hardware reset pin of the w5500 is connected to the mcu.
As a test condition before trying a reset, i think to use a ping to my default gateway. If after a single reset i can't still ping, do nothing, as there is nothing than other resets can do.