---
title: "Receiving with w5500"
url: "https://maker.wiznet.io/forum/9841"
markdown_url: "https://maker.wiznet.io/forum/9841/md"
type: "Forum topic"
category: "Ethernet Chips"
author: "ristohedman"
created: "2014-01-20T09:30:17+09:00"
last_activity: "2017-05-04T08:33:14+09:00"
language: "en"
views: 1571
replies: 2
source: "WIZnet Makers forum (https://maker.wiznet.io/forum/)"
---

# Receiving with w5500

## Question

Asked by ristohedman on 2014-01-20 in Ethernet Chips.

Hello,

While testing WIZ550io I’ve faced strange problems in RECEIVE:

- Interface seems to be operational as transmission from WIZ is OK

- I initialize two DSP- sockets with 8k TX and RX buffers each

- I’ve tested with built in Socket Register Block initialization and I’ve initialized it myself - no difference

- UDP is in use and all register settings have been verified with debugging messages to UART

- Network has been tracked with Wireshark and PC does not send any additional messages to WIZ’s IP

- In my code I follow exactly instructions on page 56 of v1.0.2 datasheet

- I poll RECV -flag of Socket Interrupt Register to detect received message

My observations

- 1st message after initialization is OK

- RECV flag does not go down and zero length fake message is “received”

- Varius delays and status polls have been implemented to p56 istructions - does not help

- If RECV flag is cleared as advised at p48, socket will be closed and transmitter will receive an ICMP msg about

In listing below:

- L - Length of the received message

- RD1 - RX_RD before issuing of RECV

- RD2 - RX_RD after issuing of RECV

- WR1 - RX_WR before issuing of RECV

- WR2 - RX_WR after issuing of RECV

- S1 - status reg before any operation

- S2 - status reg afrer RECV

- I1 - int reg before any operation

- I2 - int reg afrer RECV

When length red has been L=0 OR L>20, length has been given value 10

Socket 0 RX INT OKKK - RD1=0 WR1=17 RD2=17 WR2=17 I1=4 S1=22 I2=4 S2=22 L=17
Socket 0 RX INT FAIL- RD1=17 WR1=17 RD2=17 WR2=17 I1=4 S1=22 I2=40 S2=11 L=0
Socket 0 RX INT FAIL- RD1=27 WR1=17 RD2=27 WR2=17 I1=4 S1=22 I2=40 S2=1b L=65526

Below is the debug of the initialization of the sockets, values are READ from the registers

## -------Socket 0 & 1 init -------Socket 0 & 1 OPEN -------Socket 0 & 1 settings read Socket mode S0=0x2 S1=0x2 Socket status S0=0x22 S1=0x22 Source port addr S0=32000 S1=32002 Max Seg size S0=1456 S1=1472 Socket TOS S0=100 S1=0 Socket TTL S0=64 S1=64 FRAG sixe S0=0 S1=0 -------Socket 0 & 1 give RECV command -------Socket 0 & 1 TX&RX buffers read TX-BUFF SIZE S0=8 S1=8 RX-BUFF SIZE S0=8 S1=8 TXRD POINTER S0=0 S1=0 TXWR POINTER S0=0 S1=0 -------END SOCKETS INITIALISATION

Most likely I’m misusing the chip but I would appreciate if you could assist me to right direction.

A (flow)chart of the proposed driver software would be useful.

Best Regards,

Risto

## Replies

### Reply 1 by ristohedman, 2014-01-21

Hi

You use 2 UDP socket with 8K TX/RX buffer (==> Other sockets should have zero TX/RX buffer size)
Yes, that is true

- PC doesn’t send any data to W5500. (==> Validate the existence of the ARP packet among wireshark captured packets)
  PC sends UDP to W5500 and the first is OK, ARP is fine

- No received data, but RECV flag of Sn_IR is set.
  First message goes right from PC to RX buffer

- When you clear the Sn_IR(RECV) to zero, Socket closed.
  That is right

I think that you have wrong interface(Read/Write) with W5500.
Interface is working, tested with TX (from WIZ to PC, which is OK)

==> Without any writing to Sn_TOS and Sn_TTL, Their read values should be 0x00 and 0x80 respectly. But your read value is “TOS S0=100 S1=0” and “TTL S0=64 S1=64”.
I initialize all socket registers first by writing values there.

PING is tested and works fine, so does ARP

Anyway, I recommend you try to ping-test using dos prompt and capture the ping-packet using wireshark.
==> If no response and ARP-packet captured, I will wonder that network registers as SIPR, SUBR and GWR maybe wrong write.

I have downloaded your driver and checked the compatibility with my code.

### Reply 2 by vitech, 2014-06-23

Hello,
Sorry for posting in this thread, but my question is somehow related to subject.
I’m trying to make W5500 work with software FreeBSD stack in EcOS using socket 0 in MACRAW mode and I had some questions about interrupts. As I understand it, RECV interrupt in Sn_IR occurs after RECV cmd was called, and I need to poll Sn_RX_RSR register to make sure some data in rx_buf before I call RECV cmd. But, in OS I can’t admit myself to poll Sn_RX_RSR forever, just want interrupt to set up when any packet received by the chip. Are there any ways to solve my problem?

---

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