Skip to main content
Associate
January 14, 2025
Solved

Ethernet Initialization on Nucleo-H723ZG (HAL_ETH_Init returns HAL_ERROR)

  • January 14, 2025
  • 2 replies
  • 2320 views

I am currently working on initializing the Ethernet peripheral on the Nucleo-H723ZG using the following environment:

  • CubeIDE Version: 1.17.0 (MacOS)
  • STM32Cube Firmware Version: H7 V1.12.1

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.

Best answer by STea

Hello @cbsim ,

it seems like there is a problem with your board.

I have tried this example on a NUCLEO-H723ZG-E01 with a Rev Z microcontroller and bootloader version 0x93

STea_0-1736934197935.png

the example is working as expected without any issues.
Regards

2 replies

Pavel A.
Super User
January 14, 2025

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.

 

 

cbsimAuthor
Associate
January 14, 2025

@Pavel A. 

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:

  • Nucleo-H723ZG
  • CubeIDE Version: 1.17.0 (MacOS)
  • STM32Cube Firmware Version: H7 V1.12.1
ST Employee
January 14, 2025

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

 

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
LCE
Principal II
May 16, 2025

There are lots of optional resistors / jumpers on the board, check the user manual and the board.