(06-01-2025, 12:08 PM)ematicenergies Wrote: (06-01-2025, 11:39 AM)admin Wrote: here is ethernet arduino source code for KC868-A16v3:
https://www.kincony.com/forum/showthread.php?tid=7389
i have tried this. it shows the IP address: 0.0.0.0 . Eventhough the lan is connected.
#include <ETH.h>
#include <SPI.h>
#include <Ethernet.h>
// SPI pin configuration
#define ETH_SPI_SCK 42
#define ETH_SPI_MISO 44
#define ETH_SPI_MOSI 43
// W5500 control pins
#define ETH_CS 41
#define ETH_RST 1
#define ETH_INT 2
// Static IP configuration
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip = IPAddress(192, 168, 3, 55);
IPAddress dns = IPAddress(192, 168, 3, 1);
IPAddress gateway= IPAddress(192, 168, 3, 1);
IPAddress subnet = IPAddress(255, 255, 255, 0);
void resetW5500() {
pinMode(ETH_RST, OUTPUT);
digitalWrite(ETH_RST, LOW);
delay(100);
digitalWrite(ETH_RST, HIGH);
delay(100);
}
void setup() {
Serial.begin(115200);
delay(1000);
Serial.println("W5500 Ethernet setup with ESP32-S3...");
// Set up SPI
SPI.begin(ETH_SPI_SCK, ETH_SPI_MISO, ETH_SPI_MOSI, ETH_CS);
// Reset the W5500
resetW5500();
// Initialize Ethernet library
Ethernet.init(ETH_CS); // Set CS pin
Ethernet.begin(mac, ip, dns, gateway, subnet);
delay(1000);
if (Ethernet.hardwareStatus() == EthernetNoHardware) {
Serial.println("W5500 Ethernet shield not found. Check wiring!");
while (true);
}
if (Ethernet.linkStatus() == LinkOFF) {
Serial.println("Ethernet cable not connected.");
} else {
Serial.print("Ethernet Connected! IP Address: ");
Serial.println(Ethernet.localIP());
}
}
void loop() {
Serial.print("Current IP: ");
Serial.println(Ethernet.localIP());
delay(10000);
}
this is my updated code. check if the pin connections are correct or provide me some leads ASAP