pawan kumar
Member level 4
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 .
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 .
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 .