2025-05-17 3:19 AM - edited 2025-05-17 12:45 PM
Hi. I have a NUCLEO-H723ZG board. And my basic goal is to create from scratch non-rtos project with ethernet support. But after many attempts i cant get it respond to pings from PC. I tried flashing udp echo sample and it works, so hardware isnt fault. Im using STM32CubeIDE Version: 1.18.1.
Im doing next steps:
1. Open CubeIDE and select File->Create->STM32 Project.
2. Go to board selector and select NUCLEO-H723ZG. Create project with it.
3. On the ETH tab enable RMII and change TX_EN and TXD0 pins according to board schematics
These settings are default.
4. Enable LWIP and set static IP
Set PHY driver
Heap options are default
5. Enable cache and configire MPU.
6. Add DMA sections to LD scripts, both FLASH and RAM
7. Add MX_LWIP_Process() to the main loop
8. Build project and flash it.
I aslo tried different MPU configurations, setting GPIO speed in ETH settings to Very High, etc. But im stil getting "Host unreachable" when trying to ping board.
Solved! Go to Solution.
2025-05-20 12:51 PM - edited 2025-05-20 12:52 PM
@ASEHST, looks like I found the root cause of this problem.
LwIP_UDP_Echo_Server example contains __HAL_RCC_D2SRAM1_CLK_ENABLE(); in it`s SystemClock_Config(void) function.
But projects that are generated by CubeMX lacks this call. And when board is cold-booted, like @AGP_29 mentioned, __HAL_RCC_ETH1MAC_CLK_ENABLE(); in void HAL_ETH_MspInit(ETH_HandleTypeDef *heth) of ethernetif.c, thashes out D2 SRAM where LWIP heap is located.
I manualy added this call to my project in the same place and looks like problem has gone.
2025-05-18 1:18 PM - edited 2025-05-19 7:27 AM
Hello @AlexCatze,
Thank you for your report. I recommend reviewing the following thread: Solved: H723-Ethernet_LWIP Ping problem - STMicroelectronics Community
In particular, please pay attention to the post by @STea , as the project shared there could be beneficial to your situation.
With Regards,
2025-05-19 1:42 PM
Hi, @ASEHST
Huge thanks for your reply.
Yesterday i downloaded STEA`s project, changed IP to match my test subnet and it worked. I compared settings to my project and the most significant difference was MPU config. I changed MPU config in STEA`s project to match my, and it still worked. I havent found any other differences, so i left further investigation for next day.
Today i launched STEA`s project with my last changes, and got no pings. I throught that i accidently broke something. But when i repeated exactly same steps that yesterday gave me good result - ive got non-working project. I supposed that my board died. I launched LwIP_UDP_Echo_Server example, and it worked. Right after it, i launched newly imported STEA`s project and it worked 0_o. I poked around, and after few resets and launches, STEA`s project stopped working again. And i got hardfault.
So, now things are:
- LwIP_UDP_Echo_Server with only modification to set static IP works fine.
- STEA`s project works sometimes. It never worked after cold boot. But it works most times when LwIP_UDP_Echo_Server was launched on this board right before.
This looks very strange for me.
2025-05-20 10:25 AM
I used to enable LWIP debug and saw that it fails to alloc pbuf when tries to send ARP.
Just for test i enabled MEM_LIBC_MALLOC in LWIP->Key Options
And allocation error had gone. But I still cant ping it.
2025-05-20 12:18 PM
Looks like i have the same issue as here https://community.st.com/t5/stm32-mcus-embedded-software/issue-with-lwip-heap/td-p/725275
Addition of memset(0x30004000,0,1024*14); right after MX_LWIP_Init(); fixes this issue. I know that this is very bad `fix` but it points to the problem.
2025-05-20 12:51 PM - edited 2025-05-20 12:52 PM
@ASEHST, looks like I found the root cause of this problem.
LwIP_UDP_Echo_Server example contains __HAL_RCC_D2SRAM1_CLK_ENABLE(); in it`s SystemClock_Config(void) function.
But projects that are generated by CubeMX lacks this call. And when board is cold-booted, like @AGP_29 mentioned, __HAL_RCC_ETH1MAC_CLK_ENABLE(); in void HAL_ETH_MspInit(ETH_HandleTypeDef *heth) of ethernetif.c, thashes out D2 SRAM where LWIP heap is located.
I manualy added this call to my project in the same place and looks like problem has gone.