STM32+W5500 DHCP ReRequest

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) < 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

=> in dhcp.c
image

=> Timer handler
image

I think you have to check the operation of dhcp_tick_1s.

Hi @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

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

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

Hi @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