Skip to main content
FMass.1
Associate III
November 27, 2023
Solved

Init Ethernet on STM32H7 error

  • November 27, 2023
  • 4 replies
  • 2314 views

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

This topic has been closed for replies.
Best answer by FMass.1

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.

4 replies

ST Technical Moderator
November 28, 2023

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 "Best answer" on the reply which solved your issue or answered your question.Best regards,FBL
FMass.1
FMass.1Author
Associate III
November 28, 2023

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

FMass.1
FMass.1AuthorBest answer
Associate III
November 30, 2023

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.