Controlled Reset of Ethernet on Arduino Ethernet

Hi ,

I am after some confirmation really on what I am doing is the correct way to do a controlled reset of the Arduino Ethernet.

The code in question is as follows:

// Ethernet reset line attached to pin 10
#define ETHERNET_RESET 10
// SD Card Disable
#define SD_RESET 4

 void reset_ethernet () { 

 pinMode(ETHERNET_RESET,OUTPUT);
 digitalWrite(ETHERNET_RESET,LOW);
 delay(250);
 digitalWrite(ETHERNET_RESET,HIGH);
 pinMode(ETHERNET_RESET,INPUT);
 delay(500);
 Ethernet.begin(mac);
 delay(1000);

}
void setup() {

 // Disable SD Card
 pinMode(SD_RESET,OUTPUT);
 digitalWrite(SD_RESET,HIGH);
 
 // start the Ethernet connection
 pinMode(ETHERNET_RESET,OUTPUT);
 digitalWrite(ETHERNET_RESET,HIGH);
 Ethernet.begin(mac);
 delay(1000);

}


void loop() {

// Do stuff and periodically reset the Ethernet. 


}

What do you expect from the code above? Resetting the Ethernet hardware (or the SD hardware)? If so, you want get what you intended. Pin 10 is the device select line of the SPI interface for the Ethernet chip (Wiz5100), pin 4 is the same for the SD card connector. Pulling the low for 250ms won't reset the devices.

Do stuff and periodically reset the Ethernet.

Why do you want to periodically reset the Ethernet? Is your hardware defect?

pylon:
What do you expect from the code above? Resetting the Ethernet hardware (or the SD hardware)? If so, you want get what you intended. Pin 10 is the device select line of the SPI interface for the Ethernet chip (Wiz5100), pin 4 is the same for the SD card connector. Pulling the low for 250ms won't reset the devices.

Do stuff and periodically reset the Ethernet.

Why do you want to periodically reset the Ethernet? Is your hardware defect?

Hi,

Thanks for the reply.

Essentially the sketch / device will work fine for days with no issues and then stop working, which I have tracked down to an issue with the Ethernet Chip.

I discovered that removing the Ethernet Cable , or power to the device fixes the issue. So I wanted to bring down the Ethernet chip in the code and start it again, effectively emulating a reset of the Ethernet device.

Are you sure it's a problem with the hardware? Have you checked the software? Post your sketch, maybe the forum finds an issue there. Which version of the IDE do you use?

pylon:
Are you sure it's a problem with the hardware? Have you checked the software? Post your sketch, maybe the forum finds an issue there. Which version of the IDE do you use?

It will go into a loop and not accept a DHCP Lease,

I can see the Router trying to send a valid response. It just doesn't accept / see it.

I am currently using 1.0.1

I assume it is not possible to enable a software reset of the Ethernet? Although I do see that pin 59 on the Wiznet is a Reset pin.

From their documentation.

RESET Pin# 59
This pin is active Low input to initialize or re-initialize
W5100.
By asserting this pin low for at least 2us, all internal
registers will be re-initialized to their default states.

DHCP was faulty in version 1.0 of the IDE, without a patch it would freezing during the DHCP request. This should be fixed in 1.0.1. Have you tried your sketch with the new IDE already?

It is possible but you have to change the board connections, disrupting the connection between the reset pin of the ATmega and the reset pin of the Wiz chip. Then you have to solder a connection from the reset pin of the Wiz chip to one of the digital outputs of the ATmega and you have to reset the Ethernet yourself after power up. I recommend against that because it's not solving your problem but giving you the chance of a few more.

pylon:
DHCP was faulty in version 1.0 of the IDE, without a patch it would freezing during the DHCP request. This should be fixed in 1.0.1. Have you tried your sketch with the new IDE already?

It is possible but you have to change the board connections, disrupting the connection between the reset pin of the ATmega and the reset pin of the Wiz chip. Then you have to solder a connection from the reset pin of the Wiz chip to one of the digital outputs of the ATmega and you have to reset the Ethernet yourself after power up. I recommend against that because it's not solving your problem but giving you the chance of a few more.

Thanks for the reply, the bug you refer to, what pull request was that?

As I applied most of them manually to 1.0.0, and have also tried it with 1.0.1 and it still occurs. Although less frequently admittedly.

I think it was that one:

http://code.google.com/p/arduino/issues/detail?id=605

Less frequently? How often do you send DHCP requests then? How often does it occur? Can you confirm that it's happening during the DHCP request?

Hi,

Thanks for the response again.

I can confirm that it is happening when it tries a DHCP Request. It just constantly asks for one and never sees' the offer.

It happens slightly less frequently than before, although that could just be a anomaly as sometimes its worse than others.

I'll continue testing with the latest version and ask if it doesn't appear to solve the issue.

Many thanks for your guidance and assistance.