cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeMx with STM32F107 and LwIP question ??

antonius
Senior
Posted on July 14, 2015 at 15:24

Guys,

I tried to run LwIP on my STM32F107, the code is generated from STM32CubeMx, I used ethernet for it RMII, and Here's the code :

void MX_LWIP_Init(void)
{
IP_ADDRESS[0] = 10;
IP_ADDRESS[1] = 0;
IP_ADDRESS[2] = 0;
IP_ADDRESS[3] = 5;
NETMASK_ADDRESS[0] = 255;
NETMASK_ADDRESS[1] = 255;
NETMASK_ADDRESS[2] = 255;
NETMASK_ADDRESS[3] = 0;
GATEWAY_ADDRESS[0] = 10;
GATEWAY_ADDRESS[1] = 0;
GATEWAY_ADDRESS[2] = 0;
GATEWAY_ADDRESS[3] = 1;
/* Initilialize the LwIP stack */
lwip_init();
IP4_ADDR(&ipaddr, IP_ADDRESS[0], IP_ADDRESS[1], IP_ADDRESS[2], IP_ADDRESS[3]);
IP4_ADDR(&netmask, NETMASK_ADDRESS[0], NETMASK_ADDRESS[1] , NETMASK_ADDRESS[2], NETMASK_ADDRESS[3]);
IP4_ADDR(&gw, GATEWAY_ADDRESS[0], GATEWAY_ADDRESS[1], GATEWAY_ADDRESS[2], GATEWAY_ADDRESS[3]); 
/* add the network interface */
netif_add(&gnetif, &ipaddr, &netmask, &gw, NULL, ðernetif_init, ðernet_input);
/* Registers the default network interface */
netif_set_default(&gnetif);
if (netif_is_link_up(&gnetif))
{
/* When the netif is fully configured this function must be called */
netif_set_up(&gnetif);
}
else
{
/* When the netif link is down this function must be called */
netif_set_down(&gnetif);
}

I tried to connect to my computer, but my computer can not recognized it.... It can detect the network from STM32, but the IP is not 0.0.5, it's 1.252 Why ? Any ideas ? Thanks
0 REPLIES 0