Specifications

7.4. SOFTWARE DESIGN
of approximately 50 possible states.
Initialisation
Ordinarily, the GSM state is “powered down”. Any software component may
invoke the GSM unit by changing this state to “powering up”. At this point,
the GSM FSM pulls the hardware power line high and continually sends the
module a software reset command (“ATZ”) while waiting for a response. If
no response is received w ithin four seconds, then the power down sequence
is begun. If, however, the unit is correctly functioning, an “OK” response is
received and device initialisation follows. Extended error reporting is enabled
to aid troubleshooting and the status is displayed on the LCD screen on line
two. The reporting mode is also changed from the default “verbose” to
“numeric” w hich results in less processing overhead.
If the module accepts the SIM PIN number (as restored from the EEPROM
backup), responds to all initialisation commands with an “OK” and connects
successfully to either the home network or another network with which the
operator has an agreement, then the state changes to “GSM idling”. At this
point the application which started the GSM module may request an SMS
check, initiate GPRS attach procedure or shut down.
GPRS Attach
The GM862 features an on-board TCP/IP stack. If the software requests
a GPRS attach, then the module attempts to attach to the GPRS APN as
specified by the user in the EEPROM setting and obtain an IP address. If
this was successful, the obtained IP address is reported to the user via the
LCD display and the GSM state changes to “GSM idling, GPRS attached”.
Once in this state, the host application may initiate an email send. If the
attach was not successful, the FSM will retry the connection. The requesting
application may set the number of retries by pre-setting the global variable
“retry
counter” with the maximum number of permitted retries. With every
retry, this counter is decremented until it reaches zero at which point the
GSM FSM cancels the request. A time-out is also implemented to ensure
that the module does not wait indefinitely for a successful attach.
82