My setup is : ESP32 with ENC28J60 ,Arduino IDE 2.3.2 ,EthernetENC library.
The issue I am facing is that in the setup code,it never returns from Ethernet.begin(). I am expecting to see "DCHP OK" (BTW static IP works)
This is the relevant part
/*
Web client with enc28j60 and EthernetENC
This sketch connects to a test website (httpbin.org)
and try to do a GET request, the output is printed
on Serial
by Renzo Mischianti <www.mischianti.org>
https://www.mischianti.org
*/
#include "SPI.h"
#include "EthernetENC.h"
// if you don't want to use DNS (and reduce your sketch size)
// use the numeric IP instead of the name for the server:
//IPAddress server(74,125,232,128); // numeric IP for Google (no DNS)
//char server[] = "www.google.com"; // name address for Google (using DNS)
char server[] = "httpbin.org"; // name address for Google (using DNS)
// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
// Set the static IP address to use if the DHCP fails to assign
#define MYIPADDR 192,168,1,28
#define MYIPMASK 255,255,255,0
#define MYDNS 192,168,1,1
#define MYGW 192,168,1,1
// Initialize the Ethernet client library
// with the IP address and port of the server
// that you want to connect to (port 80 is default for HTTP):
EthernetClient client;
// Variables to measure the speed
unsigned long beginMicros, endMicros;
unsigned long byteCount = 0;
bool printWebData = true; // set to false for better speed measurement
void setup() {
Serial.begin(115200);
delay(5000);
Serial.println("Begin Ethernet");
// You can use Ethernet.init(pin) to configure the CS pin
Ethernet.init(5); // MKR ETH Shield
if (Ethernet.begin(mac))
{ // Dynamic IP setup
Serial.println("DHCP OK!");
}
else
{
Serial.println("Failed to configure Ethernet using DHCP");
// 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.");
}
IPAddress ip(MYIPADDR);
IPAddress dns(MYDNS);
IPAddress gw(MYGW);
IPAddress sn(MYIPMASK);
Ethernet.begin(mac, ip, dns, gw, sn);
Serial.println("STATIC OK!");
}
delay(5000);
And this is what I see
13:13:52.184 -> Begin Ethernet
13:13:52.328 -> udp beginPacket, rip: 255.255.255.255, port: 67
13:13:52.329 -> udp, uip_poll preparing packet to send: 1, size: 325
13:13:52.329 -> Enc28J60Network_send uip_packet: 1, hdrlen: 42
13:13:52.329 -> sendPacket(1) [801-93E]: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 80 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Searching found a issue on DHCP and broadcast that suggest a fix. Tried but same result.
Not receiving DHCP Offer Packet · Issue #9 · Networking-for-Arduino/EthernetENC · GitHub
Any idea what is wrong here?




