interface with GSM module help pls..

Status
Not open for further replies.

pawan kumar

Member level 4
Joined
Jan 31, 2012
Messages
73
Helped
5
Reputation
10
Reaction score
5
Trophy points
1,298
Location
Chennai
Activity points
1,894
I am trying to interface LPC2148 with a GSM module. it works with the PC but doesnt work with the controller.

on direct pc interface,

I type AT and press enter,

the PC-hyperterm shows

AT
OK

I have connected UART0 to PC and UART1 to GSMmodem. I ve written a code such that whatever is sent by the GSMmodem is displayed on the PC.

I send characters one by one : first A then T then 0x0D ( hex value for enter key)

what I see in hyperterm is:

AT

it does not send OK. I have added the code. please help me .

Code:
#include<lpc214x.h>
void init()				//initializes  both UARTS @9600,8bit, no pairity,1 stopbit
{
U0LCR=0x83;
U0DLL=0x61;
U0DLM=0x00;
U0LCR=0x03;
U1LCR=0x83;
U1DLL=0x61;
U1DLM=0x00;
U1LCR=0x03;
}
void senduart0(unsigned char a)		  //sends a byte through UART0
{
U0THR=a;
while(U0LSR!=0x60);
}

void senduart1(unsigned char a)		  //sends a byte through UART0
{
U1THR=a;
while(U1LSR!=0x60);
}


unsigned char recuart1()			 //recieves a byte from UART1
{
unsigned char p;
while ((U1LSR&0x01)!=1);
p=U1RBR;
return p;
}

 
 int main()
{
PINSEL0=0x00050005;
PINSEL1 = 0x00000000;
PINSEL2 = 0x00000000;
init();
senduart1('A');
senduart1('T');
senduart1(0x0D);
senduart0(recuart1());
senduart0(recuart1());
senduart0(recuart1());
senduart0(recuart1());
senduart0(recuart1());
}


Thank you,

Pawan

---------- Post added at 12:18 ---------- Previous post was at 11:29 ----------

I ve also tried sending 0x0A after 0x0D. even then, it does not work.

---------- Post added at 14:14 ---------- Previous post was at 12:18 ----------

I am using TXD,RXD and ground alone. I can say the connection is proper because I can receive AT which is sent by the controller .
 

Hi Pawan kumar
My name is Arun and am writing this message from UK. Actually am from Kerala and studying in UK .My problem is that i choose the project accident alert and vehicle tracking as my final year project.I have some issues in sending SMS. Rest of the code is working fine.The GPS is collecting data. LCD and the accelarometer part are working fine.
My connections are as follows.
1.every port is set as same as u mentioned in ur project
2.My GSM have a RS-232 interface and my development board have a RS-232 interface.i had made a communication between two RS-232 interfaces like-TX to RX and RX to TX.
3.i have changed the phone number in the code and in my phone number i need to put one extra number zero in front of the Rec mobile number. example 07402002242.When comparing to the Indian mobile number their is an extra number.it is necessary to put 0 in the beginning to make text or cal.
4.Should i make any changes in the code or their is any mistake in the code with 11 dig mobile number?
5.can u please explain these line
extern unsigned char msg[]="*\0"; //secret code

what is secret code?????

hope you will help me.
 

Hi Arun,

I had used that while trying to receive specific messages.

For Instance, I need only those messages which start with a *.

That is'nt an AT command.

and the best way to test your GSM module is to directly connect the module to your PC and use ATD or send a message.

Use the number format which works on interfacing with the PC.

Hope this helps.

Best Regards,

Pawan
 
Hi M2M
i appreciate your reply and i found lots of information regarding M2M communication ,at command interface etc.

Thanks again
Arun
 

help me writing program for microcontroller and interfacing with gps and gsm
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…