WIZnet Developer Forum

UDP packet not sent. ARP issue


When I try to send a unicast packet, the packet is never sent but I can see a lots of ARP requests sent by the w5100 but these requests look odds:
The IP address to resolve in the ARP requests are always, regardless the destination IP I set in the S0_DIPR register.
If I set the MAC address of the host in the S0_DHAR register in addition to the previous register, then the packet is sent correclty and received by the remote host.

On the other hand, the w5100 responds correctly to ARP requests from other hosts and also responds to ping requests.

The S0_CR register is well cleared when the packet is (or should be) sent and the SEND_OK bit of the S0_IR register is 1.

Here is a screenshot of a Wireshark capture of the strange ARP requests:
the w5100 has the address after the DHCP process. As you can see, UDP broadcast works fine (do not take care of duplicated packets, it is because of the switch port mirroring), the w5100 event reply to an ARP request but then send 8 strange ARP requests with an interval of 200 ms:

Someone has already had this kind of issue ?

Thank you.

Antoine, your W5100 seems to have MAC address of a4:0d:76:48:c9:00. It sends ARP packet from already set IP address trying to find out MAC address of the host with IP address Thus W5100 just does not see IP address you write to its socket. I checked my code which works, and see that I write destination IP address and destination port after I open socket in UDP mode. Source port is initialized before I open UDP connection. Try doing the same way.

Thank you for your reply.

Unfortunately, I think it is already what I do. Here are the steps I use to send the packet (after the DHCP process which configure the w5100 with the address):

-Write value 0x02 (UDP mode) to address 0x04000 (S0_MR register) to configure Socket0 to UDP mode.
-Write value 0x07D0 (2000, my source port number) to address 0x0404-0x0405 (S0_PORT register) to set the source port.
-Write value 0x01 (SOCK_OPEN) to address 0x0401 (S0_CR register) to open the Socket0.
-Check value of address 0x403 (S0_SR register) against value 0x22 (SOCK_UDP)
-Write value 0xC0, 0xA8, 0xBC, 0xEB (, the IP of the remote host) to addresses 0x040C, 0x040D, 0x040E, 0x040F (S0_DIPR register)
-Write value 0x0FA0 (4000, the port of the remote host) to address 0x0410 (S0_DPORT register)
-Write 0xFF (the value I want to send) to address (0x4000 + (S0_TX_WR & 0x07FF)) to set the packet payload.
-Write S0_TX_WR value + 1 to address S0_TX_WR to update Write pointer for the packet payload.
-Write 0x20 (SEND) to address 0x0401 (S0_CR register) to send the packet.
-Check the value of address 0x0401 (S0_CR register) against value 0 to check that the send command is over.

Then I immediatly see the ARP requests with the address.

Maybe you will see something bad in the previous steps.


Looks correct, and I assume (as you can get packets from remote host) you use big endian for register access.
I searched through internet, and found the following:

Subject: RE: what's the meaning of the It's a way of indicating the default gateway. It appears like something is trying to identify the default gateway IP address.
Do you have correct GAR configured? You usually obtain GAR from the DHCP offer/ack packets.

Awesome !
It was indeed the GAR register that was badly set (a bug in my DHCP code. I used the Subnet register instead of the the Gateway Address one).

I would never thought about that, thank you very much.

Copyright © 2017 WIZnet Co., Ltd. All Rights Reserved.