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.

MSP432E401Y: Ping support with lwip (No-RTOS)

Part Number: MSP432E401Y

Hi, I have a project that uses lwip without RTOS, I based my project on this example: http://dev.ti.com/tirex/explore/node?node=AOoA7W7yQeZdRcpVGT6w3Q__J4.hfJy__LATEST

The project works fine, but I've tried to add ping support without success. Since there's no a ping example on the Resource Explorer, I used this as a guide: 

http://download.savannah.nongnu.org/releases/lwip/  (contrib-2.1.0/apps/ping)

Then I modified my lwipopts.h file: I enabled LWIP_ICMP and LWIP_RAW (see attached file) but no luck.

What I've noticed is that when I ping my dev kit, the programa doesn't enter this if:

Any help would be appreciated. I attached my ping.c file

ping.c
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
* ping.c
*
* Created on: 13 may. 2019
* Author: RICHARD
*/
#include "ping.h"
#include "lwip/mem.h"
#include "lwip/raw.h"
#include "lwip/icmp.h"
#include "lwip/netif.h"
#include "lwip/sys.h"
#include "lwip/timeouts.h"
#include "lwip/inet_chksum.h"
#include "lwip/prot/ip4.h"
#include "lwip/sockets.h"
#include "lwip/inet.h"
#include <string.h>
#ifndef PING_DEBUG
#define PING_DEBUG LWIP_DBG_ON
#endif
/** ping receive timeout - in milliseconds */
#ifndef PING_RCV_TIMEO
#define PING_RCV_TIMEO 1000
#endif
/** ping delay - in milliseconds */
#ifndef PING_DELAY
#define PING_DELAY 1000
#endif
/** ping identifier - must fit on a u16_t */
#ifndef PING_ID
#define PING_ID 0xAFAF
#endif
/** ping additional data size to include in the packet */
#ifndef PING_DATA_SIZE
#define PING_DATA_SIZE 32
#endif
/** ping result action - no default action */
#ifndef PING_RESULT
#define PING_RESULT(ping_ok)
#endif
static const ip_addr_t* ping_target;
static u16_t ping_seq_num;
static struct raw_pcb *ping_pcb;
static void ping_prepare_echo( struct icmp_echo_hdr *iecho, u16_t len)
{
size_t i;
size_t data_len = len - sizeof(struct icmp_echo_hdr);
ICMPH_TYPE_SET(iecho, ICMP_ECHO);
ICMPH_CODE_SET(iecho, 0);
iecho->chksum = 0;
iecho->id = PING_ID;
iecho->seqno = lwip_htons(++ping_seq_num);
/* fill the additional data buffer with some data */
for(i = 0; i < data_len; i++) {
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

lwipopts.h

**Attention** This is a public forum