Microcontroller › 8051 › Almost there, need Assistance ! MCU to Hyper Terminal OK. GSM Modem to Hyper Terminal OK. GSM TO MCU = Garbage
- This topic has 11 replies, 5 voices, and was last updated 10 years, 4 months ago by
Pradeep Kumar.
-
AuthorPosts
-
May 30, 2012 at 11:10 am #1823
Chen Jun Jie
ParticipantHello everyone,
I’m about to solve my problem.
MCU to Hyper Terminal, sends ABC, receives ABC.
GSM Modem to Hyper Terminal OK.
Able to send sms.
However, Gsm to MCU, i get errors. I pick up garbage data instead.
Baudrate is set to 115200.
I am using the following setup.
GSM MODEM TO Hyper Terminal Setup
RX of GSM -> PIN 5 of MAX233 (T1out)
TX of GSM -> Pin 4 of MAX 233 (R1in)
PC Serial
SerialTX to Pin 2 Max233 (T1in)
SerialRX to Pin 3 Max233 (R1out)
I can send Sms no problem.
MCU to Hyper Terminal
MCU Uart3 TX -> Pin 2 of MAX233
MCU Uart3 RX -> Pin 3 of MAX233
Serial Pins as per normal
I can send random ABCs, and receive ABCs on my MCU
MCU TO GSM MODEM
MCU
MCU Uart3 TX -> Pin 2 of MAX233
MCU Uart3 RX -> Pin 3 of MAX233
GSM Modem
RX of GSM -> PIN 5 of MAX233 (T1out)
TX of GSM -> Pin 4 of MAX 233 (R1in)
This is my problem, my mcu is currently sending AT+CMGF=1
I should receive OK,
however, i receive this instead
PUi5 35 31u1
AT+CMGFPUi5 35 31u1Please let me know if you can spot the problem.My Code to print out what i have received.if (LPC_UART3->LSR & UART_LSR_RDR) //To modify, perhaps a better way.{do{UART_Receive(LPC_UART3, &data, 1, BLOCKING);//Timer0_Wait(500);if (data != ‘r’){len++;line[len-1] = data;}} while ((len<64) && (data != ‘r’));}line[len]=0;printf(“%sn”, line);May 30, 2012 at 11:19 am #7933nikhiljain
ParticipantHello,
Please check the GSM interfacing projects and tutorial on this website and your problem will be solved. Pls note the GSM modem also sends some additional characters with the data like “OK”. They are some special characters like line feed, carriage return etc and hence there is garbage data.
There is a standard pattern of sending and reciveing data to the modem. When you recieve the data you need to remove/filter/reject/some of the bytes to discard the unwanted data and capture only the data you want. Similar is the case while sending the data to the modem. In sending you have to add the charchters.
Please go through the GSM based work on the website in the 8051 section.
May 30, 2012 at 11:28 am #7934Chen Jun Jie
ParticipantThank you Nik for the reply.
Believe me, i have read literally the entire internet resource on this topic.
But the problem that i am facing is really driving me crazy.
I see no issues to communicate from GSM modem to Hyper Terminal, or Hyper Terminal To MCU.
My code should be working.
But MCU to GSM Modem, i am not able to receive the “OK” from it.
Need help.
May 30, 2012 at 12:02 pm #7935nikhiljain
ParticipantHi,
Read the following three article in order:
To me it appears that all you are doing is a logical error in understanding the working of GSM modem.
May 30, 2012 at 12:05 pm #7936nikhiljain
ParticipantHi,
Please search the following three project having project code: MC074, MC075 & MC076 in the 8051 section of this website under EG labs. You are misunderstanding the logic behind recieving and sending text to GSM modem.
May 30, 2012 at 12:30 pm #7937Chen Jun Jie
ParticipantDear Nikh,
I have seen the 3 projects and in detail.
MAX 232
tx Micro Controller to t1in of max232 pin11
rx MICRO Controller r1out of max232 pin 12
rx modem t1out of max232 pin 14
tx modem r1in of max232 pin13
Now max 233
Micro controller tx to T1in max233 = pin 2
Micro controller rx to R1out max233 = pin 3
Rx of modem to T1out max 233 = pin5
Tx of modem to R1in max 233 = pin 4
I used a slightly different ttl logic regulator.
This is the only thing, i can think of, that is different from the 3 projects.
Can you be alittle clearer if you know where is the problem ?
Much thanks
May 30, 2012 at 4:08 pm #7938Chen Jun Jie
ParticipantI have solved the issue
However, i am not sure how do you send Control Z from C code, any help guys ?
strcpy(msg,”CAN YOU SEE ? SENT FROM MCU”);UART_Send(LPC_UART3, (uint8_t *)msg , strlen(msg), BLOCKING); //strlen :Length of Transmit buffer Checking Blocking.strcpy(msg, 0x1A);UART_Send(LPC_UART3, (uint8_t *)msg , strlen(msg), BLOCKING);Should i do +char(26) ?
May 30, 2012 at 5:25 pm #7942AJISH ALFRED
ParticipantHi Chen,
You are right, the ascii value for ctrl+z is 26, but there is a problem,
This is the syntax for strcpy
char * strcpy ( char * destination, const char * source );
The arguments are pointers to memory location. If you give an integer value it will point to that location.
Try to do it without strcpy.
June 14, 2012 at 10:12 am #8037midhun
ParticipantYou can send the hex value of CTRL+Z ie, 0x1A
Try this. you will…
June 15, 2012 at 2:51 am #8048Chen Jun Jie
ParticipantThank you everyone for the support. I have since completed the entire project.
Working properly on an ARM processor
November 15, 2012 at 1:12 pm #8751Pradeep Kumar
ParticipantHi chen,
I am facing the same problem. I receive PU8 when i transmit “AT” and PUi5 when i transmit “AT+CMGF=1”. How did you solve this issue.
November 17, 2012 at 4:51 am #8754Pradeep Kumar
ParticipantI got it!!!
I made a mistake in circuit connection. TXin RXout pins from RS232 to gsm modem were interchanged…
Now working fine -
AuthorPosts
- You must be logged in to reply to this topic.