2017-12-22 08:35 AM
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