2025-02-03 10:18 AM
I want to initialize the STM32H573 ETH module using the STM32CubeMX code generator (see ioc file attached). It should run in MII mode using an external transceiver.
I kept the configuration unchanged, however it always jumps to ErrorHandler, because HAL_ETH_Init returns HAL_ERROR on timeout of ETH_DMAMR_SWR at the following routine:
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;
}
}
From what I've read on this forum, the ETH somehow needs an external clock input from the transceiver. However, ETH_REF_CLK is only defined in RMII mode, but I want MII mode with RX and TX clocks. Does it still need permanently running clock? ETH_RX_CLK is currently served from the transceiver with 2.5 MHz (in 10 Mbps mode), the ETH module itself is clocked 100 MHz from PLL1Q:
I even tried rising the timeout threshold, but even 50 s is failing. Any ideas on how to get the initialization through?