STM32H573: Ethernet - HAL_ETH_Init returns error.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-05-19 5:13 AM - last edited on ‎2025-05-20 1:58 AM by Andrew Neil
I am using STM32H573 and trying to enable ethernet. I have used the below article for it:
https://community.st.com/t5/stm32-mcus/how-to-use-the-lwip-ethernet-middleware-on-the-stm32h5-series/ta-p/691100
But ethernet is not being initialized. The HAL_ETH_Init is returning error which is resulting in error handler.
This is the condition being checked in MX_ETH_Init function. As even after using the steps mentioned in the article mentioned above the ethernet is not working.
- Do we have to add RX and TX descriptors specific addresses in the linker file?
Solved! Go to Solution.
- Labels:
-
STM32H5 Series
-
STM32H7 series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-05-20 4:31 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-05-20 4:37 AM
I do not see function lwip_init() in attached code (file lwip.c) !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-05-20 4:46 AM
My apologies, I have that part of the code named as Network_config in main.c. Something like this:
static void Netif_Config(void) {
ip_addr_t ipaddr;
ip_addr_t netmask;
ip_addr_t gw;
#if LWIP_DHCP
ip_addr_set_zero_ip4(&ipaddr);
ip_addr_set_zero_ip4(&netmask);
ip_addr_set_zero_ip4(&gw);
#else
/* IP address default setting */
IP4_ADDR(&ipaddr, IP_ADDR0, IP_ADDR1, IP_ADDR2, IP_ADDR3);
IP4_ADDR(&netmask, NETMASK_ADDR0, NETMASK_ADDR1 , NETMASK_ADDR2, NETMASK_ADDR3);
IP4_ADDR(&gw, GW_ADDR0, GW_ADDR1, GW_ADDR2, GW_ADDR3);
#endif
/* add the network interface */
netif_add(&gnetif, &ipaddr, &netmask, &gw, NULL, ðernetif_init, ðernet_input);
/* Registers the default network interface */
netif_set_default(&gnetif);
ethernet_link_status_updated(&gnetif);
#if LWIP_NETIF_LINK_CALLBACK
netif_set_link_callback(&gnetif, ethernet_link_status_updated);
#endif
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-05-20 7:07 AM
Are you using "pure HAL ETH", or did you modify it?
As you are using your own hardware, have you checked that all external clocks are available?
See NOTE in code:
/* SoftWare Reset */
/* set SWR bit: resets all MAC subsystem internal registers and logic
* NOTE: the SWR is not performed if the ETH_RX_CLK or the ETH_TX_CLK are
* not available -> check external PHY or 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 )
{
#if DEBUG_ETHNETIF
uart_printf(SZC_TEXT_ERR "ETH_DMAMR_SWR software reset TO\n\r");
#endif /* DEBUG_ETHNETIF */
return HAL_TIMEOUT;
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-05-20 7:24 AM
@LCE wrote:As you are using your own hardware, have you checked that all external clocks are available?
Indeed.
@jowakar122 and, in fact, have you verified all your external hardware?
Again, please post your schematics.
Have you got this working on an ST board (known-good hardware) before moving on to unknown hardware?
A complex system designed from scratch never works and cannot be patched up to make it work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-05-20 11:07 PM
@Andrew Neil wrote:Have you got this working on an ST board (known-good hardware) before moving on to unknown hardware?
THIS is so important - and easy to do. The Nucleo-boards are easily available and don't cost much.
I started every STM32 project with a Nucleo or a DK, and it helped me a lot to avoid mistakes with my own following circuits, PCBs, and surely source code.
The STM32 firmware always starts with a pre-processor define to differentiate between Nucleo and my own board, mostly for GPIO settings, but also for other stuff.
This define might by in the STM32CubeIDE project, or at the start of main.c.
Like so:
#define NUCLEO_EVK 1
...
#if NUCLEO_EVK
#include gpio_Nuc.h
#else /* not NUCLEO_EVK */
#include gpio.h
#endif
or:
#if NUCLEO_EVK
GpioInitNuc();
#else /* not NUCLEO_EVK */
GpioInit();
#endif
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-05-20 11:09 PM
After multiple tries I check on the hardware side and the problem was there. After proper connections on the hardware the problem was solved.
I appreciate all for helping me out
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-05-21 12:32 AM
Hi,
If possible, could you give some details about what was wrong on the hardware side ? Maybe it can help other people if they do similar mistake.

- « Previous
- Next »