Cannot connect W5500 as TCP Client


I’m having some issues trying to use W5500 as TCP client. I cannot seem to be able to properly set the Destination IP and Port. As previously mentioned, reading them after setting returns zero by design. The problem is that W5500 does not send the SYN packet. Using Wireshark I can see an ARP packet sent by W5500 asking about IP, after issuing the CONNECT comand. This seems like an indication that the destination IP address is not properly set.
I’m not using your library but developing my own version for a specific project by necessity. I can connect well when in TCP server mode using Hercules on Windows 10. I can also do it on Linux Mint.

Is there any particular moment to set the destination IP or port, before the CONNECT command is issued? On a previous post it was mentioned that we should do it before OPEN but still it has no effect. My code verifies the PHY status, waits for Sn_CR register to return to zero, and checks for status until timeout. There does not seem to be any issues with timings. I tried setting up extra delays between various operations.

Please, can you give me some hint on what to check? Is it mandatory to configure the following registers: Sn_MSSR, Sn_TOS, Sn_TTL, Sn_FRAG or Sn_KPALVTR, before trying to establish a TCP connection? I’m keeping them at default values. I’m also not setting Sn_DHAR since it seems to be only important for MACRAW and UDP modes.



The first think to do is review our Loopback example.
You have to write values to network related registers before OPEN operation.

  • For example , GAR /SUBR/ SHAR/SIPR / MR …etc.

These registers are optional, so you don’t need to set it up, and it has values by default.

And in my opinion, it would be good to check if SPI is working normally.

W5500-EVB : GitHub - Wiznet/Loopback_FRDM-KL25Z_Eclipse: Create a repository of WIZnet Freescale Example.
IoLibrary : GitHub - Wiznet/ioLibrary_Driver: ioLibrary_Driver can be used for the application design of WIZnet TCP/IP chips as W5500, W5300, W5200, W5100 W5100S.

Hi. Thanks for the response.

I found the problem thanks to your suggestion. SHAR and SUBR values were wrong. After correcting them everything worked well.