cancel
Showing results for 
Search instead for 
Did you mean: 

Init Ethernet on STM32H7 error

FMass.1
Associate III

Hi, I'm trying to create my first project with ethernet on STM32H7. I tried to give an example with a nulceo with a similar chip and I succeeded, now I'm moving on to my custom board.

I configured the system with STM32CubeIDE, generated the code and just tried to launch the program, what happens is that during initialization, at this point:

 

  /* Dummy read to sync with ETH */
  (void)SYSCFG->PMCR;

  /* 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;
    }
  }

 

I get the return HAL_ERROR; error and the program stops.
Can you help me understand where the problem is?
I attach the ioc file that I used to generate the code, if you think the problem may be in the hardware part, I can also send the electrical diagram and layout.

Thanks in advance.

IOC File: https://drive.google.com/file/d/1BTQGlH5RxBeBbijaUmBP7SGDBpZXNBO-/view?usp=drive_link

1 ACCEPTED SOLUTION

Accepted Solutions
FMass.1
Associate III

I think I've found the problem. The problem was the Ethernet connector I was using, basically the connector has LEDs that can be used in both polarities:

FMass1_0-1701354061560.png

And this was going to disturb the polarization of pin 2, and consequently the clock was not arriving well at the PHY. After changing the connector, the LEDs light up well, I no longer have the initial error.

View solution in original post

4 REPLIES 4
FBL
ST Employee

Hello @FMass.1 

The following knowledge base should help.

How to create project for STM32H7 with Ethernet an... - STMicroelectronics Community

 

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.

FMass.1
Associate III

Yes, I read this page and other similar ones, but they didn't help me.

FMass.1
Associate III

I think I've found the problem. The problem was the Ethernet connector I was using, basically the connector has LEDs that can be used in both polarities:

FMass1_0-1701354061560.png

And this was going to disturb the polarization of pin 2, and consequently the clock was not arriving well at the PHY. After changing the connector, the LEDs light up well, I no longer have the initial error.