2023-04-03 07:24 AM
Hello everyone,
I am trying to get the Ethernet interface on the STM32H753ZIT up and running using CubeMX. The goal is that I can ping the µC. It is not an Evalboard but a self developed board. Unfortunately I don't have the schematic.
I have already searched very intensive the internet and worked through different tutorials but I always have the same error: during the initialization of the lwip stack at the following position in the
stm32h7xx_hal_eth.c a timeout is triggered:
/* 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;
}
}
In different forums the above mentioned problem was solved by changing the
APB4 frequency was changed. I have also tried various frequencies, unfortunately without success. It is often mentioned that the problem is related to the clock line. Interestingly, apparently only self-developed boards are affected by the problem, so no Evalboards!
The manufacturer of the PCB still stated that the signals MDIO and MDC are not used. I cannot switch off the two signals in CubeMX, because otherwise the complete Ethernet interface is switched off. The manufacturer then provided me with a firmware, with which the Ethernet interface can be put into operation. So the signals MDIO and MDC are apparently not mandatory for a ping.
1st question:
Is it possible to create a working CubeMX project at all if the MDIO and MDC lines are not used on the HW but are still active in CubeMX?
2nd question:
Does anyone have an idea how I solve the problem with the timeout mentioned above? Or does anyone have a guess why no SW reset is triggered?
To keep the thread clear I have added the main.c and my IOC file to the attachment. If there is any information missing, please let me know. I will add them as soon as possible.
I thank you for your help and would be glad about answers.
2023-04-03 11:28 PM
In my source, check the comment on top.
So, are the GPIOs set correctly?
Is the PHY providing a clock? Grab a scope and check.
/* 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 */
/* Note: The SWR is not performed if the ETH_RX_CLK or the ETH_TX_CLK are
not available, please check your external PHY or the IO configuration */
ETH->DMAMR |= ETH_DMAMR_SWR;
/* wait for software reset to reset... */
u32TickStart = HAL_GetTick();
while( ETH->DMAMR & ETH_DMAMR_SWR )
{
/* timeout ? */
if( (HAL_GetTick() - u32TickStart ) > ETH_TIMEOUT_SWRESET_MS )
{
uart_printf("# ERR: ETH_DMAMR_SWR software reset TO\n\r");
return HAL_TIMEOUT;
}
}
2024-01-15 04:39 AM
Did you solve this problem? I have some problem and I tried everthing
2024-03-24 10:37 PM
Me too. I have no idea, I should to do.
2024-04-08 11:14 AM
Hi,
I encounter the same issue and wrote a post for it:
In my case, I am pretty sure that the GPIOs configuration are correct for F407VE as it works on F407ZG, and the ETH_RX_CLK and the ETH_TX_CLK are checked by calling the following MACROs:
#define __HAL_RCC_ETHMAC_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACEN)) != RESET)
#define __HAL_RCC_ETHMACTX_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACTXEN)) != RESET)
#define __HAL_RCC_ETHMACRX_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACRXEN)) != RESET)
As for your question: Is the PHY providing a clock?
Which clock do you mean? Could you give the signal name of this clock?
Regards
Chao