cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F746 DISCO LwIP + FreeRTOS configuration in STM32CubeMX

Hoang Phuc
Associate II
Posted on May 24, 2017 at 10:11

Hello World,

Im new to working on LwIP and I want to create a simple Webserver based on LwIP stack and FreeRTOS configured by the CubeMX. I read carefully all the user manual. I also tried to run and digged into the Netconn HTTP server example, but I still couldnt make it work! 

I guess my configurations in the CubeMX has problems, so I post them here, if anyone have successfully worked on this project can help me, if possible could I have your .ioc file to study more about my problem ?

Thank for read my post in advance

My ETH config

0690X00000606y2QAA.png

LwIP config. I disabled HTTPD feature.

0690X000006075RQAQ.png

This is my FreeRTOS configs

0690X000006075WQAQ.png

This is my 

StartDefaultTask function that I followed an tutorial. I replaced the task in the example by this code and it worked great.

void StartDefaultTask(void const * argument)

{

/* init code for LWIP */

MX_LWIP_Init();

/* USER CODE BEGIN 5 */

struct netconn *pListeningConnection, *pAcceptedConnection;

err_t err;

pListeningConnection = netconn_new(NETCONN_TCP);

err = netconn_bind(pListeningConnection, NULL, 80);

netconn_listen(pListeningConnection);

for (;;)

{

err = netconn_accept(pListeningConnection, &pAcceptedConnection);

if (err == ERR_OK)

{

struct netbuf *inbuf = NULL;

err = netconn_recv(pAcceptedConnection, &inbuf);

netbuf_delete(inbuf);

static const char HelloWorld[] = ''HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n<html><body><h1>Hello, World</h1>This message is shown to you by the lwIP example project.</body></html>'';

netconn_write(pAcceptedConnection,

(const unsigned char*)HelloWorld,

sizeof(HelloWorld),

NETCONN_NOCOPY);

netconn_delete(pAcceptedConnection);

}

}

/* USER CODE END 5 */

}

#stm32cubemx* #stm32f7 #lwip #freertos
0 REPLIES 0