User manual
19
Several other functions are available to send the Telit Cellular module response and the GPS
NMEA messages over USB. These functions are XE910_SendUART2USB() and
GPS_SendUART2USB() .
The state machine is maintained using the function APP_Tasks_USB(). Please refer to it for
more details on the implementation.
5.2 USART Driver for XE910 Telit Cellular module:
The PIC microcontroller uses UART1 with flow control to send data to and receive data from
the XE910 module. The Pin defined as XE910_Switch is used to provide or disconnect voltage
from the XE910 power pads. To provide power, this pin should be set to logic 1 using the
following function:
PLIB_PORTS_PinSet(XE910_Switch)
To disconnect power, the pin should be cleared using the following function:
PLIB_PORTS_PinClear(XE910_Switch);
After applying power to the module, the pin XE910_ON_OFF should be tied high
(PLIB_PORTS_PinSet(XE910_ON_OFF)) for at least 5 seconds to power up the module as shown in the
state machine for the XE910. Pin PWRMON goes high when the module is on.
The state machine sets an event handler to handle transmission or reception completion
events .
DRV_USART_BufferEventHandlerSet(appData.drvXE910UsartHandle,APP_BufferEventHandlerXE910Usart,(uintptr_t)
1);
Data and commands can be sent to the Telit module using function:
DRV_USART_BufferAddWrite()
Data is received from Telit XE910 module using the following function:
P_Message=DRV_USART_Read(appData.drvXE910UsartHandle,(uint8_t*)&appData.drvXE910UsartRxBuffer[appData.XE910_Buffer
_Index],100);
Where p_Message is the number of bytes that were read.
The remaining code in the state machine is an example on how to configure the module by
sending different AT commands and checking their response. These commands also contain
commands that get the IMEI of the module, set the APN, set the IP and Port of the server.
The state machine has a complete code that shows how to setup a connection to the internet
and connect to a server over TCP socket using AT commands. It configures the module by
sending a list of AT commands in sequence and checking the response of the module. The
response of the module is forwarded to USB for the user to check the current state.
Each operator has a different APN, username, and password used to connect to the internet. If
you are not using Telit’s SIM card, then you need to change these parameters in code where
the following two AT commands are used:
AT+CGDCONT= 1,"IP","YOUR_NEW_APN","0.0.0.0",0,0
AT#SGACT=1,1,"YOUR_NEW_USERNAME","YOUR_NEW_PASSWORD"
The state machine is maintained using the function APP_Tasks_XE910(). Please refer to it for
more details on the implementation.