I've made a project to send sensor data from STM32F767ZI nucleo board (Client) to a desktop computer (Server), using ethernet and lwip with FreeRTOS on STM32CubeIDE. The nucleo board is connected with ethernet cable to a wired broadband router, to which the desktop computer is also connected.
In a terminal running under Ubuntu, I am sending a ping message as:
$ sudo ping 192.168.0.3
However, with same code and configurations, the result of ping test is
Destination Host Unreachable
or
64 bytes from 192.168.0.3: icmp_seq=1 ttl=255 time=0.864ms
When the ethernet connection is built successfully, the result of ping test is done correctly and continuously. However, when I try to rebuild the project with the same code and configuration and I use debugging mode, the same ping test fails.
After these findings, I tried to reconnect ethernet in various ways like changing cables, rebooting the board or computer, and reconnecting the debugging port. Sometimes it works, but then the connection is fails again while I redo the same procedure that worked well before.
What can be wrong about the setup? What should I change?