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

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>
#include "SdFat.h"

SdFat SD;

#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:

  • Arduino Nano
  • W5100 ethernet module ( Ebay )
  • microSD reader ( Ebay )

Wiring diagram:

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

The only discussion that seems to be relevant to the topic in question, considering that by disconnecting the MISO pin of the SD card the W5100 module starts working, it is the following: https://forum.arduino.cc/index.php?topic=276274.0

Do you have any ideas? Did I miss something? I’ve been trying to make them communicate at the same time for weeks… :disappointed_relieved: