Ethernet.begin results in localIP of 0.0.0.0

Thanks in advance for taking a look at my post; this problem has been driving me up the wall.

I'm attempting to connect to my local network (to connect to a MQTT server) using a Controllino MEGA, which, according to the product's website, utilizes a W5100 chip for networking. As the W5100 chip does not have a fixed MAC address, I have been attempting to utilize the Ethernet library's capability of using a non DHCP version of Ethernet.begin(). When I attempt to do so, the localIP I'm being shown is 0.0.0.0.

This is the relevant code segment:

byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
IPAddress ip = IPAddress(10,1,10,180);      //same result regardless of what parameter 4 is set to
IPAddress dns = IPAddress(75,75,76,76);   //same result with parameters 75,75,75,75
IPAddress gateway = IPAddress(10,1,10,1);
IPAddress subnet = IPAddress(255,255,255,0);

Ethernet.begin(mac, ip, dns, gateway, subnet);
delay(5000);
  
Serial.println(Ethernet.localIP());    //returns 0.0.0.0

And this is what ipconfig shows when I connect the same ethernet cord to my laptop instead of the controllino:

Does anyone see what I'm doing wrong? Any help would be greatly appreciated!

which ethernet library are you using?
can you upload a schematic of the circuit?

try the WebClient example

Most probably a hardware problem. My guess is that your hardware doesn't use the libraries standard CS pin (10). The web page you linked to implies that you have to install a patched Ethernet library and must not use the one from Arduino to get code running on your hardware platform.
According to a pinout diagram on the site CS of the WizNet chip is connected to PJ3 on the processor, a pin which isn't available on the Arduino Mega 2560.

Have you tried an example sketch?

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

// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
byte mac[] = {  
  0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02 };

// Initialize the Ethernet client library
// with the IP address and port of the server
// that you want to connect to (port 80 is default for HTTP):
EthernetClient client;

void setup() {
  // start the serial library:
  Serial.begin(9600);
  // start the Ethernet connection:
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:
    for(;;)
      ;
  }
  // print your local IP address:
  Serial.println(Ethernet.localIP());

}

void loop() {

}

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