cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F769 Disco LWIP DHCP Can not get IP address

qqAnton
Senior

Hello,

I am currently working on the project with STM32F769 Disco and i want to use ethernet (with RTOS).

I configured all the options in CubeMX and I have a problem with getting IP address using DHCP.

The problem is that I get the IP address only in 50% of my tries.

I turned on LWIP Stats, this is example when I get ip address:

dhcp_start(netif=20003314) st0
 
dhcp_start(): mallocing new DHCP client
 
dhcp_start(): allocated dhcpdhcp_start(): starting DHCP configuration
 
dhcp_discover()
 
transaction id xid(181c)
 
dhcp_discover: making request
 
dhcp_discover: realloc()ing
 
dhcp_discover: sendto(DISCOVER, IP_ADDR_BROADCAST, DHCP_SERVER_PORT)
 
dhcp_discover: deleting()ing
 
Assertion "dhcp_delete_msg: dhcp->p_out != NULL" failed at line 1902 in ../Middlewares/Third_Party/LwIP/src/core/ipv4/dhcp.c
 
Assertion "dhcp_delete_msg: dhcp->msg_out != NULL" failed at line 1903 in ../Middlewares/Third_Party/LwIP/src/core/ipv4/dhcp.c
 
dhcp_discover: SELECTING
 
dhcp_discover(): set request timeout 4000 msecs
 
dhcp_recv(pbuf = 2000a53c) from DHCP server 192.168.63.2 port 67
 
pbuf->len = 308
 
pbuf->tot_len = 308
 
netif->hwaddr[0]==12 != reply_msg->chaddr[0]==2c
 
dhcp_fine_tmr(): request timeout
 
dhcp_timeout()
 
dhcp_timeout(): CHECKING, ARP request timed out
 
dhcp_bind(netif=20003314) st0
 
dhcp_bind(): t0 renewal timer 691200 secs
 
dhcp_bind(): set request timeout 691200000 msecs
 
dhcp_bind(): t1 renewal timer 345600 secs
 
dhcp_bind(): set request timeout 345600000 msecs
 
dhcp_bind(): t2 rebind timer 604800 secs
 
dhcp_bind(): set request timeout 604800000 msecs
 
dhcp_bind(): IP: 0x7f3fa8c0 SN: 0x00ffffff GW: 0x0b3fa8c0

And this is the example when I can not get IP address 

dhcp_start(netif=20003314) st0
 
dhcp_start(): mallocing new DHCP client
 
dhcp_start(): allocated dhcpdhcp_start(): starting DHCP configuration
 
dhcp_discover()
 
transaction id xid(181c)
 
dhcp_discover: making request
 
dhcp_discover: realloc()ing
 
dhcp_discover: sendto(DISCOVER, IP_ADDR_BROADCAST, DHCP_SERVER_PORT)
 
dhcp_discover: deleting()ing
 
dhcp_discover: SELECTING
 
dhcp_discover(): set request timeout 2000 msecs
 
dhcp_fine_tmr(): request timeout
 
dhcp_timeout()
 
dhcp_timeout(): restarting discovery
 
dhcp_discover()
 
transaction id xid(181c)
 
dhcp_discover: making request
 
dhcp_discover: realloc()ing
 
dhcp_discover: sendto(DISCOVER, IP_ADDR_BROADCAST, DHCP_SERVER_PORT)
 
dhcp_discover: deleting()ing
 
dhcp_discover: SELECTING
 
dhcp_discover(): set request timeout 4000 msecs
 
dhcp_fine_tmr(): request timeout
 
dhcp_timeout()
 
dhcp_timeout(): restarting discovery
 
dhcp_discover()
 
transaction id xid(181c)
 
dhcp_discover: making request
 
dhcp_discover: realloc()ing
 
dhcp_discover: sendto(DISCOVER, IP_ADDR_BROADCAST, DHCP_SERVER_PORT)
 
dhcp_discover: deleting()ing
 
dhcp_discover: SELECTING
 
dhcp_discover(): set request timeout 8000 msecs

What could be a solution for such problem?

Thnak you,

Anton

6 REPLIES 6
NathanWolcott
Associate III

Have you configured the MPU regions and ETH DMA descriptor addresses correctly as described in the Ethernet Not Working FAQ?

If these are wrong, the code will usually still run but will simply not be able to communicate with the Ethernet peripheral.

I haven't checked for the very latest version of the firmware bundle but in the previous version CubeMX would not configure this correctly. You had to set it up manually.

Here's the link to the FAQ: https://community.st.com/s/article/FAQ-Ethernet-not-working-on-STM32H7x3

Thank you for the answer, but it's still the same

Piranha
Chief II

It's sad, but ST's ETH driver and lwIP integration has so many problems and bugs, that it is a coincidence that it (sometimes) works at all.

You can try my demonstration firmware to at least make sure You don't have any network problems:

https://community.st.com/s/question/0D50X0000AhNBoWSQW/actually-working-stm32-ethernet-and-lwip-demonstration-firmware

Thank you, I will try.

  • I have a feeling that I am doing something wrong with memory, FAQ says that "Projects generated with STM32CubeMX can put variables by default to DTCM RAM. The solution is to place them to D1 SRAM (starting at 0x24000000)."

Could you tell me how to place variables to another memory?

It can be seen in ST's examples at a top of ethernetif.c file, but in STM32F7 ETH DMA can access DTCM RAM, so for a STM32F7 that point is not true.

Thanks,

I am curious about

Assertion "dhcp_delete_msg: dhcp->p_out != NULL" failed at line 1902 in ../Middlewares/Third_Party/LwIP/src/core/ipv4/dhcp.c
Assertion "dhcp_delete_msg: dhcp->msg_out != NULL" failed at line 1903 in ../Middlewares/Third_Party/LwIP/src/core/ipv4/dhcp.c

I tried many times and that only happens when I succesfully get the IP address