Applying a static IP

I have my wiznet chip up and running, and have a static IP assigned to it. It all seems to work no problem with the network. Question: When I assign the static IP, what is the best way to make sure that the IP isn’t already in use on the network?

The static IP address is provided by ISP(internet service provider).
You can’t use the IP address made in any.

Thank you.

Maybe you have some embedded systems behind a NAT or a private local network with IPs allocated by hand or automatically generated by the embedded systems.
Question is valid.
How can you realize that the current W5500’s IP is used by other machine too?
How will behave the W5500 when you set inside, by mistake, an IP already on the network?
How can you realize, by reading W5500 registers, that the local IP is already used on the network?


If the already used IP address is assigend to W5500, W5500 occurs the IP-conflict interrupt in IR register.
IP-Conflict interrupt is occurred in sending data.

If you want to know the ip address is conflict or not, You just send any data to the IP address by using UDP socket.
If normaly the data is sent, the ip-address is already used. you can’t not use the ip address.
If the data can’t be sent, You can used the ip address.

The following example show how to check IP conflict in DHCP processing.

int8_t check_DHCP_leasedIP(void)
	uint8_t tmp;
	int32_t ret;

	//WIZchip RCR value changed for ARP Timeout count control
	tmp = getRCR();

	// IP conflict detection : ARP request - ARP reply
	// Broadcasting ARP Request for check the IP conflict using UDP sendto() function
	ret = sendto(DHCP_SOCKET, (uint8_t *)"CHECK_IP_CONFLICT", 17, DHCP_allocated_ip, 5000);

        // RCR value restore

	if(ret == SOCKERR_TIMEOUT) {
		// UDP send Timeout occurred : allocated IP address is unique, DHCP Success

#ifdef _DHCP_DEBUG_
		printf("\r\n> Check leased IP - OK\r\n");

		return 1;
	} else {
		// Received ARP reply or etc : IP address conflict occur, DHCP Failed
		ret = dhcp_tick_1s;
		while((dhcp_tick_1s - ret) < 2);   // wait for 1s over; wait to complete to send DECLINE message;

		return 0;

This code can be downloaded at [url][/url].
ioLibrary_BSD includes “Ethenet” and “Internet”. DHCP code are in “Internet”.

Thank you.

Thank you!
All clear now for me.