2025-01-13 6:16 PM
I am currently working on initializing the Ethernet peripheral on the Nucleo-H723ZG using the following environment:
While calling the MX_ETH_Init() function, I encountered an issue where HAL_ETH_Init(&heth) returns HAL_ERROR. Upon debugging, I found that the problem is related to the software reset step in the initialization process.
Here is the relevant portion of the code from stm32h7xx_hal_eth.c:
/* Ethernet Software reset */
/* Set the SWR bit: resets all MAC subsystem internal registers and logic */
/* After reset all the registers holds their respective reset values */
SET_BIT(heth->Instance->DMAMR, ETH_DMAMR_SWR);
/* Get tick */
tickstart = HAL_GetTick();
/* 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;
}
}
Issue:
The software reset (SWR bit in ETH_DMAMR) is not being cleared, causing the function to timeout and return HAL_ERROR.
Solved! Go to Solution.
2025-05-15 11:07 PM
I bought a new board and tested it and it worked.