2025-01-13 06: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.
2025-01-13 07:46 PM
Timeout in this place usually means a problem with initialization of the PHY.
Please start with one of available ETH sample projects in the H7 Cube package or here. Do not change anything until the project "works" (at least the board responds to ping). Use isolated network segment for testing.
2025-01-14 12:10 AM
Thank you for your response.
I conducted tests using the source code available at the following path:
https://github.com/stm32-hotspot/STM32H7-LwIP-Examples/tree/main/STM32H723_Nucleo_ETH
However, I was unable to verify proper operation.
In the source file
https://github.com/stm32-hotspot/STM32H7-LwIP-Examples/blob/main/STM32H723_Nucleo_ETH/LWIP/Target/ethernetif.c,
the `low_level_init` function leads to Error_Handler.
The issue seems to be with the following statement:
hal_eth_init_status = HAL_ETH_Init(&heth);
The `hal_eth_init_status` is returned as 1.
The testing environment is as follows:
2025-01-14 05:42 AM
Hello @cbsim ,
the example that you are trying to implement was developed for an older version of tools and an old version of Cube Firmware and migrating it may make you encounter some issues.
my recommendation is to try, and examples installed with Cube Firmware version 1.17.2, and which will insure us that no hardware related issues are found.
try this example and let me know if you face any issues STM32CubeH7/Projects/NUCLEO-H723ZG/Applications/LwIP/LwIP_UDP_Echo_Server at master · STMicroelectronics/STM32CubeH7 · GitHub
Regards
2025-01-14 04:19 PM - edited 2025-01-14 04:20 PM
Thank you for your response.
Environment:
I tested the `LwIP_UDP_Echo_Server` example you recommended using the following steps:
- New > STM32 Project > Example Selector.
However, the same issue occurs in the `low_level_init()` function of `ethernetif.c.
The statement
HAL_ETH_Init(&EthHandle);
returns 1.
2025-01-14 04:43 PM
> The `hal_eth_init_status` is returned as 1.
Value 1 indeed is HAL_ERROR. If it stems from the same place in stm32h7xx_hal_eth.c, and the project is not modified (optimization level etc.) - check the hardware, power, ethernet cable, hub/switch...
2025-01-14 05:43 PM
Thank you for your response.
Currently, I have two Nucleo-H723 boards and two Nucleo-H755 boards.
Since LwIP and Ethernet work properly on the H755 boards, it is difficult to conclude that this is a network device issue. However, as both H723 boards exhibit the same error, it is also hard to determine that this is a device-specific issue.
That said, considering the possibility of aging hardware, I will purchase new H723 boards and perform additional checks.
The attached photo shows the H723 board with an Ethernet cable connected, and both LEDs on the RJ45 port are lit.