cancel
Showing results for 
Search instead for 
Did you mean: 

FREERTOS, LWIP, HTTPD set up

WilliamVR
Associate III

Hi,

Im currently trying to set up a project where Freertos controls a webserver via lwip.
I tried following these tutorials/guides and managed to be able to ping the board but not get it to host the webserver.

https://github.com/MayaPosch/FreeRTOS_HTTP_server/tree/master

https://community.st.com/t5/stm32-mcus/how-to-create-project-for-stm32h7-with-ethernet-and-lwip-stack/ta-p/49308/show-comments/true

Both of these are not for the STM32F429ZITx board So I copied what I thought I needed.
Right now I have it set up like this:

WilliamVR_0-1710840794056.png

WilliamVR_1-1710840885011.pngWilliamVR_2-1710840894308.png

WilliamVR_3-1710840904622.png

for the code:

The default task calls http_server_netconn_init that cretes a thread. Then this thread is the same as in this tutorial:

https://github.com/MayaPosch/FreeRTOS_HTTP_server/tree/master

I also coppied the exact same files over for the fsdata.
Im connected via a static ip and when I type the IP in the browser or any link to a page it refuses the connection. I also used Advanced IP scanner to check If it was hosting something, but there was nothing.

Does anyone know what I could have forgotten or doing wrong?

Kind Regards,

William

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
WilliamVR
Associate III

So I got it to work, here are my findings for anyone who has the same problem.
- You don't need to activate HTTPD in your ioc file for this to work.

- On this github page: https://github.com/MayaPosch/FreeRTOS_HTTP_server/tree/master

There are two ways: just a static page with fsdate or dynamicly generate the page.

Staticly I didn't get it to work but its probably possible, dynamicly however works fine. 

- It possible that you can't transfer the entire website in one netconn write, I have done it with multiple netconn writes.

 

There are probably better ways of doing it. But this works.

static const char head[] =
		"<!DOCTYPE html>"
		"<html lang=\"en\">"
		"<head>"
		"<meta charset=\"UTF-8\">"
		"<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">"
		//"<meta http-equiv=\"refresh\" content=\"5\">"
		"<title>IRIS</title>";

//rest of page ...
netconn_write(conn, head, strlen((char*)head), NETCONN_COPY);
//netconn_writes for rest of page

 

 

 

View solution in original post

9 REPLIES 9
Pavel A.
Evangelist III

Ask the author of that github project to kindly help?

Instrument the http server code with debug prints to understand why it refuses connection?

 


@WilliamVR wrote:

 it refuses the connection.


What do you mean, "refuses" ?

Do you get an HTTP 4xx failure status?

https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#4xx_client_errors

 

I'll if I can get in touch.
Thats what im currently trying. But im new to freertos so its not exactly printing eveything just yet :).

Well Chrome is being a bit vague, I get this:

WilliamVR_1-1710858841063.png

so there is probably an error somewhere with the TCP transmission.



I think ERR_CONNECTION_REFUSED is probably at the TCP layer - so it's not even getting to your webserver?

Yes,

Its in Dutch but I translated:

WilliamVR_0-1710859353243.png

this is with me trying:

WilliamVR_1-1710859371091.png

I have aslo tried just the IP adres or the 404 from the github code.
I can ping my controller tho, so it doesn't crash.

WilliamVR_2-1710859465424.png

 

Ping is UDP - so could well get through when TCP is refused ...

WilliamVR
Associate III

So I got it to work, here are my findings for anyone who has the same problem.
- You don't need to activate HTTPD in your ioc file for this to work.

- On this github page: https://github.com/MayaPosch/FreeRTOS_HTTP_server/tree/master

There are two ways: just a static page with fsdate or dynamicly generate the page.

Staticly I didn't get it to work but its probably possible, dynamicly however works fine. 

- It possible that you can't transfer the entire website in one netconn write, I have done it with multiple netconn writes.

 

There are probably better ways of doing it. But this works.

static const char head[] =
		"<!DOCTYPE html>"
		"<html lang=\"en\">"
		"<head>"
		"<meta charset=\"UTF-8\">"
		"<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">"
		//"<meta http-equiv=\"refresh\" content=\"5\">"
		"<title>IRIS</title>";

//rest of page ...
netconn_write(conn, head, strlen((char*)head), NETCONN_COPY);
//netconn_writes for rest of page

 

 

 

Thanks for updating.

 


@WilliamVR wrote:

But this works.

WilliamVR_0-1711528664830.png

WilliamVR_1-1711528677654.png


You screenshot has cut off some of the code!

Please don't post code as screenshots - use this button:

AndrewNeil_0-1711533268616.png