Unable to received broadcasts

#1

I am trying to implement DHCP. I opened a udp port with an IP of 0.0.0.0 and a netmask of 0.0.0.0. I can send out the discover packet but it does not receive the offer. Using a test application I sent various packets to the device.

Data from wireshark trace
This packet is NOT received by the socket.
Ethernet II, Src: Intel_a0:2c:ef (00:d0:b7:a0:2c:ef), Dst: Broadcast (ff:ff:ff:ff:ff:ff)
Destination: Broadcast (ff:ff:ff:ff:ff:ff)
Address: Broadcast (ff:ff:ff:ff:ff:ff)
Internet Protocol Version 4, Src: 192.168.1.1 (192.168.1.1), Dst: 255.255.255.255 (255.255.255.255)
User Datagram Protocol, Src Port: bootps (67), Dst Port: bootpc (68)

This packet IS received by the socket.
Ethernet II, Src: Intel_a0:2c:ef (00:d0:b7:a0:2c:ef), Dst: Broadcast (ff:ff:ff:ff:ff:ff)
Destination: Broadcast (ff:ff:ff:ff:ff:ff)
Address: Broadcast (ff:ff:ff:ff:ff:ff)
Internet Protocol Version 4, Src: 192.168.1.1 (192.168.1.1), Dst: 192.255.255.255 (192.255.255.255)
User Datagram Protocol, Src Port: bootps (67), Dst Port: bootpc (68)

I have read other post regarding broadcasts and they all seemed to be able to receive global broadcast but not local ones.
I am at a loss with this.

John Tarbotton

#2

Hi jatabotton,

We will check your problem.
Could you explain the Network information as like SRC IP/ Netmask / Subnet of W5200?

Thanks.

#3

This is for DCHP so all that is unknown hence the broadcasts. As stated to W5200 is configured with a source IP of 0.0.0.0 and a netmask of 0.0.0.0 at this time. The host PC sending the packet was was configured with a netmask of 255.0.0.0 when that trace was taken but class B and class C networks have also been tried with similiar results.

I have since downloaded the file W7200_AN_DHCP_SMTP_V111.zip and I do not see anything I am doing different.

#4

Hi,

You connect

W5200 <-------direct-------> PC

???
Or via router or switch ??

#5

I have them connected using a Hub. I was concerned the packets were not reaching the W5200 so I connected a second PC to the hub and ran the wireshark trace on that and it showed the packet. Also the light blinks when on the W5200 when I send the broadcast from the PC so it seems the packet is reaching the device.

#6

You problem is that you can’t capture and received the DHCP discovery packet(broadcast) on wireshark with dummy hub.

We guess that UDPsend command could called before linking of PHY in W5200.

For checking the link status of PHY, you added below code before UDPsend.

/**
 @brief PHY Status Register
 */
#define PHY				(COMMON_BASE + 0x0035)
...

while( (iinchip_read(PHY)&0x20) !=0x20 ); //wait PHY Link Done

Please, refer PHYSTATUS register as follows

[quote]PHYSTATUS(W5200 PHY status Register)[R/W][0x0035][0x00]
PHYSTATUS is the Register to indicate W5200 status of PHY.
Bit Symbol Description
7 Reserved Reserved
6 Reserved Reserved
5 LINK
Link Status Register[Read Only]
This register indicates Link status.
0 : Link down
1 : Link Up
4 Reserved Reserved
3 POWERDOWN
Power down mode of PHY[Read/Write]
This register indicates status of Power down mode
0 : Disable Power down mode(operates normal mode)
1 : Enable Power down mode
2 Reserved Reserved
1 Reserved Reserved
0 Reserved Reserved
[/quote]

And, we recommend that DHCP discovery have to retry just in case DHCP fails.

#7

Thanks for he reply.

However I am already doing that. The DISCOVERY packet is being sent out and the DHCP server sends out an OFFER but the offer is not being received by udp socket.

#8

I think the hub discard the OFFER packet.

I tested W5200 received broadcast packet well.

So, for test, connect PC to W5200 directly or use another hub.

#9

I tested DHCP. And DHCP worked very well.

I attached driver file for DHCP at W7200 application note.

wiznet.co.kr:8011/UpLoad_Fi … P_V111.zip

And this is wireshark packet capture file. Refer to it.

dhcp.zip (377 Bytes)

#10

Thanks for the trace. That at least is confirmation it is possible for the W5200 to receive the broadcast. I had already downloaded and reviewed the source you referred to. We are now going to try a W5200Emu module and put in the sample code, verify it works and then try to break it the same way to figure out the problem.

We are sure the hub is not dropping the packets. That is where the extra pc running wireshark is. We tried a direct connection to the pc first. We had aTCP loopback running with static ip before working on the dhcp.

#11

We found the problem. UDP does not seem to work correctly if the MF (MAC Filtering bit) is set in the SN_MR register. The documentation should be updated to reflect this. Setting this bit seems like the correct think to do. Otherwise it seems you want promiscuous mode which I do not. It is strange that setting this changed the way it responded to IP addresses even though the MAC address was not changed. We dumped all the registers from the W5200-EVB and this was the difference. We were able to reproduce the problem in the W5200-EVB by setting this bit.

#12

MAC filter is working only MAC raw mode not UDP or TCP.
We will change description of data sheet as user can understand well.
And don’t use MAC filter when TCP or UDP mode.