From b01e7d05c8f2101243fddf2fd328146529f4a60d Mon Sep 17 00:00:00 2001 From: Claas Flint Date: Sat, 15 Aug 2026 14:57:59 +0200 Subject: [PATCH] ENC28J60: add missing end() required by LwipIntfDev LwipIntfDev calls RawDev::end() from LwipIntfDev::end() and from the two error paths of LwipIntfDev::begin(). Wiznet5500 provides end(), ENC28J60 does not, so LwipIntfDev - i.e. ENC28J60lwIP - no longer compiles: LwipIntfDev.h:280:20: error: 'end' is not a member of 'ENC28J60' LwipIntfDev.h:294:24: error: 'end' is not a member of 'ENC28J60' The calls came in with #9023, which only touched cores/esp8266/LwipIntfDev.h. Wiznet5500::end() closes socket 0 and leaves the chip powered and configured, since a following begin() resets and reopens it anyway. The ENC28J60 equivalent of closing the socket is clearing ECON1.RXEN, the bit that reset() sets last to enable reception. ECON1 is mapped into every bank, so no bank switch is needed, and no frame can be in flight because sendFrame() polls ECON1.TXRTS until the frame has left. --- libraries/lwIP_enc28j60/src/utility/enc28j60.cpp | 8 ++++++++ libraries/lwIP_enc28j60/src/utility/enc28j60.h | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/libraries/lwIP_enc28j60/src/utility/enc28j60.cpp b/libraries/lwIP_enc28j60/src/utility/enc28j60.cpp index 0ee3096486..98c51e5f5c 100644 --- a/libraries/lwIP_enc28j60/src/utility/enc28j60.cpp +++ b/libraries/lwIP_enc28j60/src/utility/enc28j60.cpp @@ -546,6 +546,14 @@ boolean ENC28J60::begin(const uint8_t* address) /*---------------------------------------------------------------------------*/ +void ENC28J60::end() +{ + // stop reception. ECON1 is mirrored into every bank, so no bank switch is needed + clearregbitfield(ECON1, ECON1_RXEN); +} + +/*---------------------------------------------------------------------------*/ + uint16_t ENC28J60::sendFrame(const uint8_t* data, uint16_t datalen) { uint16_t dataend; diff --git a/libraries/lwIP_enc28j60/src/utility/enc28j60.h b/libraries/lwIP_enc28j60/src/utility/enc28j60.h index e6c65d7759..0c21e76041 100644 --- a/libraries/lwIP_enc28j60/src/utility/enc28j60.h +++ b/libraries/lwIP_enc28j60/src/utility/enc28j60.h @@ -62,6 +62,12 @@ class ENC28J60 */ boolean begin(const uint8_t* address); + /** + Shut down the Ethernet controller + Stops the reception of Ethernet frames until the next ::begin() + */ + void end(); + /** Send an Ethernet frame @param data a pointer to the data to send