THE EASY WAY EASY SCRIPT FUNCTION Page: 1 Date: January 30th, 2006
The Easy Script Extension is a feature that allows to drive the modem "internally" writing the software application directly in a high level language: PYTHON The Easy Script Extension is aimed at low complexity applications where the application was usually done by a small microcontroller that manage some I/O pins and the module through the AT command and interface. Page: 2 Date: January 30th, 2006
Standard configuration EXTERNAL CONTROLLER FLASH ROM GSM-GPRS Protocol Stack FLASH ROM memory GM862 PHISICAL AT SERIAL PORT GPRS MODEM ENGINE AT COMMANDS RAM RAM for GSM-GPRS modem Protocol Stack HARDWARE RESOURCES Page: 3 Date: January 30th, 2006
To eliminate this external controller, and further simplify the programming of the sequence of operations, the PYTHON powered module includes: Python script interpreter engine v. 1.5.2+ around 3MB of Non Volatile Memory for the user scripts and data 1.5 MB RAM reserved for Python engine usage Page: 4 Date: January 30th, 2006
PYTHON Powered Module FLASH ROM Available User NVM FLASH Memory (3Mbyte) PYTHON POWERED PYTHON 1.5.2+ INTERPRETER ENGINE MDM module RAM Available RAM for Python Interpreter (1.5 Mbyte) GSM-GPRS Protocol Stack FLASH ROM memory VIRTUAL INTERNAL AT SERIAL PORT GPRS MODEM ENGINE AT COMMANDS RAM for GSM-GPRS modem Protocol Stack HARDWARE RESOURCES Page: 5 Date: January 30th, 2006
Python implementation description Python scripts are text files, it s possible to run only one Python script in the Telit PY modules The Python script is stored in NVM inside the module. There's a file system inside the module that allows to write and read files with different names on one single level (no subdirectories are supported). The Python script is executed in a task inside the module at the lowest priority, making sure this does not interfere with GPRS/GSM normal operations. This allows serial ports, protocol stack etc. to run independently from the Python script. The Python script interacts with the module functionality through four build-in interfaces. Page: 6 Date: January 30th, 2006
Python interfaces GM862-PY MOD MDM SPI IIC Python engine Print command SER Serial port 1 Serial port 0 Page: 7 Date: January 30th, 2006
Python interfaces MDM The MDM interface is the most important one. It allows Python script to send AT commands, receive responses and unsolicited indications, send data to the network and receive data from the network during connections GM862-PY MOD Print command Serial port 1 MDM Python engine SER Serial port 0 SPI IIC It is quite the same as the usual serial port interface in the Telit modules. The difference is that this interface is not a real serial port but just an internal software bridge between Python and mobile internal AT command handling engine. All AT commands working in the Telit modules are working in this software interface as well. Some of them have no meaning on this interface, such as those regarding serial port settings. The usual concept of flow control keeps its meaning over this interface, but it's managed internally. Page: 8 Date: January 30th, 2006
Python interfaces SER GM862-PY MDM SPI The SER interface allows Python script to read from MOD IIC and write to the REAL physical serial port where usually the AT command interface resides, for example Print command Python engine to read NMEA information from a GPS device SER When Python is running this serial port is free to be Serial port 1 Serial port 0 used by Python script because it is not used as AT command interface since the AT parser is mapped into the internal virtual serial port. No flow control is available from Python on this port. Page: 9 Date: January 30th, 2006
Python interfaces GM862-PY MDM SPI The interface allows Python script to handle general purpose input output faster than through AT commands, skipping the command parser and MOD Print command Python engine SER IIC going directly to control the pins. Serial port 1 Serial port 0 built-in module is the interface between Python core and module internal general purpose input output direct handling. You need to use built-in module if you want to set values from Python script and to read values from Python script. You can control pins also by sending internal 'AT#' commands using the MDM module, but using the module is faster because no command parsing is involved, therefore its use is suggested. Page: 10 Date: January 30th, 2006
Python interfaces MOD GM862-PY MDM SPI MOD IIC The MOD interface is a collection of useful functions. Print command Python engine MOD built-in module is the interface between Python and module miscellaneous functions You need to use MOD built-in module if you want to generate timers in Python script, to reactivate Python from Python script, etc. MOD.secCounter() This method is useful for timers generation in Python script. No input parameter. Return value is a Python integer which is the value of seconds elapsed since 1 January 1970. Example: a = MOD.secCounter() returns seconds elapsed since 1 January 1970. MOD.sleep(sleeptime) Blocks Python script execution for a given time returning the resources to the system. Input parameter timesleep is a Python integer which is the time in 1/10 s to block script execution. No return value. Example: MOD.sleep(15) blocks Python script for 1.5 s Serial port 1 Page: 11 Date: January 30th, 2006 SER Serial port 0 MOD.reactivatePython() Reactivates Python script after exiting from actual Python script. This method is useful for Python script restart. The effect of this method is to restart the complete procedure of selecting the Python script to be executed and of executing it. If you want this method to have the expected effect you need to exit actual Python script as soon as possible after calling it (for example braking while or for loops). No input parameter. No return value. Example: MOD.reactivatePython() reactivates Python after next exiting from Python script.
IIC and SPI built-in in module IIC built-in module is an implementation on the Python GM862-PY MOD MDM SPI IIC core of the IIC bus Master (No Multi-Master) Python engine You need to use IIC built-in module if you want to Print command create one or more IIC bus on the available pins. SER Serial port 1 Serial port 0 This IIC bus handling module is mapped on creation on two pins that will become the Serial Data and Serial Clock pins of the bus. It can be multi-instantiated (you can create more than one IIC bus over different pins) and the pins used must not be used for other purposes. Note that Python core does not verify if the pins are already used for other purposes (SPI module or module) by other functions, it's the applicator responsibility to ensure that no conflict over pins occurs. Page: 12 Date: January 30th, 2006
IIC and SPI built-in in module SPI built-in module is an implementation on the Python GM862-PY MOD MDM SPI IIC core of the SPI bus Master Python engine You need to use SPI built-in module if you want to create one or more SPI bus on the available pins Print command Serial port 1 SER Serial port 0 This SPI bus handling module is mapped on creation on three or more pins that will become the Serial Data In/Out and Serial Clock pins of the bus, plus a number of optional chip select pins up to 8. It can be multi-instantiated (you can create more than one SPI bus over different pins) and the pins used must not be used for other purposes. Note that Python core does not verify if the pins are already used for other purposes (IIC module or module) by other functions, it's the applicator responsibility to ensure that no conflict over pins occurs Page: 13 Date: January 30th, 2006
Executing a Python script The steps required to have a script running by the python engine of the module are: WRITE the Python script DOWNLOAD the Python Script into the module NVM ENABLE the Python script EXECUTE IT Page: 14 Date: January 30th, 2006
Debug Python script The debug of the active Python script can be done both on the emulated environment of the Telit Python Package or directly on the target with the second serial port pin EMMI TX (actually not a translated RS232 serial port as the RXD pin). Page: 15 Date: January 30th, 2006
Debug Python script Page: 16 Date: January 30th, 2006
Page: 17 Date: January 30th, 2006
The Python code implemented into the module is copyrighted by Stichting Mathematisch Centrum, this is the license: Copyright 1991-1995 1995 by Stichting Mathematisch Centrum, Amsterdam, The Netherlands. All Rights Reserved Permission to use, copy, modify, and distribute this software and d its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear r in supporting documentation, and that the names of Stichting Mathematisch Centrum or CWI or Corporation for National Research Initiatives or CNRI not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. While CWI is the initial source for this software, a modified version is made available by the Corporation for National Research Initiatives (CNRI) at the Internet address ftp://ftp.python.org ftp.python.org. STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Page: 18 Date: January 30th, 2006