---
title: "STM32+W5500 DHCP ReRequest"
url: "https://maker.wiznet.io/forum/14129"
markdown_url: "https://maker.wiznet.io/forum/14129/md"
type: "Forum topic"
category: "Ethernet Chips"
author: "s13884"
created: "2021-01-25T14:52:00+09:00"
last_activity: "2021-02-01T07:12:51+09:00"
language: "en"
views: 1249
replies: 4
source: "WIZnet Makers forum (https://maker.wiznet.io/forum/)"
---

# STM32+W5500 DHCP ReRequest

## Question

Asked by s13884 on 2021-01-25 in Ethernet Chips.

Hi

We have an STM32 based board + W5500. We have used FreeRtos for our firmware and integrated the DHCP from WizNet IO lib. The DHCP works on boot but when we try to run it from Task/Main loop to update the lease it is unable to make request. I cannot see the logs in Wireshark.

We have a task calling DHCP_time_handler on every second & DHCP_Run() but not making request when lease time is half of dhcp_tick_1s ((dhcp_lease_time != INFINITE_LEASETIME) && ((dhcp_lease_time/2) &lt; dhcp_tick_1s)). Also I have noticed one more thing it’s not making proper request but breaking webserver part.

Any help would highly appreciated!

Regards
S

## Replies

### Reply 1 by irina, 2021-01-27

**=> in dhcp.c**
![image](https://maker.wiznet.io/forum_uploads/wiznet/original/2X/1/196552c535a43fb8c2092c521caa535a04dda6e5.png)

=> Timer handler
![image](https://maker.wiznet.io/forum_uploads/wiznet/original/2X/3/346c5fabb0fba9468eb28e4e49530eab95136c6f.png)

I think you have to check the operation of **dhcp_tick_1s**.

### Reply 2 by s13884, 2021-01-28

Hi [@irina_kim](https://maker.wiznet.io/u/irina_kim)

Thanks for your reply. I think, I resolved it, made some FreeRtos task related configuration changes and also changed logic for DHCP_time_handler, still testing. But now I have one more issue, it breaks the HTTP after renewing the DHCP lease. So do you have any idea which specific part to check for this issue? Do you think I have to close the socket before making the DHCP renew request?

Thanks & Regards
S

### Reply 3 by irina, 2021-01-28 (in reply to reply 2)

s13884:

> Do you think I have to close the socket before making the DHCP renew request?

My answer to the question is no. As far as I know, DHCP renew request packet should be sent before DHCP lease time.

s13884:

> So do you have any idea which specific part to check for this issue?

if DHCP lease time is 1 hour, it would be good to send the packet at about 50 minutes, much earlier than that time.

### Reply 4 by s13884, 2021-02-01

Hi [@irina_kim](https://maker.wiznet.io/u/irina_kim)
Thanks for your answer

I found solution, there was a problem with DHCP_IP_LEASED case and web server start/stop flag.
So my mistake was to enable the web server flag before receiving the DHCP_ACK for REREQUEST, enabled it after receiving the DHCP_ACK and it works. Still breaks sometime, after 1 or 2 hours and sometime longer so looking into it.

Thanks
S

---

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