Send UDP packet from w5500 to PC failed!

According below steps, i can’t send an UDP packet.

  1. Initialized W5500(set w5500 ip,port, host PC ip, port).
  2. Open w5500 upd socket.
  3. sendto() packet to host pc.
    the result :failed send out the packet. the register value of IINCHIP_READ( Sn_IR(s)) is timeout all the time.

until I received a packet from PC host using receivefrom(), w5500 can send udp packet to host pc using Sendto() successfully.

PC firewall is disable. antivirus software is closed.

Has anyone meet this issue?

Thanks.

Hi,
Did you configure W5500 ip addess as well as gateway, subnet?
If you did, for analysing the timeout of udp, you shoud be captured the packet using wireshark program that is freeware.

Plz, post the captured file on here.

thank you.

Hi midnightcow,

Thanks your reply.

I checked my network config parameters, maybe my host ip and port info error.

Now my prototype can work normal.

Thanks & Best regards,
Ken

Hi,

I’m glad to solve your problem.

Thank you.

I decided not to create a new topic but unsubscribe here,
I have exactly the same problem. Only this happens on power up. order of action such:

  1. pull the hardware reset (switch reset)
  2. Set soft reset
  3. RTR = 1000
  4. RCR = 10
  5. setSHAR
  6. setGAR
  7. setSUBR
  8. setSIPR
    socket (2, Sn_MR_UDP, 161, 0x00); // ----------- <brekpoint
    if (WIZCHIP_READ (Sn_SR (2)) == 0x22) {
    sendto (2, buff, 10, IP2, 161);
    }
    while (1) {}

If you install breckpins on the socket, the packet is sent, otherwise the wireshark is empty, missing UDP pack. How long need wait? after set ip ? If i not set brekpoint i, I get on the line
setSn_IR (sn, Sn_IR_TIMEOUT); in function sendto

Where’s the code waiting for socket open command completion? Where’s the code waiting for MR’s RST bit to reset after soft reset?

into function socket

setSn_CR(sn,Sn_CR_OPEN);
while(getSn_CR(sn));
Where’s the code waiting for MR’s RST bit to reset after soft reset?
hardware i wait 1 ms.

How i know what socket open (UDP) command completion ? I look Sn_IR(CON) Interrupt only tcp

This one

waits until command is accepted. Interrupt bits must indicate that command is completed. IMHO.

After software reset perform checking of the RST bit (7) of MR register for zero, and only then proceed to chip programming.

I add after while(getSn_CR(sn));
while(1)
{
tmp = getSn_IR(sn);
if(tmp & Sn_IR_CON)
{
setSn_IR(sn, Sn_IR_CON);
break;
}
//M:20131104
//else if(tmp & Sn_IR_TIMEOUT) return SOCKERR_TIMEOUT;
else if(tmp & Sn_IR_TIMEOUT)
{
setSn_IR(sn, Sn_IR_TIMEOUT);
return SOCKERR_TIMEOUT;
}
////////////
}
But tmp always zero

Did you operate Sn_IMR properly?

I set Sn_IMR in 0xFF

Hello, Maksim

Did you get no packet from wireshark?

If you have no packet, could you check Sn_IR[SENDOK] after commending Sn_CR[SEND] ?

Before checking the Sn_IR, please set Sn_IMR.

Thank you

SIR/SIMR?

Yes.
If I resend the packet after the timeout, I get a packet in wireshark.
But I want to figure out what I’m doing wrong.

I used the official library. Inside the send function there is a check for Sn_IR [SENDOK], but I get Sn_IR_TIMEOUT.

SIR/SIMR=0xFF
IR=0;

Hello, Maksim

It is hard to understand. Does it mean it works well after timeout?

Could you share the wireshark from first ARP to the last received UDP packet after timeout?
Maybe we can find something new.

Thank you