GSM Modem300 message read problems

Status
Not open for further replies.

rebornac3

Newbie level 1
Joined
Jan 14, 2014
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
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...
 

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...
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…