2025-01-05 10:50 PM - last edited on 2025-01-06 12:04 AM by SofLit
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:
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 :
//*****************************
Ethernet GPIO Configuration:
//*****************************
MPU Configuration :
//*****************************
LWIP configuration :
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:
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:
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]
Solved! Go to Solution.
2025-01-06 05:07 AM
Hello @Saliwan128 ,
2025-01-06 03:07 AM
Hello @Saliwan128
Please, refer to this article to create your application.
2025-01-06 05:07 AM
Hello @Saliwan128 ,
2025-01-17 05:19 AM
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 */
2025-01-17 06:12 AM
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
2025-01-22 03:43 AM
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?
2025-01-22 05:44 AM
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:
Regards
2025-01-23 03:11 AM
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.
2025-01-23 06:18 AM
Hello @KKonn.1 ,
Are you sure that the callback is getting called?
If you can but a breakpoint to check if you get to there after running the application with cable plugged, then unplug it during execution.
Regards
2025-01-24 06:17 AM - edited 2025-01-24 06:17 AM
Yes, I am sure. I have tested this with breakpoints (to see where the execution goes), I can see the functionality by staring the leds.