lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] lwIP - Problem with packets


From: Stanko Nedic
Subject: [lwip-users] lwIP - Problem with packets
Date: Tue, 4 Nov 2008 00:34:24 +0000

Dear All,
 
I'm attempting to implement the lwIP stack on an onboard LPC2368 with DP83848 PHY chip, using and adapting the "lwipWeb.zip" port taken from the LPC2000 yahoo group (http://tech.groups.yahoo.com/group/lpc2000/). Unfortunately, I seem to have run into some problems whilst testing, and would appreciate any help.
 
In the log (below) I have shown some debug messages. The "Byte Number" lists the individual bytes in the content of pbuf p->payload when passed to the function "etharp_ip_input", around line 490, etharp.c. As you can see, the source and destination IP addresses are correct and present, beginning at the 27th byte as expected (the preceeding bytes being occupied by the ethernet and IP headers; 14 bytes + 12 bytes = 26 bytes).
 
HOWEVER, as the later debug messages show, the ethip_hdr ip source is read as 00086400, and ethip_hdr ip dest is read as 7bc06500.
 
In other words, the source and destination addresses were read from bytes 28-31 and 32-35 (offset by two bytes from the correct position). Looking at the ethip_hdr struct, I cannot see why this is the case, do you have any ideas as to why this is happening? This causes the IP packets to be identified as "not for us" (the initial ARP packet is OK).
 
For testing purposes, a static coded webpage should appear on the screen (simple web server serves this page; I could view this page when using a very simple TCP/IP stack thus it shouldn't be causing any problems and also proves that my Ethernet interface works since the webpage was returned to the PC correctly). Anyhow, when the destination IP is entered into Internet Explorer (or when using "ping") the webpage doesn't load and the request times out. I think that the log below shows the underlying reasons for this as explained before.
 
I am using an online compiler to compile the application as a part of the project. A few minor code changes were made to ensure the code complied with the compiler's strict rules - type casts were introduced to get rid of the errors such as given below...
 
e.g. from lwIPWeb.zip
 
void CopyFromFrame_EMAC(void *Dest, unsigned short Size)
{
  unsigned short * piDest;                       // Keil: Pointer added to correct _expression_
  piDest = (unsigned short *) Dest;      //CAST added, the compiler gives an error otherwise!   // Keil: Line added
  while (Size > 1) {
    *piDest++ = ReadFrame_EMAC();
    Size -= 2;
  }
    if (Size) {                                         // check for leftover byte...
    *(unsigned char *)piDest = (char)ReadFrame_EMAC();// the LAN-Controller will return 0
  }                                                   // for the highbyte
}
 
...and similar errors with NULL where I actually had to cast NULL into the type on the left side of the statement, e.g. (struct pcb_tcb *) NULL or as can be seen below (example from netif.c).
 
struct netif *netif_list = (netif *) NULL; // 23-10-08 Cast added
struct netif *netif_default = (netif *) NULL; // 23-10-08 Cast added
 
Debugging seems to show that these casts did not affect anything while rectifying the errors and allowing for the application to be compiled!
 
Any help and/or feedback would be highly appreciated since I have spent several weeks debugging already.
 
Thanks in advance,
 
Stan.
 
--------------------------------------------------------------------------------------------------------------------
 
###############
#TeraTerm output#
###############
 
Debug - p is NOT NULL, Ethernet Header Type is: 8
Debug - p is NOT NULL, htons Ethernet Header Type is: 800
Debug - Byte number:0:  0
Debug - Byte number:1:  30
Debug - Byte number:2:  6c
Debug - Byte number:3:  0
Debug - Byte number:4:  0
Debug - Byte number:5:  2
Debug - Byte number:6:  0
Debug - Byte number:7:  d
Debug - Byte number:8:  87
Debug - Byte number:9:  74
Debug - Byte number:10:  df
Debug - Byte number:11:  d8
Debug - Byte number:12:  8
Debug - Byte number:13:  0
Debug - Byte number:14:  45
Debug - Byte number:15:  0
Debug - Byte number:16:  0
Debug - Byte number:17:  3c
Debug - Byte number:18:  53
Debug - Byte number:19:  f0
Debug - Byte number:20:  0
Debug - Byte number:21:  0
Debug - Byte number:22:  80
Debug - Byte number:23:  1
Debug - Byte number:24:  65
Debug - Byte number:25:  11
 
(the following bytes give the correct source ip 192.123.0.101)
Debug - Byte number:26:  c0
Debug - Byte number:27:  7b
Debug - Byte number:28:  0
Debug - Byte number:29:  65
 
(the following bytes give the correct destination ip 192.123.0.100)
Debug - Byte number:30:  c0
Debug - Byte number:31:  7b
Debug - Byte number:32:  0
Debug - Byte number:33:  64
 
Debug - Byte number:34:  8
Debug - Byte number:35:  0
Debug - Byte number:36:  15
Debug - Byte number:37:  5c
Debug - Byte number:38:  2
Debug - Byte number:39:  0
Debug - Byte number:40:  36
Debug - Byte number:41:  0
Debug - Byte number:42:  61
Debug - Byte number:43:  62
Debug - Byte number:44:  63
Debug - Byte number:45:  64
Debug - Byte number:46:  65
Debug - Byte number:47:  66
Debug - Byte number:48:  67
Debug - Byte number:49:  68
Debug - Byte number:50:  69
Debug - Byte number:51:  6a
Debug - Byte number:52:  6b
Debug - Byte number:53:  6c
Debug - Byte number:54:  6d
Debug - Byte number:55:  6e
Debug - Byte number:56:  6f
Debug - Byte number:57:  70
Debug - Byte number:58:  71
Debug - Byte number:59:  72
Debug - Byte number:60:  73
Debug - Byte number:61:  74
Debug - Byte number:62:  75
Debug - Byte number:63:  76
Debug - Byte number:64:  77
Debug - Byte number:65:  61
Debug - Byte number:66:  62
Debug - Byte number:67:  63
Debug - Byte number:68:  64
Debug - Byte number:69:  65
Debug - Byte number:70:  66
Debug - Byte number:71:  67
Debug - Byte number:72:  68
Debug - Byte number:73:  69
Debug - Byte number:74:  0
Debug - Byte number:75:  0
Debug - Byte number:76:  0
Debug - Byte number:77:  0
Debug - Byte number:78:  0
Debug - Byte number:79:  0
Debug - Byte number:80:  0
Debug - Byte number:81:  0
Debug - Byte number:82:  0
Debug - Byte number:83:  0
Debug - Byte number:84:  0
Debug - Byte number:85:  0
Debug - Byte number:86:  0
Debug - Byte number:87:  0
Debug - Byte number:88:  0
Debug - Byte number:89:  0
Debug - Byte number:90:  0
Debug - Byte number:91:  0
Debug - Byte number:92:  0
Debug - Byte number:93:  0
Debug - Byte number:94:  0
Debug - Byte number:95:  0
Debug - Byte number:96:  0
Debug - Byte number:97:  0
Debug - Byte number:98:  0
Debug - Byte number:99:  0
 
Debug - hdr->ip.dest: 86400, hdr->ip.src: 7bc06500, netif->ip_addr: 64007bc0, netif->netmask: ffffff
 
Debug - source is not on the local network
 
Debug - Entering ip_input function
 
Debug - iphdr->dest: 65007bc0 , p->payload: 4000332a
 
Debug - iphdr->dest.addr: 65007bc0 , netif->ip_addr: 64007bc0, iphdr->src.addr: 11657bc0
 
Debug - Result of comparison function: 0
 
Debug - DHCP is set to: 0
 
Debug - ip_input: packet not for us  :-(
-------------------------------------------------------------------------------------------------------------------------------------


reply via email to

[Prev in Thread] Current Thread [Next in Thread]