FreeRTOS LWIP LPC1769 LPCXpresso

calagan113 wrote on Tuesday, November 20, 2012:

Hi all,

My design is based on FreeRTOS+IO and FreeRTOS+CLI demo 2 functionality provided by FreeRtos.
I used it to make a socket server application (TCP server), the function is good but I want to investigate about the speed.

I monitor my “conection” with WireShark, and send data from the PC to by board. I’ve got a custom application which send me data (around 88 Bytes in 5 packets).

And I found that the speed is slow 2Mbits/sec.
I use the socket api.

And I would like to know how to increase this speed I know that I can expect 100Mbits/sec ( also I use a TCP server) but I’m expected around 40Mbits/sec.

Thanks for help.

rtel wrote on Tuesday, November 20, 2012:

Note an update to the FreeRTOS+IO code has just been released.  You can download it from the existing FreeRTOS+IO featured demo web page.

The sockets interface is going to be the slowest of the three available lwIP APIs.  I know there has been some discussion on the lwIP mailing list about the sockets performance, I would recommend looking in their archive.


calagan113 wrote on Monday, November 26, 2012:

Ok thanks for the reply.
Maybe someone can show me how to use the netconn api, I want to make a simple tcp server.

I tried this piece of code

	struct netconn *conn, *newconn;
	err_t err;
	/* create a connection structure */
	conn = netconn_new(NETCONN_TCP);
	/* bind the connection to port 2000 on any local IP address */
	netconn_bind(conn, NULL, 7);
		printf("Now listening\n");
	/* tell the connection to listen for incoming connection requests */
	/* Grab new connection. */
	err = netconn_accept(conn, &newconn);
		printf("accepted new connection %p\n", newconn);
	/* Process the new connection. */
	if (err == ERR_OK) 
		struct netbuf *buf;
		void *data;
		u16_t len;
		while ((err = netconn_recv(newconn, &buf)) == ERR_OK) 
			printf("Received data\n");
				netbuf_data(buf, &data, &len);
				err = netconn_write(newconn, data, len, NETCONN_COPY);
				if (err != ERR_OK)
					printf("tcpecho: netconn_write: error \"%s\"\n", lwip_strerr(err));
			}while (netbuf_next(buf) >= 0);
	/* Close connection and discard connection identifier. */

There is something I don’t understand (sorry but I’am not familiar with tcp/ip stack) to initialize the emac driver and the lwip stack, on the example (from freeRtos) we could see :

tcpip_init( lwIPAppsInit, NULL );

Why I can’t write

tcpip_init( NULL, NULL );

For now this doesn’t work, the server start receiving data then nothing and the data rate goes near 0bps.