W5500 stop working after some communicaton


I use WIZ550io module for tcp connection. Wiznet module is configured as TCP server and there is a terminal program as configured TCP client in my pc. I get wiznet codes from
GitHub - Wiznet/ioLibrary_Driver: ioLibrary_Driver can be used for the application design of WIZnet TCP/IP chips as W5500, W5300, W5200, W5100 W5100S. and I use “ioLibrary_Driver/Ethernet” codes.

PC terminal program sends a data as TCP client (approx 20 bytes) to my module and my firmware gets data from WIZ550io. After that my firmware sends back (via spi) an answer package to WIZ550io module and module send them to tcp client (appro 60-70 bytes). This communication is done correctly but after 5-10 communication, WIZ550io doesnt send data to Client.

When I debug my firmware I get below situtation;
I can get data from WIZ550io (server) which client send to wiznet. This data is correct and my firmware try to send back answer package but when send function is called (which is in socket.c) it returns SOCK_BUSY.

   tmp = getSn_SR(sn);
   if( sock_is_sending & (1<<sn) )
      tmp = getSn_IR(sn);
      if(tmp & Sn_IR_SENDOK)
         setSn_IR(sn, Sn_IR_SENDOK);
         //M20150401 : Typing Error
         //#if _WZICHIP_ == 5200
         #if _WIZCHIP_ == 5200
            if(getSn_TX_RD(sn) != sock_next_rd[sn])
               return SOCK_BUSY;
         sock_is_sending &= ~(1<<sn);         
      else if(tmp & Sn_IR_TIMEOUT)
         return SOCKERR_TIMEOUT;
      else return SOCK_BUSY;

In above code normaly getSn_IR(sn); function returns 0x14 and it means Sn_IR_SENDOK and Sn_IR_RECV. But after problem it always return with 0x04 and it never return with Sn_IR_SENDOK so send function always returns with SOCK_BUSY.

How can I solve this problem ? Does anyone see this kind of problem?

thank you


Hmm, it is difficult to identify the cause.

I want to see a your firmware code, especially the receiving and sending process with a brief description.
And I want to see packets captured via wireshark program.
Do you know it?
It is a program that can view network packets.

1 Like

The code will return SOCK_BUSY in case sock_is_sending bit is set, but SEND_OK bit is reset.
It may happen in the following circumstances:

  1. you set sock_is_sending erroneously somewhere in your code;
  2. you try to send data size = 0. It seems code does not check for this condition, and I suspect that while send() sets corresponding sock_is_sending bit, W5500 will not raise SEND_OK bit because there was actually nothing to send.