RTOS - FTP and HTTP rap API lwIP SAM4E

metio wrote on Tuesday, August 16, 2016:

Hi all,

I’m working on a project that combines a HTTP and FTP servers. The FTP server was implemented in later stage in the project because of the need to transfer large amount of data approximately 1 GB of data file. The applications both the ftp and the http are using raw PAW on top of lwIP.
Since the http server was provided by the vendor Atmel, there are no many problems with it.
My problem occurs when I want to implement both two applications to run at the same time, at the current state the ftp works if the http is enabled and other way around.

Brief Periodically retrigger timeout process.
After managing the lwIP timers. trigger corresponding ethernet process.
////////////////////////////////////////////////////////////////////////////////////////////////////////////

void ethernet_task(void)
{
	/* Run polling tasks */
	ethernetif_input(&gs_net_if);

	/* Run periodic tasks */
	timers_update();
	
}

Brief Create ethernet task, for ethernet management.
////////////////////////////////////////////////////////////////////////////////////////////////////////////

void init_ethernet(void)
{
	/** set a unique MAC address from falsh**/
	set_MAC_addresses();
	
	/** Initialize lwIP */
	lwip_init();				//initializes the functions enabled in lwipopts.h

	/** Set hw and IP parameters, initialize MAC too */
	ethernet_configure_interface();
	
	//LLMNR_init(&gs_net_if);		//initializes the LLMNR responder

#if defined(HTTP_RAW_USED)
	/** Bring up the web server */
	http_init();	
#endif

#if defined(FTP_RAW_USED)	
	/** Bring up the FTP server */
	ftpd_init();
#endif
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////

#define TASK_webserver_STACK_SIZE                (4096/sizeof(portSTACK_TYPE))
#define TASK_webserver_STACK_PRIORITY            (tskIDLE_PRIORITY + 3)

////////////////////////////////////////////////////////////////////////////////////////////////////////////

static void webserver_task(void *pvParameters)
{
	UNUSED(pvParameters);
 	/** Wait for user to read instructions. */
	WAIT_FOR_EVENT;
	
	while (1) {
    ethernet_task();
	}
} 

//////////////////////////////////////////////////////
MAIN.

	sysclk_init();
	board_init();
	init_ethernet();

if (xTaskCreate(webserver_task, "webserver", TASK_webserver_STACK_SIZE, NULL,TASK_webserver_STACK_PRIORITY, NULL) != pdPASS) {
}

My question is how I can possibly proceed to get the two servers working?
Should I create another task for the FTP server?

Thanks in advance!

rtel wrote on Tuesday, August 16, 2016:

I’m afraid lwIP support is out of scope for this forum. We do however
have our own FTP and [basic] HTTP examples running on Atmel hardware:
http://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCPIP_FAT_Examples_Atmel_SAM4E.html

metio wrote on Tuesday, August 16, 2016:

Thank you for your quick response!!

To simplify my question… Why the FTP server cannot work when I enable the HTTP server.?
Do I have to cr4eate a separate task?
Thank you!!