Readback of Ethernet.localIP() is not the assigned address which the board is using

[code]
////////////////// USER CONFIGURATION /////////////////////////////
#define USE_DHCP 0                              // set to 1 for DHCP
IPAddress industruino_ip (192, 168, 0, 177);    // example
//#define TCP_SERVER "www.arduino.cc"
#define TCP_SERVER "192.168.0.5"
#define TCP_SERVER_PORT 80                     // for http

[/code]

[code]
  } else {        // static IP
    SerialUSB.print("My IP: ");
    SerialUSB.println(industruino_ip);
    Ethernet.begin(mac, industruino_ip);
  }
  printTime();
  SerialUSB.print("Ethernet started with above MAC and IP: ");
  SerialUSB.println(Ethernet.localIP());
  lcd.setCursor(0, 3);
  lcd.print("IP ");
  lcd.print(Ethernet.localIP());

[/code]

7:33:22.710 -> [2.13] Reading MAC from RTC EEPROM: 0:4:A3:B:0:4D:91:E8
17:33:22.710 -> Extracted 6-byte MAC address: 0:4:A3:4D:91:E8
17:33:22.747 -> [2.15] Ethernet module found
17:33:24.744 -> My IP: 192.168.0.177
17:33:25.753 -> [5.16] Ethernet started with above MAC and IP: 224.212.0.216
17:33:25.753 -> [5.17] END OF SETUP
17:33:25.753 ->
17:33:25.753 -> [5.17] connecting to server 192.168.0.5 on port 80... [5.19] failed to connect, restarting Ethernet
17:33:26.792 ->

Examination on the server side with wireshark shows that it is trying to connect from the correct IP 192.168.0.177

Why is it returning that multicast address as its local IP address, and how to fix?

Thanks,

Chris

 

 

Chris_B
Chris_B
14
| 0 0 0
Asked on 11/25/19, 11:05 PM
0
vote
44 Views

hi, i can't think of a specific reason why you are seeing that, but just to double check: are you using the Industruino version of the Ethernet2 library as in https://github.com/Industruino/documentation/blob/master/ethernet.md#ethernet2-library and do you see any reason why the connection is eventually failing? i mean, you have an http server running on that ip?

Tom
on 11/25/19, 11:40 PM

are you using the Industruino version of the Ethernet2 library as in https://github.com/Industruino/documentation/blob/master/ethernet.md#ethernet2-library

Tom's tip solved my problems, though never figured out what the issue was.  It was not the SPI speed, I fixed that by hand according to the instructions and so initializing the Ethernet had already been working (I could ping the unit from a laptop).  It was something more mysterious/subtle preventing connections from working. 

Nevertheless, junking Ethernet2 in favor of Industruino's Ethernet2-master fixed everything.  Both IndustruinoEthernetClient and WebServer example sketches compile and run using the correct library.  Neither was working with merely the Ethernet2 library having SPI set correctly.

 

 

Chris_B
Chris_B
14
| 0 0 0
Answered on 11/26/19, 3:29 PM
0
vote

Your answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

Ask a Question

Keep Informed

About This Forum

This community is for professionals and enthusiasts of our products and services.

Read Guidelines

Question tools

58 follower(s)

Stats

Asked: 11/25/19, 11:05 PM
Seen: 44 times
Last updated: 11/26/19, 3:29 PM