[W5500-EVB-Pico] 아두이노 예제 파일이 동작하지 않습니다.

[W5500-EVB-Pico]


#include <SPI.h>
#include <Ethernet2.h>

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network.
// gateway and subnet are optional:
byte mac = {
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
};
IPAddress ip(192, 168, 100, 22);
IPAddress gateway(192, 168, 100, 1);
IPAddress subnet(255, 255, 255, 0);

// telnet defaults to port 23
EthernetServer server(23);
boolean alreadyConnected = false; // whether or not the client was connected previously

void setup() {

//Ethernet.init(1); //SPI0 CS Pin (GP1)

// initialize the ethernet device
Ethernet.begin(mac, ip, gateway, subnet);
// start listening for clients
server.begin();
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}

Serial.print(“Chat server address:”);
Serial.println(Ethernet.localIP());
}

void loop() {
// wait for a new client:
EthernetClient client = server.available();

// when the client sends the first byte, say hello:
if (client) {
if (!alreadyConnected) {
// clead out the input buffer:
client.flush();
Serial.println(“We have a new client”);
client.println(“Hello, client!”);
alreadyConnected = true;
}

if (client.available() > 0) {
  // read the bytes incoming from the client:
  char thisChar = client.read();
  // echo the bytes back to the client:
  server.write(thisChar);
  // echo the bytes to the server as well:
  Serial.write(thisChar);
}

}
}


출처
https://blog.naver.com/yusanghyun26/222527712230

아래와 같은 메시지가 시리얼로 표시가 됩니다.
“Chat server address:(IP unset)” 라는 시리얼로 나옵니다.

제 pc ipconfig 는 아래와 같습니다.
이더넷 어댑터 이더넷:

연결별 DNS 접미사. . . . :
링크-로컬 IPv6 주소 . . . . : fe80::eb8ㅌㅌㅌㅌ:c7e1:dd8b%9
IPv4 주소 . . . . . . . . . : 192.168.100.6
서브넷 마스크 . . . . . . . : 255.255.255.0
기본 게이트웨이 . . . . . . : 192.168.100.1

W5500-EVB-Pico 에서 동작하는 chatserver.ino 소스가 있었으면 합니다.

Ethernet.init(17); //SPI0 CS Pin (GP1)

수정 후 서버는 ip는 나오는데.

Chat server address:192.168.100.11

서버 컨넥션이 되지 않아요.

안녕하세요.

공유해주신 source code 상에서 chat server IP가 '192.168.100.22’로 설정된 것으로 파악되어지는데,

client(Hercules)로 chat server에 접속 시에 '192.168.100.11’이 아닌 chat server IP '192.168.100.22’로 입력하여 접속해 보시길 바랍니다.

만약 source code 상에서 chat server IP를 '192.168.100.11’로 수정하셨다면,

사용하시는 nerwork 망에서 이미 '192.168.100.11’가 사용 중인지 확인 부탁 드리겠습니다.

IP를 중복해서 사용하는 경우, IP 충돌로 인하여 정상적으로 접속 및 동작하지 않을 수 있습니다.