EthernetENC - a modern version of the UIPEthernet library

the library is based on Norbert Truchsess AVR UIPEthernet library. git commits history is preserved (useful for the GitHub 'Blame' view).

The modernization includes:

  • Ethernet 2.0 library functions
  • compatible include file names EthernetClient.h, EthernetServer.h and EthernetUdp.h
  • support of many Arduino architectures by using the SPI library
  • SPI transactions to share the SPI bus with devices with different communication settings
  • SPI communication at 20 MHz if the MCU supports it, else on the maximum supported by the MCU
  • client.flush() to send the packet immediately
  • calls yield() in blocking functions
    see the Wiki for details

The original library by Norbert Truchsess in arduino-uip repository was named UIPEthernet. As Norbert Truchsess stopped to maintain the library in 2014 a copy emerged as UIPEthernet/UIPEthernet repository in 2016.

I took over the maintenance of UIPEthernet/UIPEthernet in 2019 after I found and fixed some serious bugs in the library as I attempted to use it in my Arduino project.

In August 2020 I decided to create a new library based on the original Norbert Truchsess repository. The main reason for a new library were things which would be breaking changes in UIPEthernet/UIPEthernet.

I transferred applicable fixes and enhancements from developed of EthernetENC to UIPEthernet/UIPEthernet (new version 2.0.9)

Differences between EthernetENC and UIPEthernet/UIPEthernet:

  • EthernetENC uses SPI transactions to share the SPI bus with devices requiring different bus settings
  • EthernetENC uses flush() to send the buffer immediately. UIPEthernet has flush() to discard unread data (it is a before Arduino 1.0 behavior).
  • EthernetENC doesn't receive UDP broadcast messages and uses unicast mode to receive DHCP responses
  • EthernetENC has some uipethernet-conf.h settings changed
  • EthernetENC doesn't support Mbed
  • EthernetENC doesn't have code to guess the CS pin for different boards (Ethernet.init is used to set the pin from sketch)
    and EthernetENC works with Arduino Nano 33 BLE

This is a very good library to replace the UIPEthernet. Thank you.

Tested and working very well and transparently on several libraries. Will update to the supporting library lists of many libraries.

  1. DDNS_Generic
Start nRF52_Ethernet_DuckDNS_Client on NRF52840_FEATHER with ENC28J60 using EthernetENC Library

HTTP WebServer is @ IP : 192.168.2.84
[DDNS] Access whatismyipaddress
[DDNS] httpCode = 200
[DDNS] Current Public IP = aaa.bbb.ccc.ddd
[DDNS] response = aaa.bbb.ccc.ddd
[DDNS] Sending HTTP_GET to duckdns
[DDNS] HTTP_GET = http://www.duckdns.org/update?domains=account.duckdns.org&token=token&ip=aaa.bbb.ccc.ddd
[DDNS] httpCode = 200
DDNSGeneric - IP Change Detected: aaa.bbb.ccc.ddd
[DDNS] Updated IP = aaa.bbb.ccc.ddd
  1. EthernetWebServer on NRF52840_FEATHER
Starting AdvancedWebServer on NRF52840_FEATHER
[ETHERNET_WEBSERVER] =========================
[ETHERNET_WEBSERVER] Default SPI pinout:
[ETHERNET_WEBSERVER] MOSI: 25
[ETHERNET_WEBSERVER] MISO: 24
[ETHERNET_WEBSERVER] SCK: 26
[ETHERNET_WEBSERVER] SS: 5
[ETHERNET_WEBSERVER] =========================
[ETHERNET_WEBSERVER] Unknown board setCsPin: 10
=========================
Currently Used SPI pinout:
MOSI:25
MISO:24
SCK:26
SS:5
=========================
Using mac index = 14
Connected! IP address: 192.168.2.86
HTTP EthernetWebServer is @ IP : 192.168.2.86

thank you Khoi Hoang for testing.
yes the super-libraries (libraries using libraries) support was one of the goals. and you created a lot of super libraries.
if the user includes EthernetENC.h in sketch, include Ethernet.h, EthernetClentt.h etc in used libraries will be valid and point to EthernetENC.

I missed yesterdays library index additions round, so I postponed the first release in hope someone will test it from repo. so thank you again

As you have talent and deep knowledge of TCP/IP, uIP, and ability to write complicated hardware-level driver, I wish you can consider these following tasks / foundation to make ESPAsyncWebServer working for other boards (SAMD21/SAMD51, nRF52, SAM DUE, Teensy, etc.)

  1. LwIP for those boards (similar to Stm32duino LwIP
  2. Ethernetxyz to use LwIP (similar to Stm32duino STM32Ethernet currently for only LAN8742A)

khoih-prog:
As you have talent and deep knowledge of TCP/IP, uIP, and ability to write complicated hardware-level driver, I wish you can consider these following tasks / foundation to make ESPAsyncWebServer working for other boards (SAMD21/SAMD51, nRF52, SAM DUE, Teensy, etc.)

  1. LwIP for those boards (similar to Stm32duino LwIP
  2. Ethernetxyz to use LwIP (similar to Stm32duino STM32Ethernet currently for only LAN8742A)

I wait until they finish multi network interface support in esp8266 core and then I want to port it as a LWIP2 based library for ARM Arduinos. this library will support multiple network interfaces with any network hardware which can implement readFrame sendFrame. W5x00 and enc28j60 are already implemented.

then it will be easy to port the esp application-protocol-layer libraries