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
Sometimes Arduino is running fine for days but after power-up or brief loss of power (caused for example by undervoltage), ethernet connection is lost. Ethernet connection is restored only after you press the RST button on the ethernet shield. The issue has been identified and described in detail by the community for example [here](https://chrisramsay.co.uk/posts/2015/08/some-fun-with-a-cloned-arduino-and-w5100-ethernet-shield/), [here](https://www.youtube.com/watch?v=9ZBeprOqC3w), [here](http://tigawd.blogspot.com/2015/05/arduino-uno-clone-and-w5100-ethernet.html) and also [here](https://www.hobbyist.co.nz/?q=ethernet-shield-w5100).
6
+
7
+
## Cause
8
+
9
+
Arduino Ethernet shields use HW method to reset (initialize) the W5x00 chip. They have the W5x00's RST pin hard wired to Arduino's RST pin. If Arduino is reset, the W5x00 should be reset also. However, normal reset time of the Arduino is too short. The Arduino microcontroller has a 65 millisecond powerup/reset delay (the longest available to be set by the fuses and bootloader) but the W5x00 chip expects longer pull-down of the RST pin. As a result, the W5x00 chip fails to reset (and initialize) properly.
10
+
11
+
The problem is poor ethernet shield design. This issue is not specific to cheap ethernet shields (clones), but exists in all variant of the Arduino Ethernet shields.
12
+
13
+
## Solution
14
+
15
+
You can find different solutions on the internet - most of them require soldering additional capacitor (and resistor) to the Arduino Ethernet shield. However, there is much easier and more elegant solution: use SW method to reset / initialize the W5x00 chip.
16
+
17
+
### 1. Cut the connection between W5x00's RST pin and Arduino's RST pin.
18
+
19
+
We need to isolate the W5x00's reset signal when the boards are connected together. Keep in mind that there are actually 2 connections between W5x00's RST pin and Arduino's RST pin. You need to cut both of them, simply by bending out or cutting appropriate pins:
20
+
21
+
-**Bend the RESET pin on the Ethernet shield.**
22
+
-**Bend one pin within the ICSP connector on the Arduino board** (see below)
### 2. Connect W5x00's RST pin to an unused Arduino pin 7
27
+
28
+
Attach the ethernet shield to the Arduino board. Use wire (male/male jumper wire) to connect RESET pin and pin 7 on the Ethernet shield.
29
+
30
+
### 3. Reset the W5x00 chip programmatically
31
+
32
+
Within your Arduino sketch, pull down pin 7 to reset (initialize) the W5x00 chip. Since the HW method to reset the W5x00 chip will no longer work (W5x00 will not reset/initialize automatically after power up), you **++must++** pull down pin 7 before calling Ethernet.begin().
33
+
34
+
If you are using one of my Arduino projects ([Modbus RTU ⇒ Modbus TCP/UDP Gateway](https://github.com/budulinek/arduino-modbus-rtu-tcp-gateway), [Arduino Sensors UDP Gateway](https://github.com/budulinek/arduino-sensors-udp-gateway) or [Arduino Altherma UDP Controller](https://github.com/budulinek/arduino-altherma-controller)), the software method to reset (initialize) the W5x00 chip is already implemented within my code.
35
+
36
+
If you want to reset the W5x00 chip programmatically in your own sketch, use this code to pull down pin 7 before calling Ethernet.begin(). This is the code which works for me:
constbyteCTRL_ID[] = { 0xB4, 0x10 }; // LAN adapter ID in 0x31 payload bytes 7 and 8
83
84
84
85
constbyteMAC_START[3] = { 0x90, 0xA2, 0xDA }; // MAC range for Gheo SA
85
-
constbyteETH_RESET_PIN=7; // Ethernet shield reset pin (deals with power on reset issue on low quality ethernet shields)
86
+
#defineETH_RESET_PIN 7 // Ethernet shield reset pin (deals with power on reset issue on low quality ethernet shields) \
87
+
// Comment out to disable the functionality
86
88
constuint16_tETH_RESET_DELAY=500; // Delay (ms) during Ethernet start, wait for Ethernet shield to start (reset issue on low quality ethernet shields)
87
89
constuint16_tWEB_IDLE_TIMEOUT=400; // Time (ms) from last client data after which webserver TCP socket could be disconnected, non-blocking.
88
90
constuint16_tTCP_DISCON_TIMEOUT=500; // Timeout (ms) for client DISCON socket command, non-blocking alternative to https://www.arduino.cc/reference/en/libraries/ethernet/client.setconnectiontimeout/
0 commit comments