Serial.read() and Serial.available() not working with SIM900A GSM module

Hello friends.
I am using a SIM900A along with Arduion UNO board. I have to send messages and read the received messages. The GSM module is working fine. The problem is, I am not able to read any serial output from the GSM module through my arduino UNO. But using putty it just works fine.
The connections which I have given are TX,RX and GND.
This is my code

char msg;
char inData[200];
char inChar;
int a;
void setup() 
{
  Serial.begin(9600);  
  
  for (a=0;a<5;a++)
  {
    Serial.println("AT\r");
    
    if (Serial.available())
        {
          // store everything into "inData"
          int i;
          for (i=0;i<10;i++)
          {
              inChar= Serial.read();
              inData[i] = inChar;
          }
          Serial.print(inData);
         }
  }
  
}

void loop() 
{
  // put your main code here, to run repeatedly:

}

I tried many changes in the code, changed the baud rate, but I am not able to read the serial out response form the GSM module in my arduino serial monitor. I have also gone through many forums and blogs, but nothing is working out.

Please help me with this issue. I have been stuck with this issue for a pretty long time guys.
Thanks in advance.

You seem to be sending data back to the GPS module, do you want to do that? Is the GPS module outputting Rs232 or is it TTL data? If not you need to convert the RS232 data into TTL before you can use it in an Arduino.

You need to supply a diagram of your setup.

the code will do little because the serial data will not be avaliable the first time you ask and then you never ask again.

You don't disclose which SIM900A based device you are using, but the information in my signature link may be of use to you.

Have you the GSM module connected to Pins 0 and 1 and are you trying to send data to the Serial Monitor using the same pins? If so I suspect something is getting confused.

Use a separate serial connection for the GSM module using SoftwareSerial.

The examples in serial input basics are reliable ways to receive data.

...R

Hey friends thanks a lot for all of your response and help, actually, the output form the GSM module was not high enough to be sensed by the arduino. I have fixed it now and everthing is working fine.

And also i am using software serial so that I dont have any problem during uploading

ji_bala94: And also i am using software serial so that I dont have any problem during uploading

Not in that code you posted you wern't.