NOTICE: The Processors Wiki will End-of-Life in December of 2020. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.

LAUNCHXL2 570LC43: lwIP Active Webserver Demo

From Texas Instruments Wiki
Jump to: navigation, search

Introduction

There is an existing static webserver demo available for the Hercules development kits and the supported launchpads.This link http://processors.wiki.ti.com/index.php/HALCoGen_Ethernet_Driver_and_lwIP_Integration_Demonstration provides more details about it.Modifications have been done to this demo to support active webserver which can be ran on LAUNCHXL2 570LC43 and LAUNCHXL2 RM57x. This Active web server demo tries to showcase active webserver running on the LAUNCHXL2 570LC43 and LAUNCHXL2 RM57x launchpad.The webserver implementation supports SSI and CGI calls.Using this demo user can toggle the led on the launchpad and sent text to a serial terminal connected to the com port on the launchpad.

NOTE: This demo currently supports only LAUNCHXL2 570LC43 and LAUNCHXL2 RM57x.The port to the other platforms should be straight forward and majorly needs changes in the Halcogen configuration in similar lines to the halcogen configurations created for LAUNCHXL2 570LC43,LAUNCHXL2 RM57x in this active webserver demo.


Additional changes in the LWIP port and Halcogen configuration

To enable the active webserver demo on the launchpad there have been modifications made to the Halcogen configuration and the LWIP port.

Halcogen Configuration Changes

The sections below describe the additional configuration changes made to the Halcogen in addition to changes mentioned in the wiki article LWIP Demo.

Driver Enable tab changes

  • Enable GIO
  • Enable RTI driver

Pinmux changes

  • Enable GIO

interrupts

  • Enable interrupts for the RTI compare 0 and RTI compare 2

GIO changes

  • Enable output direction for GIOB pin 6 and 7.THE GIO is used for the user LED 2 and LED 3.

RTI changes

  • Set RTI compare 0 for 10 ms and RTI compare 2 for 500 ms. drive both compares by counter 0.The RTI compare 0 is used for servicing the LWIP timers and the RTI Compare 2 is used for the blinking animation LED LED3.

LWIP port changes

The port now services the LWIP timers needed.(the demo should work even without this) A bug in the transmission of the packets smaller than 60 bytes has been fixed in the port. Some additional guard code has been added to port.The changes done are majorly in files as listed belo

FILE CHANGE
\third_party\lwip-1.4.1\ports\hdk\netif\hdkif.c added guard conditions,fixed a bug in the hdkif_output()
\utils\lwiplib.c added servicing of LWIP timers.
\TMS570LC43x\Build-LAUNCHXL2-570LC43\lwipopts.h configuration changes for the LWIP stack
\RM57x\Build-LAUNCHXL2-RM57x\lwipopts.h configuration changes for the LWIP stack
\example\hdk\src\lwip_main.c initialization of application & control path for the LwIP & EMAC driver.Added API to handle CGI and SSI calls.


CCS project structure

The below snapshot shows the CCS project structure and explains about the important files.


CCS project structure #REDIRECT Target page name


Changing the web pages rendered by webserver

As indicated in the previous section folder /fs (file system which is rendered) contains the present html files,java scripts which are being rendered by the active webserver.The contents of folder can be converted to a .h file containing various data structures as in io_fsdata.h using the utility in tools/makefsfile.exe as shown below.(there is also a perl script available at location third_party\lwip-1.4.1\apps\httpserver_raw\makefsdata you can read through the script to get better understanding of the utility).

makefsfile.exe -i fs -o io_fsdata.h -r -h -q

here

  • fs is the folder containing the file system(html files, java scripts, images etc.) which is being rendered by the webserver.
  • io_fsdata.h is the .h file genereated.


Demo features

The demo serves a web page which can be navigated,it is not a static web page and it also alows controls to control some leds on the launchpad.There are two demos bundled. The hardware setup,building and execution the demo is similar to what is described in the wiki article http://processors.wiki.ti.com/index.php/HALCoGen_Ethernet_Driver_and_lwIP_Integration_Demonstration

IO control demo 1

The demo provides the toggle led button which can be used to toggle LED2 on the launchpad.The demo also shows the current status of the ked.It provides a text box which can be used to control the blinking speed of the animation led LED 3. This demo show cases the CGI handling capability of the webserver demo.

Below snapshot shows the IO control demo 1 page


IO control 1 demo



IO control demo 2

The IO control demo 2 show cases the SSI capabilty of the webserver.It shows the current status of LED 2 and the current blinking percentage of the animation led LED 3. User can even update the percentage of the blinking.It also provides a text box in which user can enter any text and observe it on the uart connected to the com port of the launchpad.


IO control 2 demo



Conclusion

The active webserver demo based on the LWIP stack has been showcased in this demo.The demo gives an example of the CGI and SSI call handling. This is just a demo and user can use the additional configuration options of the LWIP stack to improve the stability of the demo.