cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F439 FreeRTOS lwip stuck in dhcp_start() during init

debug
Associate III

Hi,

 

I'm writing an application with Ethernert access but have troubles to acquire an IP from the network. I have the Ethernet cable plugged in but during init my application hangs in dhcp_start(&gnetif) (at the call to dhcp_discover(netif) - at udp_sendto_if_src(dhcp_pcb, p_out, IP_ADDR_BROADCAST, LWIP_IANA_PORT_DHCP_SERVER, netif, IP4_ADDR_ANY);). Where the arguments look like:

netifstruct netif *0x2000095c <gnetif>
next struct netif * 0x0
ip_addr ip_addr_t {...}
netmask ip_addr_t {...}
gw ip_addr_t {...}
input netif_input_fn 0x80082d9 <tcpip_input>
output netif_output_fn 0x8012669 <etharp_output>
linkoutput netif_linkoutput_fn 0x8004be5 <low_level_output>
link_callback netif_status_callback_fn 0x8004939 <ethernet_link_status_updated>
state void * 0x0
client_data void *[1] 0x20000980 <gnetif+36>
mtu u16_t 1500
hwaddr u8_t [6] 0x20000986 <gnetif+42>
hwaddr_len u8_t 6 '\006'
flags u8_t 15 '\017'
name char [2] 0x2000098e <gnetif+50>
num u8_t 0 '\0'
rs_count u8_t 0 '\0'
msg_outstruct dhcp_msg *0x20009384 <ram_heap+140>
op u8_t 1 '\001'
htype u8_t 1 '\001'
hlen u8_t 6 '\006'
hops u8_t 0 '\0'
xid u32_t 1190573387
secs u16_t 0
flags u16_t 0
ciaddr ip4_addr_p_t {...}
yiaddr ip4_addr_p_t {...}
siaddr ip4_addr_p_t {...}
giaddr ip4_addr_p_t {...}
chaddr u8_t [16] 0x200093a0 <ram_heap+168>
sname u8_t [64] 0x200093b0 <ram_heap+184>
file u8_t [128] 0x200093f0 <ram_heap+248>
cookie u32_t 1666417251
options u8_t [68] 0x20009474 <ram_heap+380>
dhcpstruct dhcp *0x20009300 <ram_heap+8>
xid u32_t 1270216262
pcb_allocated u8_t 1 '\001'
state u8_t 6 '\006'
tries u8_t 0 '\0'
subnet_mask_given u8_t 0 '\0'
request_timeout u16_t 0
t1_timeout u16_t 0
t2_timeout u16_t 0
t1_renew_time u16_t 0
t2_rebind_time u16_t 0
lease_used u16_t 0
t0_timeout u16_t 0
server_ip_addr ip_addr_t {...}
offered_ip_addr ip4_addr_t {...}
offered_sn_mask ip4_addr_t {...}
offered_gw_addr ip4_addr_t {...}
offered_t0_lease u32_t 0
offered_t1_renew u32_t 0
offered_t2_rebind u32_t 0
resulterr_t0 '\0'
msecsu16_t2049
iu8_t3 '\003'
p_outstruct pbuf *0x2000933c <ram_heap+68>
next struct pbuf * 0x0
payload void * 0x20009384 <ram_heap+140>
tot_len u16_t 308
len u16_t 308
type_internal u8_t 128 '\200'
flags u8_t 0 '\0'
ref u8_t 1 '\001'
if_idx u8_t 0 '\0'
options_out_lenu16_t12

Can someone help me out with this,please?

 

1 REPLY 1
STea
ST Employee

Hello @debug ,

you can refer to the example in the Cube F4 firmware Projects\STM32F429ZINucleo\Applications\LwIP\LwIP_HTTP_Server_Netconn_RTOS. this example can be used with DHCP when a Dhcp server is available as detailed in the Readme file of the project .

you will find a working implementation of the DHCP feature in the app_ethernet.c file in this project if you have any question regarding the implementation feel free to ask them .

BR

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.