This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TM4C1294NCPDT: LWIP ICMP checksum

Part Number: TM4C1294NCPDT

Hi, 

I have been trying to implement ping via LWIP into my custom TM4C board with little success. 

After doing tracing on wireshark I have found that the board receives the ping and does respond but leaves the checksum as a 0 (all of this done on Windows 10).  Because the checksum is a 0 the response in my command line is  "Request timed out".

So, I have looked at a few other LWIP sources and found that the issue is in the icmp.c (ipv4) source file in the icmp_input function. When i have tried to step through this section I can see the checksum go into  ip_output_if with a value and come back out with a 0. I have traced through ip_output_if and can not find a single place that modifies the checksum handed in through the payload buffer. 

I have also modified lwipopts.h. LWIP_ICMP is defined to 1 and all of the checksums in the checksum options are defined to 1. 

At this point I am stuck and would like some help getting this checksum issue fixed. As far as I can tell this is the only thing holding my ping response hostage.  

Reference Code: 

ip_output_if (p, ip_current_dest_addr(), IP_HDRINCL, ICMP_TTL, 0, IP_PROTO_ICMP, inp); // Line 223 in icmp.c


//*****************************************************************************
// 
// ---------- checksum options ----------
// changed from the original, all of these were commented
//*****************************************************************************
#define CHECKSUM_GEN_IP 1
#define CHECKSUM_GEN_UDP 1
#define CHECKSUM_GEN_TCP 1
#define CHECKSUM_CHECK_IP 1
#define CHECKSUM_CHECK_UDP 1
#define CHECKSUM_CHECK_TCP 1

  • LWIP is third party (not done by TI) software and is provided in TivaWare as a convenience. You may find better results by posting LWIP questions to the LWIP User's mailing list: lists.nongnu.org/.../lwip-users

    That said, when verifying a packet with the checksum already attached, the expected result is 0.
    See: www.roman10.net/.../
  • Thank you for the information on the LWIP mailing list.

    As far as your second comment, that is not relevant to this issue as ICMP has its own checksum beneath the IP/TCP/UDP layer. I appreciate the information but sadly it doesn't help with the current issue.

    Daniel
  • Daniel Norris said:
    I have also modified lwipopts.h. LWIP_ICMP is defined to 1 and all of the checksums in the checksum options are defined to 1.

    EMAC0 DMA engine adds/verify checksums via hardware unless check sum is disable in DMA engines configuration. You can enable LWIP1.4.1 IP checksums, seem to recall tcp_ip.c or Ip.c.. 

  • HI Daniel,

     I assume that your PC is trying to send a ping command to the custom board. Is this correct?

    Can you try one of TivaWare ethernet example (I used enet_lwip) and use the PC to ping the board? I just tried that and below is what I see on the wireshark.

     In No 131, the PC tries to ping the MCU with a echo (ping) request. The checksum in the ping request is as follows.

    In No 134, the MCU is sending the echo (ping reply) as follows.

    The ICMP is part of the LwiP's IP stack for diagnostic. I will even think that without the LWIP_ICMP defined it should still work when responding to a echo request from the host. 

    But if you are trying to build a ping command into the MCU then I think the ping will be implemented in the application layer. I don't think there is an API from the LwIP stack that you can call to send the ICMP message. I may be wrong. I will suggest you post your question to the LwIP forum where the LwIP expert can advice if this is what you are trying to do. In my opinion you should be able to implement the ICMP message at the IP level.