Go Down

Topic: Arduino ethernet board Rev3 problem with ethernet and SD reader (Read 564 times) previous topic - next topic

Arruzzoli

Hi 2 all,

I have an arduino ethernet board Rev3 and i'm trying unsuccesfull to use in the same code ethernet (as web client) and SD (to read data) when  initialize  the SD then ethernet don't work. I searched on the web and i found many topics about change in HIGH mode  pin 4 (SD) or 10 (ethernet) to disable one and work with other but nothing todo. If i just  declare   sd.h in my code  the ethernet don't work correctly and often arduino restart. 

Help please ! :smiley-sad-blue:




SurferTim

Here is the setup that works when I want to use them together. Upload the code, then power down the Arduino for a few seconds to clear past stuff. Start it up and open the serial monitor.
Code: [Select]
#include <SD.h>
#include <SPI.h>
#include <Ethernet.h>

// this must be unique
byte mac[] = {  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

void setup() {
  Serial.begin(9600);

  // disable w5100 SPI while starting SD
  pinMode(10,OUTPUT);
  digitalWrite(10,HIGH);

  Serial.print("Starting SD...");
  if(!SD.begin(4)) Serial.println("failed");
  else Serial.println("ok");

  Serial.println("Starting w5100...");
  if(!Ethernet.begin(mac)) Serial.println("failed");
  else Serial.println(Ethernet.localIP());
  digitalWrite(10,HIGH);

  Serial.println("Setup complete");
}

void loop() {

}

Do you get ok and an ip?

Go Up