Arch Max - Network works fine except ping

The Arch Max and the Arch Pro both have the same DP83848J Ethernet Transceiver chip. The Arch Pro uses the LPC1768 and the Arch Max uses the much faster STM32F407VET6. They both use the same EthernetInterface library. I noticed the Arch Pro can be pinged on it's IP address, but the Arch Max cannot be pinged on it's IP address. Otherwise the network works fine with TCP/IP Server/Client, just ping does not work. I explained the issue well enough to Seeed support, including the fact that the TCP server/client run just fine, and NTP servers returned the right date and time. Just ping didn't work on the Max. When the same cables were plugged to the Pro, ping just works. They told me my network cable was probably broken! Credits to Hill Kim for offering a solution. https://developer.mbed.org/users/hillkim7/

He explained the ICMP protocol used by Ping, has a problem with the hardware checksum generation of the STM32. Modify the file EthernetInferface/lwip/core/ipv4/icmp.c as follows. in the icmp_input() function:

    /* adjust the checksum */
    if (iecho->chksum >= PP_HTONS(0xffffU - (ICMP_ECHO << 8))) {
      iecho->chksum += PP_HTONS(ICMP_ECHO << 8) + 1;
    } else {
      iecho->chksum += PP_HTONS(ICMP_ECHO << 8);
    }

modify it as below:

    /* adjust the checksum */
#if CHECKSUM_GEN_ICMP
    if (iecho->chksum >= PP_HTONS(0xffffU - (ICMP_ECHO << 8))) {
      iecho->chksum += PP_HTONS(ICMP_ECHO << 8) + 1;
    } else {
      iecho->chksum += PP_HTONS(ICMP_ECHO << 8);
    }
#else /* CHECKSUM_GEN_ICMP */
    iecho->chksum = 0;
#endif /* CHECKSUM_GEN_ICMP */

Modify the file EthernetInferface/lwip/lwipopts.h as follows. Below ...

#define MEMP_NUM_SYS_TIMEOUT        16
#endif:

... add these line (starting about line 48):

#if defined(TARGET_ARCH_MAX)
#define CHECKSUM_GEN_ICMP           0
#endif

For more information regarding this issue, search the internet with keyword "CHECKSUM_GEN_ICMP". http://lwip.100.n7.nabble.com/No-Ping-Response-td21717.html


Please log in to post comments.