STM32N655X0HxQ + NetX Duo DHCP client receives DHCP ACK but does not obtain IP address
Hi STM Team,
I am working on an STM32 + ThreadX + NetX Duo application with the Ethernet interface. I am facing an issue with the NetX Duo DHCP client.
My setup is:
-
MCU: STM32N655X0HxQ
-
RTOS: ThreadX
-
Network stack: NetX Duo
-
Ethernet driver: STM32 HAL Ethernet driver
-
DHCP client: NetX Duo DHCP
-
PC is running as the DHCP server
-
MCU and PC are connected on the same Ethernet network.
Observed behavior
The Ethernet interface works correctly when I configure a static IP address.
For example, with:
MCU IP : 192.168.50.50
Subnet Mask : 255.255.255.0Ethernet communication works correctly.
However, when I enable the NetX Duo DHCP client, the MCU remains stuck at:
Looking for DHCP server ..The DHCP server is running correctly on my PC.
DHCP server configuration
My PC DHCP server is configured as:
[SETTINGS]
IPPOOL_1=192.168.50.10-254
IPBIND_1=192.168.50.1
AssociateBindsToPools=1
Trace=1
DeleteOnRelease=0
ExpiredLeaseTimeout=3600
[GENERAL]
LEASETIME=86400
NODETYPE=8
SUBNETMASK=255.255.255.0
NEXTSERVER=192.168.50.1
ROUTER_0=0.0.0.0I have also configured a MAC-specific DHCP reservation:
[00-80-E1-00-10-00]
IPADDR=192.168.50.50The MCU MAC address is:
00:80:E1:00:10:00So the MAC address is correct.
Wireshark observation
I can see the complete DHCP exchange in Wireshark.
The MCU sends:
DHCP DiscoverThe PC responds with:
DHCP OfferThe MCU then sends:
DHCP RequestThe PC responds with:
DHCP ACKThe DHCP ACK contains:
Your (client) IP address: 192.168.50.50
Subnet Mask: 255.255.255.0
DHCP Message Type: ACK
Next server IP: 192.168.50.1
Client MAC: 00:80:e1:00:10:00So the PC is definitely assigning 192.168.50.50 to the MCU and sending the DHCP ACK.
However, the MCU does not proceed with the DHCP process.
Instead, I see the DHCP Request/ACK sequence repeating continuously:
DHCP Request
↓
DHCP ACK
↓
DHCP Request
↓
DHCP ACK
↓
...Ethernet RX debugging
I verified that Ethernet RX is working.
HAL_ETH_ReadData() is being called.
The NetX driver also reaches:
_nx_driver_hardware_packet_received()and:
_nx_driver_transfer_to_netx(...)Therefore, the Ethernet driver is receiving packets.
I also tried:
FilterConfig.BroadcastFilter = DISABLE;but the problem remains.
The DHCP ACK is being sent as:
Source: 192.168.50.1
Destination: 255.255.255.255which I believe should be acceptable for DHCP.
IP address change callback
I registered the NetX IP address change callback:
ret = nx_ip_address_change_notify(
&NetXDuoEthIpInstance,
ip_address_change_notify_callback,
NULL);The callback is:
static VOID ip_address_change_notify_callback(
NX_IP *ip_instance,
VOID *ptr)
{
if (nx_ip_address_get(
&NetXDuoEthIpInstance,
&IpAddress,
&NetMask) != NX_SUCCESS)
{
Error_Handler();
}
if (IpAddress != NULL_ADDRESS)
{
tx_semaphore_put(&DHCPSemaphore);
}
}However, this callback is not getting triggered.
The application therefore remains blocked at:
tx_semaphore_get(&DHCPSemaphore, TX_WAIT_FOREVER);after printing:
Looking for DHCP server ..DHCP startup code
The DHCP client is started using:
ret = nx_dhcp_start(&DHCPClient);
if (ret != NX_SUCCESS)
{
LOG_ERROR("DHCP start failed ERROR");
Error_Handler();
}
LOG_INFO("Looking for DHCP server ..");
if (tx_semaphore_get(
&DHCPSemaphore,
TX_WAIT_FOREVER) != TX_SUCCESS)
{
LOG_ERROR("tx_semaphore_get ERROR");
Error_Handler();
}Important comparison
Static IP:
Ethernet initialization → Working
Ethernet RX → Working
NetX communication → Working
Ping → Working
HTTPS web server → Working
mDNS → WorkingDHCP:
DHCP Discover → Working
DHCP Offer → Received
DHCP Request → Sent
DHCP ACK → Received
HAL_ETH_ReadData() → Called
NetX RX driver → Called
IP address → Not assigned
IP address change callback → Not triggered
DHCP Request/ACK → RepeatsMy question
Since the DHCP server is clearly sending a valid DHCP ACK containing:
192.168.50.50
255.255.255.0and the Ethernet RX path is receiving the packet, what could cause NetX Duo DHCP to not accept/process the DHCP ACK and transition to the assigned IP state?
Could this be related to:
-
NetX packet prepend/alignment?
-
STM32 Ethernet driver configuration?
-
DHCP ACK broadcast handling?
-
Any specific STM32 HAL Ethernet configuration required for NetX Duo DHCP?
Any guidance on where to debug this would be greatly appreciated.
Thank you.
