Skip to main content
Explorer
January 6, 2025
Question

H723-Ethernet_LWIP Ping problem

  • January 6, 2025
  • 6 replies
  • 5373 views

Hello ST Community,

I am currently working with the Nucleo H723ZG board and facing issues establishing a ping response using the LWIP stack. Despite following various examples and configurations, I have been unable to get it to respond to pings. Here are the details of my setup:

  • Development Environment: STM32CubeIDE V1.17  and STM32CubeMX V6.13.0
  • Configuration:
    • I have not used RTOS.
    • I configured the Ethernet settings according to package examples.
    • :C:\....\STM32Cube\Repository\STM32Cube_FW_H7_V1.12.1\Projects\NUCLEO-H723ZG\Applications\LwIP\LwIP_UDP_Echo_Server
    • I ensured that the Ethernet cable was connected properly and used a direct connection to my pc.

I have tried multiple versions of the H7 package ( 1.12.1 - 1.12.0 - 1.11.1 - 1.11.0 - 1.10.0 ) and tested various configurations without success. The ping command consistently results in "destination host unreachable."Could anyone provide insights or suggestions on what might be missing or misconfigured?

//*****************************

My  Ethernet configuration :

eth_config.png

//*****************************

Ethernet GPIO Configuration:

eth_GPIO_config.png

//*****************************

MPU Configuration :

mpu_config.png

//*****************************

LWIP configuration :

lwip1.png

lwip2.png

lwip3.png

lwip4.png

I added this part to the STM32H723ZGTX_FLASH.ld file:

//************************************************************************************

..........

. = ALIGN(8);

} >RAM_D1

 

 

.lwip_sec (NOLOAD) : {

. = ABSOLUTE(0x30000000);

*(.RxDecripSection)

 

. = ABSOLUTE(0x30000080);

*(.TxDecripSection)

 

. = ABSOLUTE(0x30000100);

*(.Rx_PoolSection)

} >RAM_D2 AT> FLASH

 

 

/* Remove information from the standard libraries */

/DISCARD/ :

//**********************************************************

and its result is like  this:

build_result.png

My main.c code:

//**********************************************************

/* USER CODE BEGIN PV */

extern struct netif gnetif;

/* USER CODE END PV */

++++++++++++++++++++++++++++++++++++++++++++++++++++

in int main(void)

 

 

while (1)

{

/* USER CODE END WHILE */

 

/* USER CODE BEGIN 3 */

ethernetif_input(&gnetif);

sys_check_timeouts();

}

//**********************************************************

ressult:

cmd.png

My CPU clock is 520Mhz. I am sure the hardware has no problem because I can give a ping from the st package example.

But when I configure according that example it does not work.

.Thank you for your assistance!Best regards,
[Your Name]

    This topic has been closed for replies.

    6 replies

    Technical Moderator
    January 6, 2025

    Hello @Saliwan128 

    Please, refer to this article to create your application.

    Explorer II
    January 17, 2025

    Hi!
     I was experiecing a little similar issues, when trying to change an old project (STM32CubeMX version 6.4.0 & STM32Cube FW_H7 version 1.9.1).

     I tried the ping_test_h723.zip, but it didn't have all the configurations? E.g. MPU was missing?

    Anyways, reading this post and once again checking the configurations, I was able to create (from scratch) a working configuration. The differences to the original post were:

    1) Cortex_M7-> MPU Region 2 -> MPU TEX field level: level 1
    2) LWIP->Key Options-> Heap and Mem..->MEM_SIZE=1600
    3) LWIP->General Setting -> GATEWAY_ADDRESS: 192.168.000.001
    4) Eth->Parameter Settings -> Rx Buffers Address: 0x30000200
    5) STM32H723ZGTX_FLASH.ld:
     . = ABSOLUTE(0x30000200);
    *(.Rx_PoolSection)
    6) In main.c, I am using
    while (1)
    {
    /* USER CODE END WHILE */

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

    Attached is also the working H723ZG-Eth-test-no-rtos.ioc file. To create a working project from that you need to:
    1) Modify STM32H723ZGTX_FLASH.ld:

    /* MODIFICATION START */
    /* Add lwip related changes */
    .lwip_sec (NOLOAD) : {
    . = ABSOLUTE(0x30000000);
    *(.RxDecripSection)
    
    . = ABSOLUTE(0x30000080);
    *(.TxDecripSection)
    
    . = ABSOLUTE(0x30000200);
    *(.Rx_PoolSection)
    } >RAM_D2 AT> FLASH
    /* MODIFICATION END */
    
    /* Remove information from the standard libraries */
    /DISCARD/ :


    2) Modify main.c:

     /* Infinite loop */
     /* USER CODE BEGIN WHILE */
     while (1)
     {
     /* USER CODE END WHILE */
    
     /* USER CODE BEGIN 3 */
    	 MX_LWIP_Process();
     }
     /* USER CODE END 3 */

     

    ST Employee
    January 17, 2025

    Hello @KKonn.1 ,

    The example shared in the previous post is not a complete example, but it does what is name say it is a ping example, and it is working with latest versions of CubeIDE 1.17 and CubeMX 6.13 no need to add any other code or configuration for the ping to work. I'm able to ping the H723 with this example with a direct connection to my pc.

    If it doesn't work for you, it is most probably a network related issue and not related to the project itself, please retry with the shared example and share with us if you are able to ping your board with it.


    Regards

    Explorer II
    January 22, 2025

    Hello @STea !
     Yes, this was my mistake. I opened the .ioc file to check which address to ping, and there was 192.168.1.9 and tried that. The code was not generated from the .ioc file, since there the address was 192.168.1.15 (and also MPU config missing). Using correct address I was able to ping it.

     I still have another question about the generated code lwip.c:
    In line 93, there generated code has:

     

     

     /* We must always bring the network interface up connection or not... */
     netif_set_up(&gnetif);

     

    Whereas when I have generated code with older version (STM32CubeMX version 6.4.0 & STM32Cube FW_H7 version 1.9.1), there is :

     

     

     if (netif_is_link_up(&gnetif))
     {
     /* When the netif is fully configured this function must be called */
     netif_set_up(&gnetif);
     }
     else
     {
     /* When the netif link is down this function must be called */
     netif_set_down(&gnetif);
     }

     

    Why this has changed? I want to show the ethernet status when the device boots up, and thus add (to line 100) this:

     

    /* USER CODE BEGIN 3 */
     ethernet_link_status_updated(&gnetif);
    /* USER CODE END 3 */

     

     

     

    But after this addition, the netif_is_up(netif) in ethernet_link_status_updated shows always that the netif is up, event though the cable is not connected. Or is there another place, where I should check if the netif is up?

    ST Employee
    January 22, 2025

    Hello @KKonn.1 ,

    if you want to check the status of the link you should right your own user code in the dedicated user code begin 5 and user code begin 6 areas in lwip.c  ethernet_link_status_updated function definition:

    STea_0-1737553439475.png

    Regards

    Explorer II
    January 23, 2025

    Hi @STea !
     That is exactly what I am doing. But the problem is, that ethernet_link_status_updated is not called in bootup at all. I.e. I need to call that function somewhere. I have two options:

    Option 1)
    Add ethernet_link_status_updated(&gnetif) in the middle of void MX_LWIP_Init(void) like this:

     /* Registers the default network interface */
     netif_set_default(&gnetif);
    
     ethernet_link_status_updated(&gnetif); //This line added!
    
     /* We must always bring the network interface up connection or not... */
     netif_set_up(&gnetif);

    Then the downside is, that it is overwritten whenever generating code from ioc.

    Option 2)
    Add ethernet_link_status_updated(&gnetif) in the end of void MX_LWIP_Init(void) like this:

    /* USER CODE BEGIN 3 */
     ethernet_link_status_updated(&gnetif);
    /* USER CODE END 3 */

    Then the downside is, that no matter what the real status is, netif_is_up(netif) returns always true. Even when the cable is not connected:

    static void ethernet_link_status_updated(struct netif *netif)
    {
     if (netif_is_up(netif)) //This is always true after being called from MX_LWIP_Init()
     {
    /* USER CODE BEGIN 5 */
    	 monitor_task_set_led(LED_ETHERNET, ON); //This is where we end up!
    /* USER CODE END 5 */
     }
     else /* netif is down */
     {
    /* USER CODE BEGIN 6 */
    	 monitor_task_set_led(LED_ETHERNET, OFF);
    /* USER CODE END 6 */
     }
    }



    And I noted, that the function has changed:

    // Code snippet from void MX_LWIP_Init(void), generated with STM32CubeMX version 6.4.0 & STM32Cube FW_H7 version 1.9.1
    ...
     if (netif_is_link_up(&gnetif))
     {
     /* When the netif is fully configured this function must be called */
     netif_set_up(&gnetif);
     }
     else
     {
     /* When the netif link is down this function must be called */
     netif_set_down(&gnetif);
     }
    ...
    
    // Code snippet from void MX_LWIP_Init(void), generated with STM32CubeMX version 6.13.0 & STM32Cube FW_H7 version 1.12.1
    ...
     /* We must always bring the network interface up connection or not... */
     netif_set_up(&gnetif);
    ...

     I tested, and with older version (where netif_set_up(&gnetif) is called only when link is up), it would work. But again, making that change, it is always overwritten when generating code from ioc.

    Explorer
    February 1, 2025

    A few weeks ago, I encountered a significant hurdle while implementing Ethernet functionality on an STM32 microcontroller. The complexity of the task led me to seek assistance in formulating a comprehensive questionnaire to better understand and address the issues at hand.After thorough research, experimentation, and persistence, I'm pleased to announce that I've successfully resolved the problem and implemented a working Ethernet solution. This breakthrough marks a significant milestone in my project and enhances the capabilities of the STM32 microcontroller I'm working with.Below, I'll share the details of the solution I developed, hoping it might benefit others facing similar challenges in their embedded systems projects:

    MPU setting:

    Screenshot 2025-02-01 104234.png

    Screenshot 2025-02-01 104307.png

    Ethernet Setting:

    Screenshot 2025-02-01 104439.png

    Screenshot 2025-02-01 104338.png

    LWIP :

    Screenshot 2025-02-01 104505.png

    Screenshot 2025-02-01 104524.png

     

    I added this part to the STM32H723ZGTX_FLASH.ld file:

    //************************************************************************************

    .lwip_sec (NOLOAD) : {

    . = ABSOLUTE(0x30000000);

    *(.RxDecripSection)

     

    . = ABSOLUTE(0x30000100);

    *(.TxDecripSection)

     

    . = ABSOLUTE(0x30000200);

    *(.Rx_PoolSection)

    } >RAM_D2 AT> FLASH

    //************************************************************************************

    I added this to while(1)

    MX_LWIP_Process();

     

    Visitor II
    June 26, 2025

    I tried it but it is not working properly.

    Ekran görüntüsü 2025-06-26 142912.png

    Visitor II
    June 25, 2025

    I am getting same errors.I didn't understand why it is happening.If anyone knows please let me know.

     

     

    Ekran görüntüsü 2025-06-25 173524.png

    Visitor II
    June 26, 2025

    I am getiing this error.Could you please help me?

     

    Ekran görüntüsü 2025-06-26 142912.png