EXAMPLE NAME: XMC4700_lwip_httpserver

HISTORY:
V1.0.0 initial version 

OVERVIEW: 
XMC4700/XMC4800 Web Server Demo including MicroSD card access

REQUIREMENTS:
1) "XMC4700 Relax Kit" or 
   "XMC4800 Relax EtherCAT Kit" 
2) Micro USB Cable 
3) MicroSD card formatted with FAT32, if you want to display your own web pages
4) Router with DHCP and DNS capabilities
   and Standard ethernet cable for connection via router
    or
   Crossover cable for direct connection to your PC
4) Windows PC/Laptop installed with DAVE v4 (Version 4.1.4 or higher)

DESCRIPTION:
This example demonstrates the implementation of a tcp/ip-stack, http server ad SD card access 
on top of the XMC Lib drivers. 
Your PC/laptop and the board is connected via a router (OPT1) or directly (OPT2).
These two options will be referenced later in this document using the keywords OPT1 and OPT2. 
By accessing the webpage (which is compiled into flash) the LEDs on your board can be toggled.
You can modify the webpages compiled into flash or even copy them to a MicroSD card which you
enter into the X401 Micro SD card slot.
By default DHCP is enabled. After startup it is checked if BUTTON1 is pressed and if yes, DHCP is disabled. 

Source structure:
1)./httpserver_raw    This is the http server implementation
2)./UserCode          FatFS and SD card driver implementation 
                      (ported from DAVE APP (DAVE v3) for this example only)
3)./Libraries         Here you find the XMC Lib, CMSIS and tcp/ip-stack(lwip)
4)main.c              Initialization of modules and toggling of LEDs
5)board_test.c        Check for availability of Ethernet-PHY (for failsafe usage of this App on 
                      "XMC4700 Relax Lite Kit" and "XMC4700 Relax Kit for 5V Shields")

XMC Lib components used:
1)XMC_GPIO_*          Configure and control of ports
2)XMC_SCU_*           Configure and control of system control unit (here: SD card clock)
3)XMC_RTC_*           Control of real time clock (used inside FatFS for time/date)
4)XMC_SDMMC_*         Used to implement the SD card driver.
5)XMC_ETH_*           Used to implement the ethernet driver and tcp/ip stack ontop

CMSIS components used:
1)NVIC_*              Configure, control and enable interrupt of SD card and SysTick 

BUILD:
Please note, the project has to be rebuild after importing because the build result folder 
has been deleted to reduce the size.
1) Import the project
2) Build and flash the application to the device using USB X101 connection

SETUP:
1) Connect Micro USB cable to Relax Kit USB plug X101 and to a PC/laptop.
2) OPT1: Connect standard ethernet cable to the Relax Kit and to router.
   OPT2: Connect crossover ethernet cable directly to your PC.
3) OPT1: Connect the PC/laptop to the same router.
4) OPT2: Fix the IP address of your PC/laptop to 192.168.0.20 netmask 255.255.255.0
         inside Network Sharing Center/Adapter Settings/Local Area Connection/Internet Protocol Version 4 

HOW TO TEST:
1) OPT1: Reset
   OPT2: Push BUTTON1 during startup/reset to disable DHCP. Release BUTTON1.
   OBSERVATION: After reset the LED1 and LED2 is on. You can toggle LED1 by pressing BUTTON1 and 
   LED2 by pressing BUTTON2.
2) OPT1: Open command window and type "ping relax".
   OPT2: Open command window and type "ping 192.168.0.10".
   OBSERVATION: You will see replies arriving from the server.
3) OPT1: Access the web server with any browser by using the URL "http://relax".
   OPT2: Access the web server with any browser by using the IP adress "http://192.168.0.10".
   OBSERVATION: The web page "index.htm" complied into flash will show the Infineon 
   Logo and two buttons. When pressing the buttons on the webpage the LEDs on the Relax Kit will be 
   toggled (switched on or off).
4) To recompile the files which are compiled into flash, 
	a) place the files inside ./httpserver_raw/makefsdata/fs. 
        b) Execute ./httpserver_raw/makefsdata/makefsdata.exe
        c) Copy the generated file ./httpserver_raw/makefsdata/fsdata.c to ./httpserver_raw/fsdata.c
5) If you want to see your own web pages you can store these files on a microSD card and
   plug the card into the microSD slot on the Relax kit.
   OBSERVATION: Your files show up inside browser.
