2023-11-27 07:42 AM
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
Solved! Go to Solution.
2023-11-30 06:21 AM
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:
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.
2023-11-28 01:54 AM
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.
2023-11-28 02:00 AM
Yes, I read this page and other similar ones, but they didn't help me.
2023-11-28 07:02 PM
2023-11-30 06:21 AM
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:
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.