IP Can't be set. Leonardo eth V2 (W5500)

I have an arduino leonardo eth compatible board.(https://robotdyn.com/leonardo-eth-v2-with-atmega32u4-ethernet-w5500-arduino-compatible-board.html)

when i try to connect over ethernet, it can’t be set Ip address and fail to connect.
this is my code.


#include <SPI.h>

#include <Ethernet2.h>

#include <BlynkSimpleEthernet2.h>

// You should get Auth Token in the Blynk App.

// Go to the Project Settings (nut icon).

char auth[] = "key";

// Mac address should be different for each device in your LAN

byte arduino_mac[] = {0xDE, 0x08, 0xDC, 0x53, 0xF7, 0x15};

IPAddress arduino_ip(192, 168, 0, 55);

IPAddress dns_ip(8, 8, 8, 8);

IPAddress gateway_ip(192, 168, 0, 1);

IPAddress subnet_mask(255, 255, 255, 0);

#define W5500_CS 10

#define SDCARD_CS 4

void setup()

{

// Debug console

Serial.begin(9600);

pinMode(SDCARD_CS, OUTPUT);

digitalWrite(SDCARD_CS, HIGH); // Deselect the SD card

Blynk.begin(auth, "blynk-cloud.com", 80, arduino_ip, dns_ip, gateway_ip, subnet_mask, arduino_mac);
}

void loop()
{
Blynk.run();
}

and i got this result.

[2000] IP:0.0.0.0
[2001] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.6.1 on Arduino

[2004] Connecting to blynk-cloudcom:80

I do not know why my IP is 0.0.0.0.

I would appreciate your advice.

  1. You need to use backticks around your code, otherwise it will be removed > ```

  2. try removing the spaces after the values used for all IP addresses and gateways

 IPAddress arduino_ip(192, 168, 0, 55);     >>>    IPAddress arduino_ip(192,168,0,55);

Thanks for the advice. I have edited the article. and i will try 2.

I removed all the spaces. But nothing has changed.

Same with the MAC address? Also - make sure your MAC address does not conflict with any other devices on your network.

I’ve not used ethernet so I’m just guessing here. - Can you add:

#define BLYNK_PRINT Serial

Maybe that will give us some more info?

After searching, this board needs to activate the module through DIO.

I have added the code below.

#define ETHCS 10 //W5500 CS
#define ETHRST 11 //W5500 RST
#define SDCS 4 //SD CS pin

setup
{
......
pinMode(ETHCS, OUTPUT);
pinMode(ETHRST, OUTPUT);
pinMode(SDCS, OUTPUT);

digitalWrite(ETHRST, HIGH);
digitalWrite(ETHCS, HIGH);
digitalWrite(SDCS, LOW);
......
}

It works well now.
thank you for your attention.

2 Likes