Arduino nano + microSD module + ethernet module does not assign IP address

by Pinguto   Last Updated August 14, 2019 11:25 AM

I would like to create a small web server to enable or disable devices via ethernet connection, except that the network module and the SD reader did not seem to work if connected simultaneously. That is, if I remove the SD reader the Ethernet module starts to work perfectly.

Below I leave the current version of code used for the tests:

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

#define SS_ETH 10
#define CS_microSD 9

byte mac[] = {
  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
};

IPAddress ip(192, 168, 1, 177);

EthernetServer server(80);

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

  pinMode(SS_ETH, OUTPUT);
  digitalWrite(SS_ETH, HIGH);

  Serial.println("Initializing SD card...");

  if (!SD.begin(CS_microSD)) {
    Serial.println("initialization failed!");
  } else {
    Serial.println("initialization done.");
  }

  // start the server
  server.begin();
  Serial.print("server is at ");
  Serial.println(Ethernet.localIP());
}


void loop() {
  // LOOP
}

output produced by the program via serial:

Initializing SD card...
initialization done.
server is at 255.255.255.255

If instead I remove the microSD from the reader and restart the circuit I get:

Initializing SD card...
initialization done.
server is at 0.0.0.0

Hardware:

Wiring diagram

  • pin 9 -> CS microSD
  • pin 10 -> SS Ethernet
  • pin 11 -> MOSI
  • pin 12 -> MISO
  • pin 13 -> SCK


Related Questions



EthernetUdp2 does not name a type

Updated August 25, 2016 08:10 AM

Arduino Accessing a web page

Updated August 27, 2016 08:10 AM


Arduino Ethernet not connecting to the Server

Updated July 01, 2019 07:25 AM