cancel
Showing results for 
Search instead for 
Did you mean: 

Troubleshooting Ping Issues on NUCLEO-H753 with LwIP

KBae.1
Associate II

"I am currently working on implementing Ethernet communication using a NUCLEO-H753 board.

As a first step, I attempted to perform a ping test. I followed the official tutorial videos provided by STMicroelectronics step-by-step, but unfortunately, I am not getting the expected results (the ping is failing).

I would appreciate any guidance or advice on what might be causing this issue or which specific configurations I should double-check."

"Let me share my CubeMX configuration with you first so we can review the setup."

1. System Core - CORTEX_M7

image1.png

 

 

2. Connectivity - ETH

image2.png

 

3. LwIP

image3.png

 

4. Clock

image4.png

 

I will also share the modified source code with you.

 

STM32H753ZITX_FLASH.ld

/* Modification start */
.lwip_sec (NOLOAD) :
{
. = ABSOLUTE(0x30040000);
*(.RxDecripSection)

. = ABSOLUTE(0x30040100);
*(.TxDecripSection)

. = ABSOLUTE(0x30040200);
*(.Rx_PoolSection)
} >RAM_D2
/* Modification end */

 

ethernetif.c

/* USER CODE BEGIN 2 */
#if defined ( __ICCARM__ ) /*!< IAR Compiler */
#pragma location = 0x30040200
extern u8_t memp_memory_RX_POOL_base[];
#elif defined ( __CC_ARM ) /* MDK ARM Compiler */
__attribute__((at(0x30040200)) extern u8_t memp_memory_RX_POOL_base[];
#elif defined ( __GNUC__ ) /* GNU Compiler */
__attribute__((section(".Rx_PoolSection"))) extern u8_t memp_memory_RX_POOL_base[];
#endif
/* USER CODE END 2 */

 

main.c

while (1)
{
  /* USER CODE END WHILE */

  /* USER CODE BEGIN 3 */
  ethernetif_input(&gnetif);
  sys_check_timeouts();
}

or

while (1)
{
  /* USER CODE END WHILE */

  /* USER CODE BEGIN 3 */
  MX_LWIP_Process();
}

 

I have modified the source code as shown above.

 

The results are shown below.

image5.png

 

Pinging 192.168.10.123 with 32 bytes of data:
Reply from 192.168.10.50: Destination host unreachable.
Reply from 192.168.10.50: Destination host unreachable.
Reply from 192.168.10.50: Destination host unreachable.
Reply from 192.168.10.50: Destination host unreachable.

 

I am receiving these messages as shown in the screenshot,

and I'm reached out because I’m not sure what I might be missing in the configuration.

As you can see, I am getting 'Destination host unreachable' errors.

I would appreciate it if you could help me identify what's wrong.


Edited to apply proper source code formatting - please see How to insert source code for future reference.

10 REPLIES 10
MGogr.1
Senior

Please assign proper Gateway address.

Also check the Network setting in your laptop. "Lwip_init();" seems to be missing. 

STackPointer64
ST Employee

Hello @KBae.1, and welcome to ST community!

Attached is a project for the NUCLEO-H753. You can compare configurations and have a working project. Please make sure to add the proper linker file configuration to your project. Let me know if you need further assistance.

Best regards,

To improve visibility of answered topics, please click 'Accept as Solution' on the reply that resolved your issue or answered your question.

Hello,

Thank you for providing the project files; I have reviewed them carefully.

In my setup, I am not using FreeRTOS and have configured the system with a static IP address. Everything else remains identical to your project. However, after compiling and downloading your project, it still did not work on my end.

I would like to share the specific modifications I made to my code to get a partial response:

  1. MPU Configuration: In the void MPU_Config(void) function, I commented out the following lines:

    • MPU_InitStruct.Number = MPU_REGION_NUMBER0;

    • MPU_InitStruct.Number = MPU_REGION_NUMBER1;

  2. Ethernetif.c: In the low_level_output function, I added the following line: SCB_CleanDCache_by_Addr((uint32_t *)((uint32_t)p->payload & ~0x1F), p->tot_len + 32);

With these changes, Ping works correctly.

However, I am aware that simply commenting out the MPU configuration is not the proper solution. I want to identify the root cause of the issue. I have consulted AI tools like ChatGPT and Gemini, which suggested adjusting the MPU regions and linker scripts, but even after applying those suggested changes, the system still fails to work correctly (it often goes into a HardFault or fails to initialize).

What could be the problem here? Any insights would be greatly appreciated.

Hello @KBae.1,

I have retested the example I attached, and it works whether FreeRTOS/DHCP is enabled or not (with minor adjustments). To transform it into a standalone application with a static IP, I made the following changes:

  1. Opened MX2 configuration.
  2. Disabled FreeRTOS.
  3. Inside the LwIP configuration tab, disabled DHCP.
  4. Set the IP Address and Netmask.
  5. Generated the project.
  6. Inside the while loop, called MX_LWIP_Process().
  7. Built and ran the project.

The only misconfiguration I found is that the allocated LwIP heap memory (16KB) is less than the one allocated and protected by the MPU (128KB), and the Rx buffer count is set to 10 instead of 12. Nonetheless, this does not affect the functionality of the project for an application that only handles pings. I suggest you re-download the attached project, apply the modifications I mentioned, and test it.

Best regards,

To improve visibility of answered topics, please click 'Accept as Solution' on the reply that resolved your issue or answered your question.

Hello,

I have been comparing my project with the working reference and found one significant difference.

In the working project, TIM6 was used as the Timebase Source instead of SysTick. When I modified my existing source to use TIM6, I confirmed that the Ping now works perfectly.

This has raised a few questions for me, as I don't fully understand the underlying reason:

  1. Is it mandatory to use a dedicated timer like TIM6 as the Timebase Source for Ethernet applications on the STM32H7?

  2. Could you explain why using TIM6 makes a difference in this case?

  3. Specifically, I noticed that the Preemption Priority for both the System Tick Timer and the TIM6 Timebase is set to a low priority of 15 in the NVIC. If the priority levels are the same, why does switching the source to TIM6 resolve the communication issue?

I would appreciate any insights into the technical relationship between the HAL Timebase and the Ethernet/LwIP stack.

Thank you.

Hello,

To answer your question, no, it is not mandatory to use a timer as the timebase source instead of SysTick; it is simply a best practice for RTOS applications. In your case, the application should work using SysTick. I have compared both projects ,the one you attached and mine, and I suggest you enable RCC and set HSE to bypass clock source, as timing is crucial for Ethernet. Please try this and get back to me with your feedback.

Best regards,

To improve visibility of answered topics, please click 'Accept as Solution' on the reply that resolved your issue or answered your question.

Thank you for your response.

Currently, on my NUCLEO-H753 board, the external clock (HSE) is set to NC (Not Connected), so I am unable to perform tests using the HSE.

However, I am currently developing another board that uses an external MEMS oscillator, which will allow me to test with the HSE. I will conduct further testing on that board once it's ready and get back to you with the results.

Thank you again for your support.

On the custom board, I used a MEMS oscillator for the external clock and powered it on in Bypass mode.

 

I found that the ping failed when using SysTick, but it worked successfully after changing the Timebase Source to TIM6.

 

The exact root cause of this behavior is still unclear.

Hello @KBae.1,

I understand. I have just regenerated the example using SysTick and HSI, tested it successfully, and suggest you try the same approach. Please let me know your feedback after testing.

Best regards,

To improve visibility of answered topics, please click 'Accept as Solution' on the reply that resolved your issue or answered your question.