---
title: "Ping from W5500"
url: "https://maker.wiznet.io/forum/10198"
markdown_url: "https://maker.wiznet.io/forum/10198/md"
type: "Forum topic"
category: "Ethernet Chips"
author: "jdcowpland"
created: "2014-05-02T10:18:27+09:00"
last_activity: "2020-04-27T08:40:29+09:00"
language: "en"
views: 6987
replies: 12
source: "WIZnet Makers forum (https://maker.wiznet.io/forum/)"
---

# Ping from W5500

## Question

Asked by jdcowpland on 2014-05-02 in Ethernet Chips.

Anyone know of a library or command that I could use to get my W5500 to ping another IP on the network?

## Replies

### Reply 1 by jdcowpland, 2014-05-02

Hi, I’m not having any issues connecting my chip to the network. It’s on the network fine and I’ve got Static and DHCP both working. What I want to do is send data to a server on my network, but sometimes the server will be turned off, so I want my module to ping the server at regular intervals so I know when it’s online…

### Reply 2 by jdcowpland, 2014-05-05

Ok great thanks! Also, is there anyway the chip can detect the network speed. It can obviously support 10 and 100 mbps speeds, but I would like it to be able to detect the speed automatically when connected and apply whatever speed is supported.

### Reply 3 by jdcowpland, 2014-05-05

Just tried implementing the ping code from the coocox code. Also been looking at the documentation for it. It mentions setting up the socket protocol as ICMP, which makes sense, and it talks about a Sn_PROTO register, which from the CooCox code, should be at position 0x0014. But the datasheet marks that register as reserved. I’ve tried sending the packets, and wireshark marks them as Protocol 0: IPv6 hop-by-hop option. Everything else in the packet seems legit. Is there a firmware upgrade for the chip or something that enables the PROTO register for raw ip?

### Reply 4 by jdcowpland, 2014-05-07

Sorry not sure I understand. Are you saying the register is write protected?

### Reply 5 by jdcowpland, 2014-05-26

Hi,

Thanks got it working now. On another note, the w5500 has the ability to communicate at 10Mbps or 100Mbps. Do you know of any simple way for the w5500 to automatically detect the network speed and set it to the right one?

### Reply 6 by jdcowpland, 2014-05-27

Hi yes, I’m aware that I can configure it manually, but what I want to do is write some code which automatically detects the network speed and then configures the phy. Is that possible?

### Reply 7 by nver, 2014-06-21

Hi Wiznet

If IPRAW mode is supported on W5500 why its not documented in the datasheet ? I just checked W5500 datasheet v1.0.4 13 June 2014 and its still not there. ![:confused:](https://emoji.discourse-cdn.com/twitter/confused.png?v=12)

Is there any reason for not publishing it?

### Reply 8 by avivf, 2015-04-16

Hello.
I read the answer, but couldn’t understand how to set the protocol.
I see that the func/macro of Sn_PROTO() does not exist any more.
So, what is the solution for that issue in W5500?

Thanks,
Aviv

### Reply 9 by Coccoliso, 2015-04-16

From W5500.h header file…

```
#define _W5500_IO_BASE_              0x00000000
#define WIZCHIP_SREG_BLOCK(N)       (1+4*N) //< Socket N register block
#define Sn_PROTO(N)         (_W5500_IO_BASE_ + (0x0014 << 8) + (WIZCHIP_SREG_BLOCK(N) << 3))
```

### Reply 10 by warwick, 2020-02-20

When is the complete W5500 manual coming…

All the examples of using ICMP revert to un documented registers, which are not listed…
The W5200 had a proto register at 0x0018 but that seams to be missing…
and the New library’s for the W5500 have all the socket macros removed…

### Reply 11 by kejuqeju, 2020-04-27

Hello WIZnet Team!
i am using socket 2 of W5500
i tried to change the S2_PROTO register (0x0014) to ICMP protocol (0x01) and read it back, and success (the value changed to 0x01). and then i opened the socket using OPEN command (0x01) to S2_CR (0x0001) and read the status from S2_SR (0x0003), the result always 0x00 (SOCK_CLOSED), but you say it must be SOCK_IPRAW (0x32). i dont know what is wrong here. or should i set the S2_MR too? but there is no ICMP protocol option there. can you help me?

### Reply 12 by kejuqeju, 2020-04-27

problem solved.
to OPEN socket 2 in IPRAW mode, first i must set the S2_MR protocol (P3:P2:P1:P0) to 0011 (0x03) which is IPRAW mode (you did not write it in your datasheet, i wonder why?) and then sent OPEN command to S2_CR.
after the S2_SR status changed to 0x32 (SOCK_IPRAW), i have successfully sent PING message and got reply.

---

Source: https://maker.wiznet.io/forum/10198
