Unable to compile Example with Ethernet.h library

Hi all,

I’m trying to use the Ethernet.h library with bw16, in the sketch given below to connect to a Wiznet5500 ethernet module. However the sketch fails to compile giving the error message pictured below. Apparently the error seems to have something to do with UDP.h library.

Kindly help.

Regards
azhaque

#include <Ethernet.h>
#include <EthernetUdp.h>

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = {
  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
};
IPAddress ip(192, 168, 1, 177);

unsigned int localPort = 8888;      // local port to listen on

// buffers for receiving and sending data
char packetBuffer[UDP_TX_PACKET_MAX_SIZE];  // buffer to hold incoming packet,
char ReplyBuffer[] = "acknowledged";        // a string to send back

// An EthernetUDP instance to let us send and receive packets over UDP
EthernetUDP Udp;

void setup() {
  // You can use Ethernet.init(pin) to configure the CS pin
  //Ethernet.init(10);  // Most Arduino shields
  //Ethernet.init(5);   // MKR ETH Shield
  //Ethernet.init(0);   // Teensy 2.0
  //Ethernet.init(20);  // Teensy++ 2.0
  //Ethernet.init(15);  // ESP8266 with Adafruit FeatherWing Ethernet
  //Ethernet.init(33);  // ESP32 with Adafruit FeatherWing Ethernet

  // start the Ethernet
  Ethernet.begin(mac, ip);

  // Open serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

  // Check for Ethernet hardware present
  if (Ethernet.hardwareStatus() == EthernetNoHardware) {
    Serial.println("Ethernet shield was not found.  Sorry, can't run without hardware. :(");
    while (true) {
      delay(1); // do nothing, no point running without Ethernet hardware
    }
  }
  if (Ethernet.linkStatus() == LinkOFF) {
    Serial.println("Ethernet cable is not connected.");
  }

  // start UDP
  Udp.begin(localPort);
}

void loop() {
  // if there's data available, read a packet
  int packetSize = Udp.parsePacket();
  if (packetSize) {
    Serial.print("Received packet of size ");
    Serial.println(packetSize);
    Serial.print("From ");
    IPAddress remote = Udp.remoteIP();
    for (int i=0; i < 4; i++) {
      Serial.print(remote[i], DEC);
      if (i < 3) {
        Serial.print(".");
      }
    }
    Serial.print(", port ");
    Serial.println(Udp.remotePort());

    // read the packet into packetBuffer
    Udp.read(packetBuffer, UDP_TX_PACKET_MAX_SIZE);
    Serial.println("Contents:");
    Serial.println(packetBuffer);

    // send a reply to the IP address and port that sent us the packet we received
    Udp.beginPacket(Udp.remoteIP(), Udp.remotePort());
    Udp.write(ReplyBuffer);
    Udp.endPacket();
  }
  delay(10);
}

Hi @azhaque,

May I know where did you get the Ethernet library, or did you develop your own ethernet library?

Thank you.

Thanks for the reply Kelvin.
I got the Ethernet.h from the Arduino Library Manager.
I had posted my issue on the Arduino forum. From it I got the suggestion to add udp.h from any source, into the ameba core directory in my computer, which I did. However the problem persists.

Also please see the link link beliw.

Regards
Azhaque

I may add that the 8720dn/bw16’s major advantage is that it has 5 GHz wifi capability. This gives it a very distinct edge over other modules in this price class. The recent advent of the ESP32-C5 module, with 5 GHz wifi, will soon nulify the BW16’s advantage cited above. Therefore it is important for Realtek to do something about it.

I cannot understand why the Ethernet.h library does not compile for the bw16. This is because just like the atmega328 the 8720 does not have the requisite hardware to connect to ethernet directly. But the Ethernet library allows the 328 to connect to an ethernet shield using the SPI protocol. Why is this not possible in case of 8720dn/bw16, I cannot understand. I surmise that there maybe some strategic/commercial reason for this gap.

I hope that this would be corrected by Realtek/AI-thinker in case of the bw16, asap.
Thanks and regards
Azhaque