ECE471/571 (RTOS) STM32 FreeRTOS+LwIP Example - The very first Web Site - STM32 Demo Project

In STM32CubeMX

  1. Initialize all peripherals with in default mode? - yes
  2. System Core
  3. Connectivity: enable Ethernet: RMII (already enabled))
  4. Middleware - enable FreeRTOS
  5. Middleware - enable LwIP
  6. System Core Again
    • SYS - select Timebase Source: TIM2
    • NVIC - Enable Ethernet Global Interrupt (sometimes it does not get enabled automatically!)
    • disable USB_OTG_FS (optional)

Adapt and compile a project

  1. Copy the provided fsdata_custom.c file to Middlewares\Third_Party\LwIP\src\apps\http\ and "Exclude from Build" in the project settings
  2. See also: makefsdata utility
  3. Open source/lwip.c and inspect the contents of the function void MX_LWIP_Init(void)
  4. Open source/main.c
  5. Update the following code fragment:
    /* USER CODE BEGIN Includes */
    #include "lwip/apps/httpd.h"
    /* USER CODE END Includes */
    
  6. Update the following code fragment:
      /* USER CODE BEGIN 2 */
      MX_LWIP_Init();
      //start the web server after MX_LWIP_Init() is called
      httpd_init();
    
      /* USER CODE END 2 */
    
  7. Update the following code fragment:
    void StartDefaultTask(void const * argument)
    {
      /* init code for LWIP */
      // MX_LWIP_Init(); -- moved back to the main function
      /* USER CODE BEGIN 5 */
    
      /* Infinite loop */
      for(;;)
      {
        osDelay(1);
      }
      /* USER CODE END 5 */
    }
    
  • Lookup the board IP address in your Router.
    Many examples provided on the Internet use way around by setting up a constant static IP address. Use of static IP is not realistic. At the same time this is no a computer network course. Hence we will not discuss solutions such as service discovery.
  • Open the Web browser and type: http://<:insert_server_ip_address>/ or http://<:insert_server_ip_address>/STM32F7xx.html
  • web site front local main page local list page general bookmarks software bookmarks go back copyright info