Receiving with w5500

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

Hi,

I sorry I don’t exactly understand your verbos question.

I understood that
[ul]

  • you use 2 UDP socket with 8K TX/RX buffer (==> Other sockets should have zero TX/RX buffer size)
  • PC doesn’t send any data to W5500. (==> Validate the existence of the ARP packet among wireshark captured packets)
  • No received data, but RECV flag of Sn_IR is set.
  • When you clear the Sn_IR(RECV) to zero, Socket closed.
    [/ul]
    Am I right?

I think that you have wrong interface(Read/Write) with W5500.
==> 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”.

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.

Also, I recommend that you refer to wiznet’s driver source at [url]http://wizwiki.net/wiki/doku.php?id=products:w5500:driver[/url]

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.

Hi,

How often the phenomenon is occur? and Do it operates normal?
Have you experience normal operation?

If you make sure to your code, I will wonder hardware is desined by wiznet reference.

Please, re-comfirm your code and re-check your hardware design.

Thanks.

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?

Sn_IR(RECV) bit is set after some pakets is incoming. So This bit is used in your ISR.
If you want to use the interrupt service routine, You just should set your RX_FLAG variables when Sn_IR(RECV)=1 in your ISR and check RX_FLAG is 1 or not in your main task.
We are not recommend that the receiving data is processed in ISR. Because W5500 interrupt are overlaped by same or another event, You should process IR & Sn_IR as fast as possible. So, By using RX_FLAG or other variables, You can process IR & Sn_IR as fast as possible.
Assume that you use with flag such as RX_FLAG, TX_FLAG and TIMEOUT_FLAG.
In Your main task or thread for processing data, You just check the flags. If flag are set, you can read the related registers such as Sn_RX_RSR. No need to polling the registers if you use flag variables.

Thank you.