cancel
Showing results for 
Search instead for 
Did you mean: 

Ethernet issue on NUCLEO-H723ZG

AlexCatze
Associate II

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

AlexCatze_0-1747475977037.png

These settings are default.

AlexCatze_1-1747476047272.png

4. Enable LWIP and set static IP

AlexCatze_2-1747476200315.png

Set PHY driver

AlexCatze_3-1747476220359.png

Heap options are default

AlexCatze_4-1747476253758.png

5. Enable cache and configire MPU.

AlexCatze_5-1747476462949.png

AlexCatze_6-1747476483312.png

6. Add DMA sections to LD scripts, both FLASH and RAM

AlexCatze_7-1747476554022.png

7. Add MX_LWIP_Process() to the main loop

AlexCatze_8-1747476625035.png

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.

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
AlexCatze
Associate II

@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.

AlexCatze_2-1747770456899.png

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.

View solution in original post

5 REPLIES 5
ASEHST
ST Employee

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,

If your question is answered, please close this topic by clicking "Accept as Solution".

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.

AlexCatze_0-1747687086286.png

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.

 

AlexCatze
Associate II

I used to enable LWIP debug and saw that it fails to alloc pbuf when tries to send ARP.

AlexCatze_0-1747761688123.png

Just for test i enabled MEM_LIBC_MALLOC in LWIP->Key Options

AlexCatze_1-1747761797721.png

And allocation error had gone. But I still cant ping it.

AlexCatze
Associate II

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.

AlexCatze
Associate II

@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.

AlexCatze_2-1747770456899.png

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.