cancel
Showing results for 
Search instead for 
Did you mean: 

Application compiler error in STM32Cube_FW_F4

Junde
Senior II

Hi there,

I am using cubeMx to config the LwIP project which is based on STM32F429BI;

I connect the MCU to the route and ping the MCU by PC successfully in DHCP or static IP mode.

I can normally get the MCU IPv4 address in static IP mode but fail in DHCP mode.

my code for getting the IP address is below:

#if LWIP_DHCP
if(ip4_addr_isany_val(*netif_ip4_addr(&gnetif))) {
  LOG_DBG("DHCP enabled, check the IP in route\n");    // in DHCP mode, always print this line
} else {
  LOG_DBG(" IP : %s\n", ip4addr_ntoa(netif_ip4_addr(&gnetif)));
  LOG_DBG("Mask: %s\n", ip4addr_ntoa(netif_ip4_netmask(&gnetif)));
  LOG_DBG(" GW : %s\n", ip4addr_ntoa(netif_ip4_gw(&gnetif)));
}
#else
  LOG_DBG(" IP : %s\n", ip4addr_ntoa(netif_ip4_addr(&gnetif)));
  LOG_DBG("Mask: %s\n", ip4addr_ntoa(netif_ip4_netmask(&gnetif)));
  LOG_DBG(" GW : %s\n", ip4addr_ntoa(netif_ip4_gw(&gnetif)));
#endif

I don't know why this code always gets the DHCP IP address 0.

Any information is welcome, thank you!

1 REPLY 1
Junde
Senior II

more info:

Junde_0-1721015413107.png