I bought the ETH Click (https://www.mikroe.com/eth-click) and I'm currently trying to use it with Arduino Mega as a trial before I buy the FlipClick. Because it uses the ENC28J60, I'm trying to use its libraries on Github, like the UIPEthernet (https://github.com/UIPEthernet/UIPEthernet).
To test it, I decided to run a WebServer code found in https://codebender.cc/sketch:387238 and connect it with my Internet modem with the Ethernet Cable in a LAN port. But it doesn't look like it is working... At least nothing shows up when I access the IP 192.168.1.96.
Arduino Serial Monitor:
Code: Select all
14:10:57.273 -> ENC28J60::init DEBUG:csPin = 53
14:10:57.306 -> ENC28J60::init DEBUG:miso = 50
14:10:57.340 -> ENC28J60::init DEBUG:mosi = 51
14:10:57.376 -> ENC28J60::init DEBUG:sck = 52
14:10:57.414 -> ENC28J60::init DEBUG:Use SPI lib SPI.begin()
14:10:57.450 -> ENC28J60::init INFO: Chip erevid=6 initialization completed.
14:10:57.521 -> IP Address: 192.168.1.199
Code: Select all
14:12:48.222 -> Enc28J60Network::receivePacket(void) DEBUG:receivePacket [6-42], next: 46, stat: C0, Packet count: 1 -> OK
14:12:48.222 -> Enc28J60Network::receivePacket(void) DEBUG: rxstat OK. receivePkt.size=60
14:12:48.222 -> UIPEthernetClass::tick() DEBUG:receivePacket: 255
14:12:48.222 -> Enc28J60Network::readPacket(memhandle handle, memaddress position, uint8_t* buffer, uint16_t len) DEBUG_V2: Read bytes:60 save to block(255) [0]: **HEX BLOCK HERE**
14:12:48.222 -> UIPEthernetClass::tick() DEBUG:readPacket type IP, uip_len: 60
14:12:48.222 -> UIPEthernetClass::tick() DEBUG:freeing packet: 255
14:12:48.222 -> Enc28J60Network::setERXRDPT(void) DEBUG:Set actnextPacketPtr:45
Code: Select all
#include <UIPEthernet.h> // Used for Ethernet
// **** ETHERNET SETTING ****
byte mac[] = { 0x54, 0x34, 0xaa, 0x36, 0xcc, 0x31 };
IPAddress ip(192, 168, 1, 96);
EthernetServer server(80);
void setup() {
Serial.begin(9600);
// start the Ethernet connection and the server:
Ethernet.begin(mac, ip);
server.begin();
Serial.print("IP Address: ");
Serial.println(Ethernet.localIP());
}
void loop() {
// listen for incoming clients
EthernetClient client = server.available();
if (client)
{
Serial.println("-> New Connection");
// an http request ends with a blank line
boolean currentLineIsBlank = true;
while (client.connected())
{
if (client.available())
{
char c = client.read();
// if you've gotten to the end of the line (received a newline
// character) and the line is blank, the http request has ended,
// so you can send a reply
if (c == '.' && currentLineIsBlank)
{
client.println("<html><title>Hello World!</title><body>hOLIS!..</body>");
break;
}
if (c == '\n') {
// you're starting a new line
currentLineIsBlank = true;
}
else if (c != '\r')
{
// you've gotten a character on the current line
currentLineIsBlank = false;
}
}
}
// give the web browser time to receive the data
delay(1000);
// close the connection:
client.stop();
Serial.println(" Disconnected\n");
}
}