---
title: "W5500 DHCP client doesn't accept DHCP Offer"
url: "https://maker.wiznet.io/forum/13900"
markdown_url: "https://maker.wiznet.io/forum/13900/md"
type: "Forum topic"
category: "Ethernet Chips"
author: "Mr Diba"
created: "2020-06-19T17:04:56+09:00"
last_activity: "2020-06-23T00:18:16+09:00"
language: "en"
views: 1559
replies: 2
source: "WIZnet Makers forum (https://maker.wiznet.io/forum/)"
---

# W5500 DHCP client doesn't accept DHCP Offer

## Question

Asked by Mr Diba on 2020-06-19 in Ethernet Chips.

Hi all,

I have been struggeling with this all day and I can not figure it out what the problem is.
I made a application with a STM32L431CC and a W5500. Using the ioLibrary Drivers I’m trying to assign a IP address to my device.

From a cold boot of the system the following (simplefied version) will happen:

```
w5500_init(); // Initialize the w5500 with the SPI settings and a MAC address.
w5500_version(); // Check the version (check if the SPI is communicating correctly)
w5500_init_dhcp(); // Init the DHCP and set the callbacks (Socket is 0 and buffersize is 2048 byte)

while(1) {
  DHCP_run()
}
```

The system will boot up and produce the following debug output:

```
w5500_init() called!
Registering W5500 callbacks...
Calling wizchip_init()...
Version is: OK
DHCP enabled
Init DHCP
Registering DHCP callbacks...
> Send DHCP_DISCOVER
<<timeout>> state : STATE_DHCP_DISCOVER 
> Send DHCP_DISCOVER
...
```

When watching the trafic in Wireshark I see the following:

| src | dst | Protocol | Size | Comment |
| --- | --- | --- | --- | --- |
| 0.0.0.0 | 255.255.255.255 | DHCP | 590 | DHCP Discover - Transaction ID 0x12345679 |
| 192.168.2.1 | 255.255.255.255 | DHCP | 342 | DHCP Offer - Transaction ID 0x12345679 |
| … |  |  |  |  |
| 0.0.0.0 | 255.255.255.255 | DHCP | 590 | DHCP Discover - Transaction ID 0x12345679 |
| 192.168.2.1 | 255.255.255.255 | DHCP | 342 | DHCP Offer - Transaction ID 0x12345679 |

And this in a continous loop.

Strange thing is; when I’m resetting the microcontroller (and thus re-initializing the W5500 without power loss) It will receive a IP no problem. But resetting the microcontroller everytime from a cold boot is a no go.

Does anyone have any idea what the problem could be?

Thank you in advance!

## Replies

### Reply 1 by becky, 2020-06-22

I am wondering if you are using the most recent ioLibrary.
IoLibrary has been updated by finding a bug similar to yours.

![](https://github.githubassets.com/favicons/favicon.svg) [GitHub](https://github.com/Wiznet/ioLibrary_Driver)

![](https://maker.wiznet.io/forum_uploads/wiznet/original/2X/1/17f66f2e9c27f9749e7af3ad7efe15d9492bea3b.png)

### [GitHub - Wiznet/ioLibrary_Driver: ioLibrary_Driver can be used for the...](https://github.com/Wiznet/ioLibrary_Driver)

ioLibrary_Driver can be used for the application design of WIZnet TCP/IP chips as W5500, W5300, W5200, W5100 W5100S. - GitHub - Wiznet/ioLibrary_Driver: ioLibrary_Driver can be used for the applica...

The parseDHCPMSG() function should contain the following.

[![image](https://maker.wiznet.io/forum_uploads/wiznet/original/2X/9/932516ed7e929961e9d4f3a1fb41601b4f4a0ced.png) image971×226 8.46 KB](https://maker.wiznet.io/forum_uploads/wiznet/original/2X/9/932516ed7e929961e9d4f3a1fb41601b4f4a0ced.png)

### Reply 2 by Mr Diba, 2020-06-22 (in reply to reply 1)

Hi Becky,

I’m currently using the most recent ioLibrary. As I was starting to write you about this the DHCP client started to do it’s job without changing the software. I think you have a positive impact on my software.

For now, thank you!

---

Source: https://maker.wiznet.io/forum/13900
