Reset w5200 programmatically

Hi, I have a w5200 shield on my r3 uno sometimes i detect that the w5200 needs a reset with code. is there any function that i can call to reset the w5200 rather than clicking its reset button, I tried resetting the uno over all with code, but that doesn't help. I need a function to reset the w5200 its self.

I have a w5100, and it has never needed resetting with code, as long as the code the Arduino is running is good. Maybe you should start by posting your code that locks up.

FYI: If you have a DFRobot w5200 shield, you can reset it with a digital pin change. I believe the reset pin is connected to D8.

Hi the restart is for its ddos detection. If you spam it it looses its range. I found out how to detect it just need to reset it when its detected

Its a seeed v2 w5200

Serial.println("resetting");
digitalWrite(8, HIGH);
delay(2000);
digitalWrite(8, LOW);
delay(2000);
digitalWrite(8, HIGH);

does not reset it

the 2 pins closest to the sd pointing out at box j5, short those for a ms and it resets.

What do you mean by ddos makes it lose its range? Range?

edit: If it is in fact a DDoS attack, resetting the ethernet shield will not help. The attack will resume after the reset. My web server code will survive a DDoS attack without the need of a reset.

But it does help it kicks back on in a second. And by range i mean the ip numbers start to drain until it reaches 0.0.0.0. Well my method good but lets see ur code does it get the html from the sd? Thanks. Id like to view urs

What IP numbers start to drain? Your shield is assigned only one IP address, and it shouldn't change to 0.0.0.0.

Here is a link to my server code. The first uses the SD card for files, and the second one is just a form.
http://playground.arduino.cc/Code/WebServerST

nice sketch :slight_smile: here is my final code:

#include <SD.h>
#include <SPI.h>
#include <EthernetV2_0.h>
#define W5200_CS  10
#define SDCARD_CS 4
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192,168,1,177);
EthernetServer server(80);
File myFile;

void setup(){
Serial.begin(9600);
Serial.print("Initializing SD card...");
pinMode(W5200_CS, OUTPUT);
pinMode(7, OUTPUT);
pinMode(6, OUTPUT);
//disconnect the W5200
digitalWrite(W5200_CS,HIGH);
pinMode(SDCARD_CS,OUTPUT);
if (!SD.begin(SDCARD_CS)) {
Serial.println("plzz re-insert sd!");
return;
}
Serial.println("sd active!");
Ethernet.begin(mac, ip);
server.begin();
Serial.print("server is at ");
Serial.println(Ethernet.localIP());
}
void loop(){
if(Ethernet.localIP()[0] != 192){//reset
digitalWrite(7,HIGH);
digitalWrite(6,HIGH);
}
EthernetClient client = server.available(); 
if (client){                                                     
Serial.println("client");
boolean currentLineIsBlank = true;
while (client.connected()) {
if (client.available()) {
char c = client.read();
if (c == '\n' && currentLineIsBlank) {
client.write("HTTP/1.1 200 OK");
client.write("Content-Type: text/html");
client.write("Connnection: close");
}
myFile = SD.open("index.txt");
delay(2);
if (myFile) {
while (myFile.available()) {
client.write(myFile.read());
}
delay(2);
client.stop();
delay(2);
myFile.close();
delay(2);
}else{
}
if (c == '\n') {
Serial.println("true");
currentLineIsBlank = true;
} else if (c != '\r') {
Serial.println("false");
currentLineIsBlank = false;   
}
}
}
}  
}

If you take a look at the reset point it pin 6 and 7 trigger a relay to joint the j5 pins nearest to the sd card causing a quick reset.
you can now attempt to ddos indocastles.com
but just for trying out the arduinos protection. this is my backup site for when my rack server kicks off.

That domain does not appear to be an Arduino server. It is not responding like your code should. Are you certain it isn't already crashed?

edit: Why don't you try crashing or DDoS mine?
http://68.99.58.117

Now you are cooking! That "little sissy girl" try earlier wasn't anything. I can do better than that in my sleep! :wink:

Its a nameserver i pay for off namecheap.com pointed at my ip hosted on arduino
I cant crash yours how did u do subdomains from sd tho?

Subdomains? I don't do subdomains. I do have subdirectories on the SD card.

Don't feel bad. Nobody has been able to crash my server code yet. Bear in mind it is a w5100. Only 4 sockets.

edit: and even after the DDoS try, I still have all sockets available. I guess you have figured that out though.

subdomain subfolder subdirectory is the same thing though like sub.dir.com = dir.com/sub

Ok. I use subdirectories on the SD card. It is part of the code I posted a link to above.

edit: If you don't expose your ethernet shield sketch to the internet, you should be ok. Without the error checking and fault tolerance that I have in my server code, expect it to lock up now and then. Port scanners and hackers will get you.

FYI: I can crash your code in a couple different ways in just a few seconds. I can send your code into an endless loop, or eat all your sockets.

I mean you can try :PP but its not going to happen you can take down my isp but not my server

I'm talking about your Arduino server code. I haven't seen it on the internet yet.

Read your inbox

I did, and I don't know.