Overview
========
The tftp OTA demo reference design is consist of 2 examples - SBL and APP.
This is the APP example for OTA demo which provides 3 tasks/functions at application level based on FreeRTOS. 
- main task: toggle a LED around per 2 seconds.
- WiFi setup task: set up manually the network on WiFi every time power up/reset.
- tftp OTA task: with Wifi, check and get an updated app binary file from tftp server to program in external spifi flash
				 on target board.

The example provides a network setup menu for manual costumization to the Wifi network after power up. After setup is OK, 
a LED is shining and the example is checking if the app on tftp server is updated. If updated, get and program the app binary 
file to the external spifi flash on the target board.
(Remark: SBL example will determine to run an old or new APP by checking the info on spifi flash when power up)


Toolchain supported
===================
- Keil MDK 5.27

Hardware requirements
=====================
- lpc5460x IoT kit
- Mini/micro USB cable
- Personal Computer

Board settings
==============
No special requirement.

Prepare the Demo
================

1.  Configure your dedicated device to create a WiFi network AP.

2.  Connect a micro USB cable between the PC host and the USB port printed 'CN1 UART' on the target board.
3.  Open a serial terminal with the following settings (check devicd manager for the serial port number):
    - 115200 baud rate
    - 8 data bits
    - No parity
    - One stop bit
    - No flow control
4.  For the first time when there is no app on internal flash, download the program to the internal flash by debugger.
	(later, the app is aquired using OTA via tftp) 


Running the demo
================
When the demo runs successfully, the LED turns on and the log would be seen on the serial terminal like:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           [WiFi tftp spifi OTA Demo - APP]

-----set up WiFi network------

main task: The LED is shining...

Atheros_Driver_Task
WAITING FOR WMI READY
Driver_Init A_OK
WLAN driver initialized in 185ms with 0 irqs
WLAN driver malloc'ed 7406 bytes (not counting OS structures!)
Host version:      3.3.0.0
Target version:    0x31c80997
Firmware version:  3.3.4.91
Interface version: 1
number of FreeRTOS tasks = 6
Entering main loop
============ WiFi Network Setup Menu ============
  s  scan & select AP
  c  connect AP
  p  Ping tftp server IP
  r  request DHCP address
  v  view IP configuration
  D  disconnect AP
  m  Print this menu
  x  Exit setup
 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- Press 's' to scan available APs and select the AP to be connected.
- Press 'c' to connect to the selected AP and get the DHCP for the target board.
- Press 'p' to ping the tftp server IP.
(Remark: the Wifi network setup is completed with the above 3 steps) 
- Press 'r' to request and get the DHCP for the target board (normally, it can be done with pressing 'c').
- Press 'v' to view the IP configurations containing the connected AP info(SSID&password), the DHCP address and so on.
- Press 'D' to disconnect the AP (generally for network retrial test)
- Press 'm' to print this menu
- Press 'x' to exit the network setup after it is completed.

Customization options
=====================

