Subject: Ethernet Init Issue (HAL_ETH_ERROR_TIMEOUT) on STM32H573RIT6 with LAN8742
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2025-05-23 9:53 PM
Subject: Ethernet Init Issue on STM32H573RIT6 with LAN8742
Hello ST Community,
I’m currently working on a project using the STM32H573RIT6 and I’m using STM32CubeMX and STM32CubeIDE as my development tools. My project setup is bare-metal (no RTOS) and I’ve successfully configured several peripherals already.
Now I’m trying to bring up Ethernet using the LAN8742 PHY, which is connected via RMII. However, I’m encountering an issue during initialization — specifically, HAL_ETH_Init() fails and returns the error:
HAL_ETH_ERROR_TIMEOUT.
Here’s my setup:
MCU: STM32H573RIT6
PHY: LAN8742 (on custom hardware)
Interface: RMII
Configured using STM32CubeMX (default settings mostly)
No RTOS — standalone implementation
Using STM32Cube HAL drivers
I’ve double-checked the hardware connections — 50 MHz clock is present, reset pin is pulled correctly, and MDIO/MDC lines are connected properly. The PHY address is set to 0 (default), and matches the CubeMX configuration.
Questions:
What usually causes HAL_ETH_ERROR_TIMEOUT during HAL_ETH_Init()?
Are there common configuration mistakes or hardware-related causes when using LAN8742 with STM32H5 series?
Do I need to manually delay or reset the PHY before calling HAL_ETH_Init()?
Any advice on how to debug the MDIO communication or verify that the PHY is responding correctly?
If anyone has experience with this setup or has example working configurations, I would really appreciate your help. I can share screenshots of my CubeMX setup or relevant parts of the code if needed.
Any advice, example projects, or tips would be greatly appreciated!
Thank you in advance!
Best regards,
Er.Vijay Kushwah
Email:vijaykushwah1112@gmail.com
Gailron Control Devices Pvt. Ltd.
r&d@gailron.com
DLF industrial area Faridabad,Haryana,India.
- Labels:
-
STM32H5 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2025-05-24 4:32 AM
> What usually causes HAL_ETH_ERROR_TIMEOUT during HAL_ETH_Init()?
IIRC reset of the ETH device waits for some handshake with the PHY so it can timeout because of PHY problem.
While waiting for more useful replies, re-check the PHY.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2025-05-25 11:03 PM
1) Use the debugger to find out where exactly init fails.
Most of the time ETH init seems to fail because of missing interface clocks when the SWR bit is not reset by HW.
So, check your clocks and IOS once more, also the GPIO settings of the MDIO interface.
2) The LAN8742 is pretty easy to handle, I think. Maybe check again schematics, and how HAL sets it up.
I would use some UART functions for debugging, so that you can read / write PHY registers via UART command.
3) Not sure, read the datasheet.
4) See 2), use the UART to check register settings, again: check the datasheet!
