W5100 web server does not start after a power outage


I am new and French-speaking … so thank you for being understanding.
That’s the problem.
I have a W5100 card with an arduino mega 2560.
I start a web server and a UTP directly in the setup.
When I load the program via USB, everything is fine, the UTP server and web server work perfectly: everything is perfect.
But when there is a power failure and the power comes back, no server works but the loop works for the other functions.
I add that the power is cut only on the arduino, the power remains on the switch and the router (if I cut the power on the switch at the same time it’s the same problem …).
on the W5100, the POWER led is on and the green FULL led flashes.
Then I have to push the reset button on the W5100 so that the servers reactivate and it works again.
Strange, if I connect a digital pin with a resistance of 1 Kohm to the reset pin and I push a button that puts this pin to ground, the reset of the arduino is also done correctly but the servers do not start.
It looks like the reset by pushing the reset button of the W5100 or by sending a LOW to the reset pin doesn’t produce exactly the same effect on the W5100.

Can someone please help me? Thank you in advance.
I’ve attached the full code but it’s big…

TCP_UTP_OK_definitif_2_modif.ino (40.4 KB)

lot of “chinese” boards have the problem with the reset after power loss.
In some cases this helped for me: Only_Dead_Fish_Go_With_The_Flow: Arduino Wiznet ethernet shield proper reset

Nowadays I just don’t buy the cheap ones any more.

Thank you for your response. I will test this solution in the coming days.

So I tested the Only_Dead_Fish_Go_With_The_Flow: Arduino Wiznet ethernet shield proper reset solution and nothing went right but I expected it (this is from 2010 and I guess the cards have evolved since then).
I tried to set the R e 10 Kohm to 5V instead of 3.3 V without any result.
I changed the value of the capacity from 10 nf, 47 nf, 100 nF, without result.
I also tried to put a capacity in // on the push button with these same values without result.
In short, I think I've done the trick!
Big problem these capacities, even when it works in some people can prevent a program from loading in the arduino card.

In my opinion, there are only 2 solutions to avoid this problem

  1. buy a good card W5100 (not a Chinese one) or take a W5200 or the problem seems not to appear but it is necessary to change the library and perhaps adapt the code ...
    Note: some write that with the latest version of the card, the problem is solved, but nobody says what is the latest version and how to detect it!

  2. my solution not very elegant but it works...
    the W5100 card has an sd card reader and I already use it for statistics: it works correctly.
    So I put a file called "shutdown" with the value 1 at the beginning.
    At the BEGINNING of the setup, I will read the file if the value is 0 then I will write the value 1 in the file instead of 0 and then I set the reset pin of the W5100 to ground via a relay card.
    At the END of the SETUP, I will write the value 0 in the file.
    When the program will restart after a power failure, an automatic reset of the W5100 card (and unfortunately of the arduino) will be done !