Hello everyone,
I'm currently working on a project that involves connecting an Arduino Leonardo with a HanRun HR911105A 22/02 (W5500 Ethernet module). I've made the following connections, but I'm having trouble getting it to work correctly.
Here are the connections I have made:
HanRun HR911105A (W5500) Arduino Leonardo
_________________________ _______________________
| | | |
| SCLK - |----| Digital Pin xx |
| MOSI MOSI (11)|----| Digital Pin 11 (MOSI)|
| MISO MISO (12)|----| Digital Pin 12 (MISO)|
| SCS (CS) 10 |----| Digital Pin 10 (SS) |
| INT 7 |----| Digital Pin 7 |
| RST 8 |----| Digital Pin 8 |
| 3.3V 3.3V/5V |----| 3.3V or 5V |
| GND GND |----| GND |
|_________________________| |_______________________|
I've tried using the Ethernet library, but I can't seem to establish a connection. Does anyone have experience with this setup or any suggestions on what I might be doing wrong?
#include <SPI.h>
#include <Ethernet_Generic.h>
const int chipSelect = 10;
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192, 168, 0, 177);
EthernetServer server(80);
void setup() {
Ethernet.begin(mac, ip);
delay(1000);
Serial.begin(9600);
while (!Serial) {
;
}
if (Ethernet.hardwareStatus() == EthernetNoHardware) {
Serial.println("Ethernet shield was not found.");
while (true) {
delay(1);
}
}
if (Ethernet.linkStatus() == LinkOFF) {
Serial.println("Ethernet cable is not connected.");
}
Serial.print("IP Address: ");
Serial.println(Ethernet.localIP());
server.begin();
}
void loop() {
EthernetClient client = server.available();
if (client) {
Serial.println("New client");
client.println("HTTP/1.1 200 OK");
client.println("Content-type:text/html");
client.println("Connection: close");
client.println();
client.println("<!DOCTYPE HTML>");
client.println("<html>");
client.println("<head><title>HELLO</title></head>");
client.println("<body>");
client.println("<h1>HELLO</h1>");
client.println("</body>");
client.println("</html>");
delay(1);
client.stop();
Serial.println("Client disconnected");
}
