First, I had to say that this is my first post on this list, and I wish to introduce myself.
I am an electronic engineer and I work on a project which use FreeRTOS and Lwip v 1.3.0. This project use a specific design which is made on an atmel AT91SAM7X512 and a IDT ICS 1893 for the PHY layer. The project is build on a Linux station and I use GCC, openocd and Eclipse.
Today, I am stuck on an UDP problem and I want to ask you for advice.
The project has been built on a FreeRTOS demo v4.2.0 which have been upgrade to v5.0.2. As the same, the lwip have been upgrade from the 1.1.0 to 1.3.0.
I have put on my project some kind of TCP servers which are well working. But I want now to add a TFTP server and I must use UDP. I first try to use socket as there is a TFTP demo on FreeRTOS which use it. As it was not working, I then try to test more trivial example and I switch back to netconn API. I then try to use the lwip contrib udpecho.c example. I copy this example in my project but I can't received any udp echo.
I have enabled some lwip trace (API_LIB_DEBUG, UDP_DEBUG and IP_DEBUG) and I think the lwip stack is trying to send back the echo, but there is something that is not working. I first think for a timer problem, but I can't find where It can be.
The test is base on a udp packet send from a pc (133.38.20.50) to a target (133.38.20.150) tfpt port (69) which contain the data "ping"
// on attend que l'interface soit montée //while (xEthInterfaceIsUp != pdTRUE) while (! netif_is_up(&EMAC_if)) vTaskDelay(BLOCK_100ms); trace_LOG(trace_DEBUG, "running...\n\r");
No. Time Source Destination Protocol Info 1 10:07:34.033002 133.38.20.50 133.38.20.150 TFTP Unknown (0x7069)
Frame 1 (47 bytes on wire, 47 bytes captured) Arrival Time: Jun 26, 2009 10:07:34.033002000 [Time delta from previous captured frame: 0.000000000 seconds] [Time delta from previous displayed frame: 0.000000000 seconds]
[Time since reference or first frame: 0.000000000 seconds] Frame Number: 1 Frame Length: 47 bytes Capture Length: 47 bytes [Frame is marked: False] [Protocols in frame: eth:ip:udp:tftp]
[Coloring Rule Name: Checksum Errors] [Coloring Rule String: cdp.checksum_bad==1 || edp.checksum_bad==1 || ip.checksum_bad==1 || tcp.checksum_bad==1 || udp.checksum_bad==1] Ethernet II, Src: Dell_d1:2c:d5 (00:1e:4f:d1:2c:d5), Dst: 00:bd:33:06:68:22 (00:bd:33:06:68:22)
Destination: 00:bd:33:06:68:22 (00:bd:33:06:68:22) Address: 00:bd:33:06:68:22 (00:bd:33:06:68:22) .... ...0 .... .... .... .... = IG bit: Individual address (unicast) .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)
Source: Dell_d1:2c:d5 (00:1e:4f:d1:2c:d5) Address: Dell_d1:2c:d5 (00:1e:4f:d1:2c:d5) .... ...0 .... .... .... .... = IG bit: Individual address (unicast) .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)
Type: IP (0x0800) Internet Protocol, Src: 133.38.20.50 (133.38.20.50), Dst: 133.38.20.150 (133.38.20.150) Version: 4 Header length: 20 bytes Differentiated Services Field: 0x00 (DSCP 0x00: Default; ECN: 0x00)
0000 00.. = Differentiated Services Codepoint: Default (0x00) .... ..0. = ECN-Capable Transport (ECT): 0 .... ...0 = ECN-CE: 0 Total Length: 33 Identification: 0x4f94 (20372)
Flags: 0x04 (Don't Fragment) 0... = Reserved bit: Not set .1.. = Don't fragment: Set ..0. = More fragments: Not set Fragment offset: 0 Time to live: 64 Protocol: UDP (0x11)
Header checksum: 0xb823 [correct] [Good: True] [Bad : False] Source: 133.38.20.50 (133.38.20.50) Destination: 133.38.20.150 (133.38.20.150) User Datagram Protocol, Src Port: 41486 (41486), Dst Port: tftp (69)
Source port: 41486 (41486) Destination port: tftp (69) Length: 13 Checksum: 0x3333 [incorrect, should be 0x419b (maybe caused by "UDP checksum offload"?)] [Good Checksum: False]
[Bad Checksum: True] Trivial File Transfer Protocol Opcode: Unknown (28777) Data (3 bytes)
No. Time Source Destination Protocol Info 2 10:07:34.071477 00:bd:33:06:68:22 Broadcast ARP Gratuitous ARP for 133.38.20.150 (Request)
Frame 2 (60 bytes on wire, 60 bytes captured) Arrival Time: Jun 26, 2009 10:07:34.071477000 [Time delta from previous captured frame: 0.038475000 seconds] [Time delta from previous displayed frame: 0.038475000 seconds]
[Time since reference or first frame: 0.038475000 seconds] Frame Number: 2 Frame Length: 60 bytes Capture Length: 60 bytes [Frame is marked: False] [Protocols in frame: eth:arp] [Coloring Rule Name: ARP]
[Coloring Rule String: arp] Ethernet II, Src: 00:bd:33:06:68:22 (00:bd:33:06:68:22), Dst: Broadcast (ff:ff:ff:ff:ff:ff) Destination: Broadcast (ff:ff:ff:ff:ff:ff) Address: Broadcast (ff:ff:ff:ff:ff:ff)
.... ...1 .... .... .... .... = IG bit: Group address (multicast/broadcast) .... ..1. .... .... .... .... = LG bit: Locally administered address (this is NOT the factory default) Source: 00:bd:33:06:68:22 (00:bd:33:06:68:22)
Address: 00:bd:33:06:68:22 (00:bd:33:06:68:22) .... ...0 .... .... .... .... = IG bit: Individual address (unicast) .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)
Type: ARP (0x0806) Trailer: 000000000000000000000000000000000000 Address Resolution Protocol (request/gratuitous ARP) Hardware type: Ethernet (0x0001) Protocol type: IP (0x0800) Hardware size: 6
Protocol size: 4 Opcode: request (0x0001) Sender MAC address: 00:bd:33:06:68:22 (00:bd:33:06:68:22) Sender IP address: 133.38.20.150 (133.38.20.150) Target MAC address: 00:00:00_00:00:00 (00:00:00:00:00:00)
Target IP address: 133.38.20.150 (133.38.20.150)
The trace seems good for me, but we can see on the wireshark log that there is not any udp packet send from the target. I am asking too on the gratuitous arp request ? Why the target is making this request ?
And what can prevent the lwip stack to send UDP packet on the network ?
Any advice on what I should check will be greetly appreciated.