2025-07-06 5:14 AM - edited 2025-07-06 5:15 AM
Hello everyone,
I'm working on a custom board that uses the STM32H723ZGT6 together with the LAN8742A-CZ-TR Ethernet PHY.
During the call to HAL_ETH_Init() in the stm32h7xx_hal_eth.c file, the initialization fails and gets stuck in this loop:
/* Wait for software reset */
while (READ_BIT(heth->Instance->DMAMR, ETH_DMAMR_SWR) > 0U)
{
if ((HAL_GetTick() - tickstart) > ETH_SWRESET_TIMEOUT)
{
/* Set Error Code */
heth->ErrorCode = HAL_ETH_ERROR_TIMEOUT;
/* Set State as Error */
heth->gState = HAL_ETH_STATE_ERROR;
/* Return Error */
return HAL_ERROR;
}
}
I suspect the issue may be related to the NRST pin.
On my PCB, I have connected the NRST pin of the LAN8742A to both
the MCU's NRST and the ST-Link NRST pin — similar to what is shown
in the STM32H7 Nucleo-144 (MB1364) reference design.
However, when I checked the LAN8742A datasheet,
it suggests that this pin should be driven in a specific way
Could this NRST wiring be the reason for the reset timeout?
If yes, how does the MB1364 board manage to work with this configuration?
I’ve also checked my GPIO and Ethernet settings — everything seems correct,
but the issue persists.
Does anyone have an idea what could be causing this problem?
Any suggestions are highly appreciated.
Thank you in advance!
2025-07-06 4:59 PM - edited 2025-07-06 5:07 PM
From the datasheet, Tpurstv is neglectable; Trstia is ~100us (reasonable for NRST assertion) and Tpurstd is 25 ms.
So, this likely can work if you wait > 25 ms before calling HAL_ETH_Init.
HAL_ETH_Init needs handshake with the PHY and will timeout if the PHY is not ready. If it gets stuck instead of returning with HAL_ETH_ERROR_TIMEOUT, your HAL timer is not running.
2025-07-06 7:48 PM
Hello
I would suggest you:
1/ add below SYSCFG->PMCR to check if any improve? under stm32h7xx_hal_eth.c
2/ double check MCU PA1 pin (RMII_REF_CLK) thru oscilloscope if have right clock input?
thanks!