2022-10-12 12:24 AM
Hi,
Our project is using STM32H750 together with µC/OS-III as the OS and µC/TCP-IP as the network stack.
The device is able to be assigned with an IP address by DHCP server.
And the device can respond to ping initially.
But if we ping the device continuously, it will be kind of like disappearing from the network and no longer able to respond to the ping.
From IAR debugger, the Ethernet interrupt is still working. And we can still see the UDP packets are passed to µC/TCP-IP network stack.
But the network stack will no longer receive any ICMP (thus not responding to ping) or TCP packets.
What are things that could possibly go wrong here. Appreciate any suggestion on the areas that we should check.
rgds,
kc Wong
2023-01-03 07:23 AM
Hi,
Thank you for sharing your problem.
Sorry for the delayed answer.
Regards
Mahdy
2023-01-03 05:30 PM
Hi Mahdy,
#!/usr/bin/env python
import os
import time
ip_list = ['10.82.101.75']
while True:
for ip in ip_list:
response = os.popen(f"ping {ip}").read()
if"Received = 4" in response:
print(f"UP {ip} Ping Successful")
else:
print(f"DOWN {ip} Ping Unsuccessful")
time.sleep(1)
rgds,
kc Wong
2023-01-04 12:58 AM
Hi,
I will list you some track and I hope that will help you :
as defined here (HAL_ETH_TxFreeCallback)
Regards
Mahdy
2023-01-04 04:19 PM
Hi Mahdy,
Thanks for your suggestion. But I did not see any of them happens.
It is confirmed that when ping issue happens, the device is only able to receive the UDP broadcast packets and not UDP unicast packets by using the Python script TestUdpBroadcast.py and TestUdpUnicast.py.
import socket
UDP_IP = "10.82.97.142"
UDP_PORT = 5005
MESSAGE = b"Hello, World!"
print("UDP target IP: %s" % UDP_IP)
print("UDP target port: %s" % UDP_PORT)
print("message: %s" % MESSAGE)
sock = socket.socket(socket.AF_INET, # Internet
socket.SOCK_DGRAM) # UDP
sock.sendto(MESSAGE, (UDP_IP, UDP_PORT))
import socket
UDP_IP = "255.255.255.255"
UDP_PORT = 5005
MESSAGE = b"Hello, World!"
print("UDP target IP: %s" % UDP_IP)
print("UDP target port: %s" % UDP_PORT)
print("message: %s" % MESSAGE)
sock = socket.socket(socket.AF_INET, # Internet
socket.SOCK_DGRAM) # UDP
# Enable broadcasting mode
sock.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
sock.sendto(MESSAGE, (UDP_IP, UDP_PORT))
Second proof is that Wireshark will not be able to capture the ICMP packets that indicates the destination unreachable (port unreachable) when ping issue happens.
In normal situation, the device will respond with this ICMP packets if it is able to receive the UDP unicast packets, but no process is listening at that UDP port.
The device also will not receive TCP and ICMP packets when ping issue happens as they are unicast also.
Anyway, the issue just disappeared mysteriously after I disconnect from and connect back the switch (where the device is connected to) to the company network.
The unanswered question is why unicast, and why not broadcast ?
So far, I have not been able to find anything in uC-TCP-IP stack or the Ethernet device on STM32H750 that links to this observation.
rgds,
kc Wong