cancel
Showing results for 
Search instead for 
Did you mean: 

Why is my LwIP ping test for Stm32f767zi giving me a different IP in response?

Anare.1
Associate III

Configuration:

Stm32F767zi board is connected to laptop via LAN connection and no other network is connected.

Step1: The IP address , netmask and gateway are same from the ipconfig

2024-01-03_02h56_43.png

Step2: Then I have configured the Cubemx based on it

cubemx configcubemx config

 

 

Issue:

I have configured the LwIP stack and is calling MX_LWIP_Process(); in the while loop, which is sufficient for me to get a ping back.

Source code:

Source codeSource code

 

Debugger output:(It verifies that the essential function is being executed)

Debugger outputDebugger output

 

Cmd output for Ping:

(The response to ping is from a different IP address, and why is that?)

 

2024-01-03_03h03_43.png

 

 

Is everything correct in this scenario? Or is there something essential,that I am missing here.

I am following the feedback from this question post from myself.

https://community.st.com/t5/stm32-mcus-boards-and-hardware/stm32f767zi-nucelo-ethernet-hardware-setup-can-we-use-our-laptop/m-p/576027#M14298

And I am attaching a file that I have referred along below. 

@LCE @TDK @Piranha 

4 REPLIES 4

If the mask on your PC is 255.255.255.0, 192.168.2.2 masked by that mask (i.e. 192.168.2.xxx) does not match the network on which the PC is on (i.e. its IP masked, i.e. 192.168.1.xxx), which means, that the network stack tries to use the gateway to route the ping (assuming it to be directed to some external network). It then boils down to the details of your whole network why the reply is from a surprising IP address.

In other words, STM32 needs to have a 192.168.1.xxx address to be accessible directly by the ping.

Do some reading on addressing in the Internet Protocol.

JW

Thank you very much for time and for the response.I really appreciate it.

I have indeed tried that way too, but the symptoms/errors remain the same here.


@waclawek.jan wrote:

.

In other words, STM32 needs to have a 192.168.1.xxx address to be accessible directly by the ping.

 

 


Here I gave the 192.168.1.xxx as the static IP, but I got the same response as before.

Anare1_0-1704287359471.png

 

Output:

Anare1_1-1704287501632.png

 

 

I am wondering, if I missed something on the settings essential to network stack.

 

 

 

Maybe the link layer does not work as expected. Debug as usually, start perhaps by observing your gnetif struct.

If you enable DHCP, the address is not static and depends on how the DHCP server assigns it.

JW

Wai Siang
Associate III

I face the same problem. 
I wonder ST engineer marketing did compile a new working example for users and customers. 

It is 2024 now... many official drivers still not very foolproof and bug-free, many things still need manual tweaks here and there to get it work.