2025-07-14 6:16 AM - edited 2025-07-14 6:23 AM
Hi,
I'm using an STM32H7 board with a LAN8742 PHY, configured via STM32CubeMX.
LwIP is initialized without RTOS, and Ethernet is in RMII mode.
The main goal of this project is to receive data over UART and forward it via Ethernet.
I want the STM32 board to connect to a standard router using a physical Ethernet cable, obtain a dynamic IP address via DHCP, and then transmit the received UART data over the network.
Currently, the board does not seem to request or receive any IP address — while the PC connected to the same router receives an IP successfully, the STM32 does not.
So far I've verified:
MX_LWIP_Init() is called from main.c
MX_LWIP_Process() is called inside the main while (1) loop
MAC address is manually set in ethernetif.c:
MACAddr[0] = 0x02;
MACAddr[1] = 0x12;
MACAddr[2] = 0x34;
MACAddr[3] = 0x56;
MACAddr[4] = 0x78;
MACAddr[5] = 0x9A;
DHCP is enabled in .ioc under LwIP configuration
netif_add(), netif_set_default(), netif_set_up() and dhcp_start() are called
ETH is initialized and started (HAL_ETH_Init() and HAL_ETH_Start() succeed)
netif_set_link_up() is called after starting ETH
I verified with Wireshark: no DHCP Discover is sent from the STM32
Any idea what might be missing or preventing DHCP packets from being sent?
Thanks in advance.
Hardware setup:
The board is connected via Ethernet to a local router that acts as a DHCP server. I verified that the same cable and port work with other devices.