Hi,
I got a arduino nano every from digikey and a ENC28J60 10M Nano Ethernet Shield from ebay.
After connecting them together, I tried with the blink, that works.
Then I try to get the UIP ethernet echo work.
After installed the UIPEthernet library, I try this code from UIPEthernet example
/*
- UIPEthernet EchoServer example.
- UIPEthernet is a TCP/IP stack that can be used with a enc28j60 based
- Ethernet-shield.
- UIPEthernet uses the fine uIP stack by Adam Dunkels adam@sics.se
-
- This Hello World example sets up a server at 192.168.1.6 on port 1000.
- Telnet here to access the service. The uIP stack will also respond to
- pings to test if you have successfully established a TCP connection to
- the Arduino.
- This example was based upon uIP hello-world by Adam Dunkels adam@sics.se
- Ported to the Arduino IDE by Adam Nielsen malvineous@shikadi.net
- Adaption to Enc28J60 by Norbert Truchsess norbert.truchsess@t-online.de
*/
#include <UIPEthernet.h>
// The connection_data struct needs to be defined in an external file.
#include <UIPServer.h>
#include <UIPClient.h>
EthernetServer server = EthernetServer(1000);
void setup()
{
Serial.begin(9600);
uint8_t mac[6] = {0x00,0x01,0x02,0x03,0x04,0x05};
IPAddress myIP(192,168,1,6);
Ethernet.begin(mac,myIP);
server.begin();
}
void loop()
{
size_t size;
if (EthernetClient client = server.available())
{
if (client)
{
while((size = client.available()) > 0)
{
uint8_t* msg = (uint8_t*)malloc(size);
size = client.read(msg,size);
Serial.write(msg,size);
client.write(msg,size);
free(msg);
}
}
}
}
The compile have warning and uploading seems successful, but I can not ping or telnet that ip.
I also tried the other examples from the file->examples->ethernet, it seems they can compile, load, but not even ping.
Where am I missing here?
BTW, my OS is MACOS Catalina, version 10.15.5
And my Arduino version is 1.8.13
The macos is connected to network via RJ45 wired ethernet, ip is 192.168.1.139, and the arduino ethernet shield is connected to the same switch with the macos.
Thanks,