cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F779 Ethernet LwIP DHCP not working

Io D
Associate II
Posted on February 23, 2017 at 17:30

Hi,

I am currently working with STM32F779 and i'm trying to obtain an IP address using the LwIP Middleware unsuccessfully.

Here are the configurations:

1. Change some jumpers according to the user manual page 23.

http://www.st.com/content/ccc/resource/technical/document/user_manual/group0/64/5f/b4/25/72/a8/44/d9/DM00276570/files/DM00276570.pdf/jcr:content/translations/en.DM00276570.pdf

0690X00000603ecQAA.jpg

2.  Using the STM32CubeMX, i've made the following configurations

0690X00000603e4QAA.jpg

3. In the header file lwip.h i have extern the following variables (used in lwip.c file)  because they will also be used at freertos.c file :

extern struct netif gnetif;

extern ip4_addr_t ipaddr;

extern ip4_addr_t netmask;

extern ip4_addr_t gw;

4. In the source file

freertos.c

, inside the defaultThread, i have the following:

MX_LWIP_Init();

while (gnetif.ip_addr.addr == 0)

{

   sys_msleep(DHCP_FINE_TIMER_MSECS);

   dhcp_fine_tmr();

   mscnt += DHCP_FINE_TIMER_MSECS;

   if (mscnt >= DHCP_COARSE_TIMER_SECS * 1000)

   {

      dhcp_coarse_tmr();

      mscnt = 0;

   }

   BSP_LCD_DisplayStringAtLine(20,''DHCP Negotiating'');

}

Unfotunately, the

gnetif.ip_addr.addr

is not changing as it should be after obtaining an IP address.

Is there something that i am missing?  

Please help me to find the right solution.

Kind regards,

Ioannis

#stm32f779-cubemx-hal #dhcp #lwip
4 REPLIES 4
Imen.D
ST Employee
Posted on March 15, 2017 at 14:32

Hi,

You may refer to LwIP examples available in STM32CubeF7 package and compare your own project with the working application available there, in order to deduce what is going wrong in your case:

 STM32Cube_FW_F7_V1.6.0\Projects\STM32F769I_EVAL\Applications\LwIP

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

Any other alternatives to solve this? Thank you in advance.

Edith
Associate II

Hello, were you able to solve this? It would be really helpful if you could share it here. Thanks

Edith
Associate II

I am trying to build a Webserver to display a index.html and a 404 error upon receiving http request. A custom made board is used for this application which has a STM32F69NI MCU. More details about the board can be found here.

I am getting the IP address but once I enable the HTTPD in the ioc file then the below statement is always false:

 

extern struct netif gnetif;
 
if (gnetif.ip_addr.addr != 0) {
    .......
    .......
    .......
  }
 
The example that I am trying to recreate are:
 
Unfortunately none of them works. Its always the same ip address problem and I tried disabling the DHCP and assigning a static ip,netmask and gateway. Then ofcoure the above If statement becomes valid, however it still does not work. I tried pinging the static ip but it was not reachable. So I am guessing its a problem with the LwIP stack  after I enable the httpd.  
 
Any suggestions or am I doing something terribly wrong? Thank you in advance.