Skip to content

ETH static IP configuration doesn't work #9673

@JAndrassy

Description

@JAndrassy

Board

ESP32 Dev module

Device Description

Espressif dev module

Hardware Configuration

W5500 wired on default SPI pins

Version

latest master (checkout manually)

IDE Name

Arduino IDE

Operating System

Linux

Flash frequency

40

PSRAM enabled

yes

Upload speed

any

Description

ETH.config doesn't set static IP configuration, because of

  if (_esp_netif == NULL) {
    return false;
  }

in NetworkInterface.config

Sketch

#define ETH_PHY_TYPE        ETH_PHY_W5500
#define ETH_PHY_ADDR        -1
#define ETH_PHY_CS           5
#define ETH_PHY_IRQ         -1
#define ETH_PHY_RST         -1
#define ETH_PHY_SPI         SPI

#include <ETH.h>

void setup() {

  Serial.begin(115200);
  delay(500);

  SPI.begin();

  IPAddress ip(192, 168, 1, 177);
  IPAddress gw(192, 168, 1, 1);
  IPAddress dns(192, 168, 1, 1);
  IPAddress mask(255, 255, 255, 0);

  ETH.config(ip, dns, gw, mask);
  ETH.begin();
  while (!ETH.hasIP()) {
    Serial.print('.');
    delay(1000);
  }
  if (ip != ETH.localIP()) {
    Serial.println("ERROR: Static IP was not used.");
  }

 }

void loop() {

}

Debug Message

ERROR: Static IP was not used.

Other Steps to Reproduce

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions