cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H7 DHCP Error

MDS
Associate III
Posted on December 22, 2017 at 17:35

I am using the STM32H743 NUCLEO-144, CubeMX V4.23.0, and CubeH7 V1.1.0.

I do not see how DHCP can ever work using the CubeMX generated code. At the end of MX_LWIP_Init() is the only place where dhcp_start() is called. For dhcp_start() to run, the net_set_up() must have been called to bring the link up. Only the ethernet_link_thread() task calls netif_set_up() to bring the link up. Notice that ethernet_link_thread() is started just above the call to dhcp_start() in MX_LWIP_Init(), so it has not started yet, so the link is down, dhcp_start() fails and DHCP can never work.

To make DHCP run, I moved the call to dhcp_start() into the ethernet_link_thread() task at the bottom of the if(linkchanged) code, which is only runs when the link changes from down to up. Now DHCP works.

#stm32h7-dhcp
0 REPLIES 0