W5200 ethernet shield setup problem

Hi guys... I'm having a headache understanding this... So I'm running an ethernet shield dfrobot w5200 with a DcDuino (CH341) Uno... For some reason the following code does not work if I don't comment on pinMode( 8, OUTPUT); ... i.e I can't use that pin... Ethernet.hardwareStatus() == EthernetNoHardware will be true. But in another situation as webclient it's fine to set pinMode(8, OUTPUT);.... What am I missing ? thanks before..

#include <SPI.h>
#include <Ethernet.h>

#define W5200_nSCS 10 
#define LAMP9 9 
#define LAMP 8
#define LAMP7 7 
#define LAMP6 6
#define LAMP5 5
#define LAMP4 4
#define LAMP3 3
#define LAMP2 2

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192, 168, 2, 177);
IPAddress gateway(192, 168, 1, 1);
IPAddress subnet(255, 255, 255, 0);
IPAddress myDns(192, 168, 2, 1);

EthernetServer server(80);

void setup() {
  // put your setup code here, to run once:
  pinMode(W5200_nSCS,OUTPUT);
  pinMode(LAMP9, OUTPUT);
  //pinMode(LAMP, OUTPUT);
  pinMode(LAMP7, OUTPUT);
  pinMode(LAMP6, OUTPUT);
  pinMode(LAMP5, OUTPUT);
  pinMode(LAMP4, OUTPUT);
  pinMode(LAMP3, OUTPUT);
  pinMode(LAMP2, OUTPUT);
  Ethernet.init(W5200_nSCS);

  Ethernet.begin(mac, ip, myDns, gateway, subnet);
 
  // Open serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }
  if (Ethernet.hardwareStatus() == EthernetNoHardware) {
    Serial.println("Ethernet shield was not found.  Sorry, can't run without hardware. :(");
    while (true) {
      delay(1); // do nothing, no point running without Ethernet hardware
    }
  }
  if (Ethernet.linkStatus() == LinkOFF) {
    Serial.println("Ethernet cable is not connected.");
  }
  server.begin();
  Serial.print("connecting to ");
  Serial.println(Ethernet.localIP());
  Serial.println("...");
  
}

void loop() {
  // put your main code here, to run repeatedly:
   EthernetClient client = server.available();

}

the shield has

#define W5200_nSCS    10 
#define W5200_nRST    8 
#define W5200_PWDN    9

but i can rename W5200_PWDN 9 as LAMP9 ?

it the pin is connected to reset of the W5200 setting it LOW will reset the W5200.
but the schematics doesn't show pin 9 connected to reset. just inspect the traces on the board

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.