cancel
Showing results for 
Search instead for 
Did you mean: 

Ethernet Initialization on Nucleo-H723ZG (HAL_ETH_Init returns HAL_ERROR)

cbsim
Associate II

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.

10 REPLIES 10

I bought a new board and tested it and it worked.