Jan 14, 2014 #1 R rebornac3 Newbie level 1 Joined Jan 14, 2014 Messages 1 Helped 0 Reputation 0 Reaction score 0 Trophy points 1 Activity points 11 Hi, I'm unable to get a proper response from my GSM modem300, sometimes it responds with nothing, sometimes it replies half of line of ONE message from full inbox, sometimes it just sends the command (AT+CMGR=1) I just sent, back many times. Print screens: sends my command back: https://imgur.com/Lyv8oui responds with nothing: https://imgur.com/jHQOSxM responds with half line of one message from FULL inbox!: https://imgur.com/zsmDcIc responds with garbage: https://imgur.com/vTVSwyf I'm using Arduino, directly connecting the Tx and Rx of board to Rx and Tx of arduino, and GND to arduino GND. CODE: Code: char incomingByte=0; [COLOR="#00FF00"]void setup[/COLOR]() { Serial.begin(9600); delay(2000); Serial.println("AT+CMGF=1"); delay(2000); Serial.println("AT+CMGR=1"); delay(2000); } [COLOR="#0000FF"]void loop[/COLOR]() { while (Serial.available() > 0) { incomingByte = Serial.read(); if(incomingByte!='\n'){ Serial.print(incomingByte); } if(incomingByte=='\n') { Serial.print(incomingByte); } } } It might be worth mentioning that, I can send messages properly, and make and receive calls with no problem...
Hi, I'm unable to get a proper response from my GSM modem300, sometimes it responds with nothing, sometimes it replies half of line of ONE message from full inbox, sometimes it just sends the command (AT+CMGR=1) I just sent, back many times. Print screens: sends my command back: https://imgur.com/Lyv8oui responds with nothing: https://imgur.com/jHQOSxM responds with half line of one message from FULL inbox!: https://imgur.com/zsmDcIc responds with garbage: https://imgur.com/vTVSwyf I'm using Arduino, directly connecting the Tx and Rx of board to Rx and Tx of arduino, and GND to arduino GND. CODE: Code: char incomingByte=0; [COLOR="#00FF00"]void setup[/COLOR]() { Serial.begin(9600); delay(2000); Serial.println("AT+CMGF=1"); delay(2000); Serial.println("AT+CMGR=1"); delay(2000); } [COLOR="#0000FF"]void loop[/COLOR]() { while (Serial.available() > 0) { incomingByte = Serial.read(); if(incomingByte!='\n'){ Serial.print(incomingByte); } if(incomingByte=='\n') { Serial.print(incomingByte); } } } It might be worth mentioning that, I can send messages properly, and make and receive calls with no problem...
Jan 16, 2014 #2 K kgshankar1980 Full Member level 3 Joined Jul 2, 2010 Messages 164 Helped 47 Reputation 94 Reaction score 47 Trophy points 1,308 Activity points 2,236 Dont check for '\n'... Instead check for "OK"... Until you get "OK", just print the received data in the serial... Declare an array of buffer and get the data until you get "OK" and then print the buffer...Max sms characters can be 160 only... Your way of handling might create trouble...As before printing the data you may receive next data...
Dont check for '\n'... Instead check for "OK"... Until you get "OK", just print the received data in the serial... Declare an array of buffer and get the data until you get "OK" and then print the buffer...Max sms characters can be 160 only... Your way of handling might create trouble...As before printing the data you may receive next data...
Feb 3, 2014 #3 V VARDHAMAN_ELCTRONICS Newbie level 3 Joined Sep 23, 2013 Messages 3 Helped 0 Reputation 0 Reaction score 0 Trophy points 1 Location Vadodara, Gujarat, India, India Activity points 8 you must have to send <cr><lr> before and after any command .Please Refer Datasheet of Modem You got Idea what I am say......
you must have to send <cr><lr> before and after any command .Please Refer Datasheet of Modem You got Idea what I am say......