ARM HOW-TO GUIDE Interfacing GSM With LPC2148 ARM

4m ago
469.19 KB
15 Pages

ARM HOW-TO GUIDEInterfacing GSM withLPC2148 ARM

Contents at a GlanceARM7 LPC2148 Primer Board .3GSM (Global System for Mobile Communication) .3Interfacing GSM .4Interfacing GSM with LPC2148 .6Pin Assignment with LPC2148 .6Circuit Diagram to Interface GSM with LPC2148 .7Source Code .7C Program to send a message from LPC2148 .8Testing the GSM with LPC2148. 11General Information . 13Join the Technical Community Today!

ARM7 LPC2148 Primer BoardThe ARM7 LPC2148 Primer board is specificallydesigned to help students to master the required skills inthe area of embedded systems. The kit is designed in suchway that all the possible features of the microcontroller willbe easily used by the students. The kit supports in systemprogramming (ISP) which is done through serial port.NXP’s ARM7 (LPC2148), ARM Primer Kit is proposed tosmooth the progress of developing and debugging ofvarious designs encompassing of High speed 32-bitMicrocontrollers.GSM (Global System for Mobile Communication)GSM is a digital mobile telephony system. GSM digitizesand compresses data, then sends it down a channel withtwo other streams of user data, each in its own time slot. Itoperates at either the 900 MHz or 1800 MHz frequencyband.Join the Technical Community Today!

Interfacing GSMFig. 1 shows how to interface the GSM withmicrocontroller. The GSM module is communicate themicrocontroller with mobile phones through UART. Tocommunicate over UART or USART, we just need three basicsignals which are namely, RXD (receive), TXD (transmit),GND (common ground).GSM modem interfacing with microcontroller for SMScontrol of industrial equipments. The sending SMS throughGSM modem when interfaced with microcontroller or PC ismuch simpler as compared with sending SMS throughUART.Text message may be sent through the modem byinterfacing only three signals of the serial interface ofmodem with microcontroller i.e., TxD, RxD and GND. In thisscheme RTS and CTS signals of serial port interface of GSMModem are connected with each other.Join the Technical Community Today!

The transmit signal of serial port of microcontroller isconnected with transmit signal (TxD) of the serial interfaceof GSM Modem while receive signal of microcontrollerserial port is connected with receive signal (RxD) of serialinterface of GSM Modem.The SMS message in text mode can contain only 140characters at the most. It depends upon the amount ofinformation collected from GPS Engine that you need at thebase station for tracking vehicle or person.Fig. 1 Interfacing UART to MicrocontrollerJoin the Technical Community Today!

Interfacing GSM with LPC2148We now want to display a text in mobile from LPC2148Primer Board by using GSM module through UART. InLPC2148 Primer Board contains two serial interfaces thatare UART0 & UART1. Here we are using UART0. The GSMmodem is being interfaced with the microcontrollerLPC2148 Primer Board for SMS communication. The SMScan be sending and receiving for the data sharing andsituation information and control.ISP PGMUART0(P1)Pin Assignment with LPC2148UART DB-9ConnectorLPC2148Processor LinesTXD-0P0.0RXD-0P0.1TXD-1P0.8Serial Port Section(P2)UART1ARM7MAX3232RXD-1P0.9Join the Technical Community Today!

Circuit Diagram to Interface GSM with LPC21483.3V TR1OUTR2OUTR2INC1 T1OUTR1INC1-MAX3232/DIPC2 C2-VV 7TX1 OUT8RX1 IN14TX0 OUT13RX0 CVSS1VSS2VSS3VSS4VSS5VSSAU6DB9-MALE zC58X2422pfC5922pfSource CodeThe Interfacing GSM module with LPC2148 program isvery simple and straight forward, which send a message tomobiles from LPC2148 Primer Board through GSM moduleby using UART0. Some delay is occurring when a single datais sent to mobile through UART. C programs are written inKeil software. The baud rate of microcontroller is 9600.Join the Technical Community Today!

C Program to send a message from ********************************************Title : Program to send a message from LPC2148 to mobile through ****************************************#define CR0x0D#include LPC21xx.H #include stdio.h void getstring(unsigned char *);int getchar (void) /* Read character from Serial Port */void status ok(void);void Serial Init(void);void delay(unsigned int n);void main(void){unsigned int cnt 0x80,m;char xx;Serial Init();delay(50);while(1){printf("AT\r"); // AT COMMAND FOR INITIALINGstatus ok();printf("AT IPR 9600\r"); // AT COMMAND FOR BAUD RATEstatus ok();printf("AT CMGR 2\r"); // Reading the message detail// at Index 1 with phone number, data and timestatus ok();delay(250);printf("ATD9790550124;\r");//AT COMMAND FOR CALL DIALINGdelay(250);Join the Technical Community Today!

status elay(500);delay(500);printf("ATH\r"); // AT COMMAND FOR CALL DISCONNECTINGdelay(250);status ok();delay(500);delay(500);printf("ATDL\r"); // AT COMMAND FOR REDIALINGdelay(250);status ok();delay(500);delay(500);printf("ATH\r"); // AT COMMAND FOR ANSWERING THE CALLdelay(250);status ok();delay(500);delay(500);}}void getstring(unsigned char *array){unsigned char temp 0, i 0;do{temp getchar();*array temp;}while((temp ! '\r') && (temp ! '\n'));*array '\0';}Join the Technical Community Today!

int getchar (void){/* Read character from Serial Port */while (!(U0LSR & 0x01));return (U0RBR);}void status ok(void){getstring(y);while(!(strstr(y,"OK"))) getstring(y);pointr strstr(y,"OK");lcd cmd(0xc0);lcd data(*pointr );lcd data(*pointr);delay(500);lcd cmd(0x01);}void Serial Init(void){PINSEL0 0X00000005;U0LCR 0x00000083;U0DLL 0x00000061;U0LCR 0x00000003;}//Enable Txd0 and Rxd0//8-bit data, no parity, 1-stop bit//for Baud rate 9600,DLL 82//DLAB 0;void delay(unsigned int n){unsigned int i,j;for(i 0;i n;i ){for(j 0;j 12000;j ){;}}}Join the Technical Community Today!

To compile the above C code you need the KEILsoftware. They must be properly set up and a project withcorrect settings must be created in order to compile thecode. To compile the above code, the C file must be addedto the project.In Keil, you want to develop or debug the projectwithout any hardware setup. You must compile the code forgenerating HEX file. In debugging Mode, you want to checkthe port output without LPC2148 Primer Board.The Flash Magic software is used to download the hexfile into your microcontroller IC LPC2148 through UART0.Testing the GSM with LPC2148Give 3.3V power supply to LPC2148 Primer Board;connect the 5V adapter with GSM module which isconnected with LPC2148 Primer Board through UART0.Open the Hyper Terminal screen, select which port you areusing and set the default settings. Now the screen shouldshow some text messages.Join the Technical Community Today!

The following Commands and sequence of eventsperformed for sending text message to a mobile phonethrough GSM Modem interfaced with microcontroller:1. First select the text mode for SMS by sending thefollowing AT Command to GSM Modem : AT CMGF 1 .This command configures the GSM modem in text mode.2. Send the following AT Command for sending SMSmessage in text mode along with mobile number to theGSM Modem : AT CMGS 923005281046 . This commandsends the mobile number of the recipient mobile to theGSM modem.3. Send the text message string ("hello!") to the GSMModem This is a test message from UART".4. Send ASCII code for CTRL Z i.e., 0x1A to GSM Modem totransmit the message to mobile phone. After messagestring has been sent to the modem, send CTRL Z to themicro-controller, which is equivalent to 0x1A (ASCII value).Join the Technical Community Today!

If you not reading any text from UART0, then you justcheck the jumper connections & just check the serial cableis working. Otherwise you just check the code withdebugging mode in Keil. If you want to see more detailsabout debugging just see the videos in below link. How to Create & Debug a Project in Keil.General InformationFor proper working use the components of exact valuesas shown in Circuit file. Wherever possible use newcomponents.Solder everything in a clean way. A major problemarises due to improper soldering, solder jumps andloose joints.Use the exact value crystal shown in schematic.More instructions are available in following articles, User Manual of LPC2148 Primer Board. Tutorial of how to create & Debug a project in KEIL.Join the Technical Community Today!

Did you enjoy the read?Pantech solutions creates information packed technicaldocuments like this one every month. And our website is a richand trusted resource used by a vibrant online community ofmore than 1,00,000 members from organization of all shapesand sizes.Join the Technical Community Today!

What do we sell?Our products range from Various Microcontrollerdevelopment boards, DSP Boards, FPGA/CPLD boards,Communication Kits, Power electronics, Basic electronics,Robotics, Sensors, Electronic components and much more . Ourgoal is to make finding the parts and information you needeasier and affordable so you can create awesome projects andtraining from Basic to Cutting edge technology.Join the Technical Community Today!