I'm currently working on a UDP communication PC <-> ATmega16 (Atmel microcontroller) through the Ethernet. The ATmega16 controls the ENC28J60 (Ethernet module) through SPI. On the PC there is an application that simulates a UDP server/client. When the packet is sent from the PC to the ATmega16, the packet is received without errors, but when the ATmega16A sends the UDP packet back to the PC, the packet is lost somewhere (the application doesn’t receive it). The strange thing is that WireShark captures these packets coming to the PC and it seems they are valid. When sending the UDP packets form another PC (PC <-> PC), the packets are received normally. Turning off Firewall in Windows did not help, and also the same problems appears in Linux. I know that this topic might be wrong for this forum, but can anybody explain why WireShark captures these packets, but my application doesn’t? ATmega16 (192.168.1.3), PC (192.168.1.2), sending and receiving goes through port number 1234. asked 11 Sep '13, 11:50 punnkt edited 11 Sep '13, 12:05 |
2 Answers:
Based on the capture file provided, Wireshark indicates that the UDP checksum of frame 25 is incorrect, thus the packet will be dropped.
answered 11 Sep '13, 13:30 cmaynard ♦♦ The problem was in checksum. I calculate UDP checksum like checksum for ICMP. Sorry for not answering earlier because the site thinks my comments are spam. (14 Sep '13, 10:11) punnkt |
On Windows please run the following command and check if the counters grow while you receive the UDP packets (highlighted below). If so, there is something wrong with the UDP packets.
BTW: Please check if the destination MAC address is probably a broadcast address (ff:ff:ff:ff:ff:ff) or the IP address (255.255.255.255)? Please also check that the source/destination ports of the UDP packet are correct, otherwise your Windows/Linux system will not be able to match a socket. Basically the following values should be identical in both directions (obviously in reverse order):
See a similar problem here: http://goo.gl/KtJPIj Regards answered 11 Sep ‘13, 13:15 Kurt Knochner ♦ edited 11 Sep ‘13, 13:23 |
If you can supply a packet capture - on cloudshark or any file sharing site of your choice - then maybe someone can take a look at it and see if anything stands out.