Loading...
 
Skip to main content

System Workbench for STM32


HTTPD Server - fsdata.c issue

Bernard,

I only mentioned Linux because you mentioned it in your first reply. I did not #include any files. All #includes were generated by CubeMX before I imported the project into System Workbench.

I am using the raw API, no RTOS. I previously searched for the function httpd_init() in the files and did not find it. After reading your post, I scrolled through httpd.c and found the function. I #included httpd.h in main.c and added the function call after the MX_LWIP_Init() function call. That has made a difference as I now get an error message "The connection to the server was reset while the page was loading." when I put the IP into the URL bar.

I removed all my html code except index.html and one jpg file that index.html refers to and used makefsdata.exe to regenerate the fsdata.c file. The only thing in the index.html code is a reference to the jpg file. The index.html file opens in Firefox and displays the jpg file.

I am not using LWIP_HTTPD_SSI or LWIP_HTTPD_CGI. I wanted to keep everything as simple as possible until I was able to get the server working.

I am calling MX_LWIP_Process() repetitively in my main loop. Ping will not work without that call. That is really all I am doing other than blinking a couple of LEDs. The code looks like this:

while (1)
{
ticks = 500;
while(ticks != 0xFFFF)
{
MX_LWIP_Process();
}
HAL_GPIO_TogglePin(GPIOD, LED1);
HAL_GPIO_TogglePin(GPIOD, LED2);
}

The ticks variable is being incremented in the sys_ticks() system call.

Any other suggestions? So far you have been really helpful. I think I will eventually get this going.

Ray