Skip to content

localIP() delivers incorrect IP address; RXIP/RXIN correctly wired ? #6013

Open
@arduinoFriend

Description

@arduinoFriend

Hi everybody,

I face a similiar problem as @Alienwaren back in 2014 (#2168), which I get with the code pasted below. I have a Leonardo ETH.

@PaulStoffregen who found a good solution in 2014 is kindly invited to join the discussion.

The Leonardo ETH also has a SD controller on board, but I have no SD card plugged in.

I set a static IP address on the W5500 Ethernet controller. The returned IP by localIP() is not correct (0.178.178.178), which is stable in one session. It changed a few times on new power ups. When I continue by doing a EthernetClient connect, it fails as could be expected. Setting the controller up by DHCP gives the same behaviour or causes an eternal Ethernet.begin ...

My assumption is that the problem lies in the SPI communication between the ATMega and the ETH controller or in the ETH controller itself (broken ?).

A second issue concerns the Leonardo ETH board schematics (Arduino_Leonardo_Eth_v1_sch.pdf) and the Ethernet Shield 2. Nets 'RXIP' and 'RXIN' are AC-coupled (i.e. by capacitors) to the RJ45 jack, but they seem to be absolutely DC-floating. If there is no DC path, this can affect heavily communication reliability and must be considered a bug !

Thanks for every answer,
Wolfgang - new to Arduino but not new to electronics

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

// MAC address
byte mac[] = { 0x90, 0xA2, 0xDA, 0x10, 0xE4, 0x55 };
// Set the static IP address to use if the DHCP fails to assign
IPAddress ip(192, 168, 0, 9);

void setup() {

  pinMode(10, OUTPUT);    // make sure the the ETH controller is enabled
  digitalWrite(10, LOW);
  
  pinMode(4, OUTPUT); // make sure that the SD card controller is not accidentially outputting on SPI shared with Ethernet
  digitalWrite(4, HIGH);
  delay(1);
  
  // Start serial logging
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

  Ethernet.begin(mac, ip);
}

void loop()
{
  Serial.println(Ethernet.localIP());
  delay(1000);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions