Cannot start a network interface on MPC5748G (lwIP stack)

Showing results for 
Search instead for 
Did you mean: 

Cannot start a network interface on MPC5748G (lwIP stack)

Contributor III


I am struggling with lwip and a UDP connection. I am running it on a board with freeRTOS.

First, I added freeRTOS form the component list. 

Next, I added the tcpip component from the componnent library - it adds the lwIP. The settings of this component are in the included picture.

Third step was set up the PINs in the pin_mux GUI configuration (I am using NXP lwip ping example as a reference - it has been working properly). I am attaching the pin out in the image below.

Fourth step was to create a task for the OS and write few simple NETCONN API commands to send UDP packages. They seem to work (return value is equal to err_ok) up to the netconn_send() command.

The UDP packages are never sent though. I figured out, that it is because the initialisation doesn't work and netconn_send() has no network interface to work with. I cannot get a working network interface.The tcipip_init() function is supposed to create a netif and it fails - by the debbuging I figured out that the netif is always NULL. I tried to add a network interface myself, but it also fails.

It looks that I should enable somewhere some hardware options somewhere, or change the initialisation procedure - the code seems correct, and is similar to NXP example.... Does anybody know how to solve the problem of missing netif?

All my code is inside an InitTask - a Task with hight priority that will run on the power up. I am attaching two code examples that fail. I would be really grateful for any comments or ideas!

My first approach (fails on tcpip_init(), precisely speaking on netif_add() that is called from tcpip_init )

struct netconn *conn;
struct netbuf *buf;
ip_addr_t dst_addr;
ip_addr_t board_addr;
char *send_data;
char text[] = "MPC5748G";
int i;
tcpip_init(NULL, NULL);
err_t connection_err, send_err, bind_err;
PINS_DRV_SetPins(PTB, 0x1000); //PB12
vTaskDelay( 1000 / portTICK_PERIOD_MS );
PINS_DRV_ClearPins(PTB, 0x1000); //PB12
u16_t dst_port = 7000;

/* create a new connection */
conn = netconn_new(NETCONN_UDP);

/* set up the IP address of the remote host */

dst_addr.addr = inet_addr("");
board_addr.addr = inet_addr("");
/* connect the connection to the remote host */
bind_err = netconn_bind(conn, &board_addr, 44444 );
if (bind_err== ERR_OK) { PINS_DRV_SetPins(PTA, 0x1000); } //PA12
connection_err = netconn_connect(conn, &dst_addr, dst_port);

if (connection_err== ERR_OK) { PINS_DRV_SetPins(PTA, 0x2); } //PA1

/* create a new netbuf */
buf = netbuf_new();
netbuf_ref(buf, text, 9);

/* send the arbitrary data */
send_err = netconn_send(conn, buf);

if (send_err == 0) { PINS_DRV_TogglePins(PTE, 0x40) ;} //PE6
vTaskDelay( 500 / portTICK_PERIOD_MS );

I also tried to add the network interface manually with this code, but this also fails:

struct netconn *conn;
struct netbuf *buf;
ip_addr_t dst_addr, addr, gw, netmask;
struct netif* my_netif;
char *send_data;
char text[] = "MPC5748G";
int i;
/* IP default settings*/
IP4_ADDR(&addr, 192, 168, 0, 200);
IP4_ADDR(&gw, 192, 168, 0, 1);
IP4_ADDR(&netmask, 255, 255, 255, 0);
err_t my_ip_init(struct ip_addr *addr,
struct ip_addr *netmask,
struct ip_addr *gw,
err_t (* init)(struct netif *netif),
err_t (* input)(struct pbuf *p, struct netif *netif));
tcpip_init(NULL, NULL);
netifapi_netif_add(&my_netif, &addr, &netmask, &gw, NULL, enet_ethernetif_init, tcpip_input);

/* register the default network interface */


I am attaching my set up of the pins form pin_mux, and the configuration of the tcpip component:


0 Kudos
2 Replies

Contributor II


I also want to change the IP address. It can ping but cannot transmit data.

Have you solved your problem?

Thanks and best regard,


0 Kudos

NXP Employee
NXP Employee


This is question on IwIP stack and it is not MCU related.

Maybe someone from community can help you.


best regards,



0 Kudos