
This is a fast getting started for using the Microchip TCP/IP stack
with Olimex' PIC-GSM board. It is highly recommended to read the
excellent stack documentation from Microchip before proceeding.


1. GETTING THE ORIGINAL MICROCHIP TCP/IP STACK DISTRIBUTION.
	The Microchip TCP/IP stack version 5.00 can be freely downloaded from 
http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=2680&dDocName=en537041 
or alternatively:
http://www.microchip.com/Microchip.WWW.SecureSoftwareList/secsoftwaredownload.aspx?device=en537041&lang=en&ReturnURL=http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=2680&dDocName=en537041#


2. PATCHING 
	Download the patch ZIP archive for PIC-GSM from 
http://www.olimex.com/dev . Then unzip it in the 'Microchip Solutions' 
directory where the TCP/IP stack source code resides (this is the directory 
that contains the subdirectories "Internet Bootloader App", 
"Internet Radio App", "Microchip", "SSL Demo App", "TCPIP Demo App", 
"TCPIP WebVend App". Ensure that apply-patch.bat, patch.exe and the 
patch file are in the source directory. After that execute the apply-patch.bat 
script.

NOTE: Here is a sample output from DIR from a correctly prepared source 
directory:

=============================================================================
C:\temp\olimex>dir  /OG
 Volume in drive C has no label.
 Volume Serial Number is 8CA2-A7E1

 Directory of C:\temp\olimex

05/18/2009  01:37 PM    <DIR>          .
05/18/2009  01:37 PM    <DIR>          ..
05/18/2009  01:36 PM    <DIR>          TCPIP WiFi Demo App
05/18/2009  01:36 PM    <DIR>          Internet Bootloader App
05/18/2009  01:36 PM    <DIR>          Internet Radio App
05/18/2009  01:36 PM    <DIR>          Microchip
05/18/2009  01:36 PM    <DIR>          WiFi Iperf App
05/18/2009  01:36 PM    <DIR>          TCPIP WebVend App
05/18/2009  01:36 PM    <DIR>          TCPIP Demo App
05/15/2007  01:19 AM           112,128 patch.exe
05/18/2009  09:33 AM               772 apply-patch.bat
05/18/2009  01:36 PM         1,451,218 olimex-pic-gsm.patch
05/18/2009  01:36 PM             2,126 README.txt
               4 File(s)      1,566,244 bytes
               9 Dir(s)  23,626,739,712 bytes free
=============================================================================


3. RUNNING
	Only the ".\TCPIP Demo App\TCPIP Demo App-C18.mcw" project is 
ported (and relevant) to PIC-GSM. Load it in MPLAB and compile it.

If the compiler generates this error:
Error - could not find definition of symbol '__Write1USART:0' in file 'Objects - TCPIP Demo App-C18\gsm-hw.o'.
then you have to enable Extended mode option in Build options>MPASM/C17/C18 Suite

4. UPDATING THE WEB PAGE
	The web pages for PIC-GSM are located in 
".\TCPIP Demo App\WebPages2" ("WebPages" is for the legacy HTTP server).
After modifying the web page contents the script 
".\TCPIP Demo App\Convert WebPages to MPFS.bat" must be executed in order
to generate an MPFS2 image. After that the source must be recompiled and
the HEX uploaded to the PIC microcontroller.

	NOTE: The web pages are stored in the PIC internal FLASH program memory!

5. LOCATING PIC-GSM
	Run the ".\Microchip\TCPIP Stack\Utilities\Microchip Ethernet Discoverer.exe"
utility in order to find what IP address has PIC-GSM fetched from DHCP.


6. I/O NOTES
	- LED, REL1 and REL2 can be toggled from the main web page. Note
	  that LED value shown on the web page is inverted. Try to change that
	  as an exercise.
	- Input status is shown for:
		o GSM status output pin
		o USB present pin
		o IN2 digital input
		o IN1 digital input
		o PWR KEY
		o B1 button
	- Temperature reported by the GSM module is shown on the main web page.
	- The analog voltage on "+12V" power supply (measured by AN4) is shown.
	- Number of seconds since board startup are shown.
	- Two separate web pages for placing a GSM voice call and sending SMS.
	- Web page with dynamic variables, including GSM battery status, 
	  temperature reported by GSM and up to 8 external I2C TCN75A digital
	  sensors.

	If B1 is pressed for more than 2 seconds during ongoing voice call
the board will toggle between the internal pair of microphone/speaker and 
an external handsfree. If, on the other hand, the GSM module is idle and
there is no ongoing call then the board buzzer will be activated/deactivated.

