GSM modem error

Hello,

i am using FEZ COBRA board with 7" LCD hardware

i am getting error in GSM modem communication, i am getting junk values when i read from modem with the help of command "AT+CMGR=1"
it can not read sms from sim card when i attempt first time, after that i am getting proper response of this command

my code is as follows

 
             
String Cmd = "AT+CMGR=1\r\n";                     
Thread.Sleep(1500);
byte[] Buffer = Encoding.UTF8.GetBytes(sendprotocol);
this.serialport.Write(Buffer, 0, Buffer.Length);
int readcount = this.serialport.BytesToRead;
if (readcount <= 0)
{
   return "";
}
byte[] rx_byte = new byte[readcount];
rx_byte = new byte[readcount];                    
readcount = serialport.Read(rx_byte, 0, readcount);
string TempRecData = "";
char[] rechar = new char[readcount];
for (int i = 0; i < rx_byte.Length; i++)
{
     Char schar = Convert.ToChar(Convert.ToUInt16(rx_byte[i].ToString()));
     rechar[i] = schar;
     TempRecData = TempRecData + schar;
}                   
                
string RecData = "";
RecData = new string(rechar);
                  

i m doing pin high/low and modem on off at every reading

anyone can give solution ?
code was working before continously from so long

@ andre.marschalek -

i have checked baudrate and other settings as you said, but those are perfect
and code was working properly, till now

it suddenly giving this kind of error (junk values)

i have checked with simple “AT” command still its receiving junk values

is it code issue ? or hardware issue ?

if this is a new issue that causes some problem on only one command, then I would say it’s hardware. If this issue is only just coming to light because you’re changing the software, then I would be less sure. Perhaps check any connections between the device and the modem, including the usb header (assuming its a usb modem)

two other questions. You say in your first post that you’re “doing pin high/low” what exactly do you mean by this? Where in your code do you actually send the Cmd string? I can’t see any sign of it in the snippet you include.

and my final thought: could it be power related? Have you added the 7" display recently, or something else that is consuming more power?