Getting no response from SIM900 shield

I am using my serial loop sketch, that I normally use with my HC-05 modules.

I am simply using the setup function to invoke a response from the sim900, i.e. by sending it an “AT” command.

But I am getting nothing. Why? Any suggestions?

In the 2 x 5 header on the shield below I have the tx pin connected to Mega digital 22 and the rx pin connected to mega digital pin 23

I also tried the non-suli GPRS_SIM900 library and similarly get no response from the SIM900.

So I have no idea what the GSMSHIELD library was doing which was telling me it was responding. If so then why can’t my serial loop sketch invoke a response to “AT”?

I think I wasted a lot of time modifying GSMSHIELD library - it would appear that this library is unusable.

#include <EEPROM.h>
#include <SoftwareSerial.h>
#include <EEPROM.h>

//#define serialHC05 Serial1
SoftwareSerial serialHC05(22, 23);  // RX, TX

char cChar = 0;

void sendATCommand(const char *pchCommand)
{
    uint32_t nStartMillis = millis();
    String strResp;
    char cCh = 0;
    
    serialHC05.write(pchCommand);
    serialHC05.write("\r\n");
    Serial.print(String(pchCommand) + "...");

    while (!serialHC05.available())
    {
        if ((millis() - nStartMillis) > 4000)
        {
          Serial.println("no response!");
          break;
        }
    }
    delay(100);
    while (serialHC05.available())
    {
        cCh = serialHC05.read();
        strResp += String(cCh);
    }
    if (strResp.length() > 0)
      Serial.println(strResp.c_str());
}

void ClearEEPROM()
{
    for (int nI = 0; nI < EEPROM.length(); nI++)
        EEPROM.write(nI, 0);
}

void ReadEEPROMVal()
{
      char cChar = 0;
      int nI = 0;
      String strVal;
      
      do
      {
          cChar = EEPROM.read(nI++);
          strVal += String(cChar);
      }
      while ((cChar > 0) && (nI < EEPROM.length()));
      Serial.println("##############################");
      Serial.println(strVal);
      Serial.println("##############################");
}

void SetEEPROMVal()
{
    String strVal;

    ClearEEPROM();

    while (Serial.available())
    {
      strVal += (char)Serial.read();
    }
    for (int nI = 0; nI < strVal.length(); nI++)
       EEPROM.write(nI, strVal[nI]);
    ReadEEPROMVal();
}

void SetHC05()
{
    sendATCommand("AT+ORGL");
    delay(100);
    sendATCommand("AT+ROLE=0");
    delay(100);
    sendATCommand("AT+POLAR=1,0");
    delay(100);
    sendATCommand("AT+UART=115200,1,0");
    //sendATCommand("AT+UART=38400,1,0");
    //sendATCommand("AT+UART=19200,1,0");
    //sendATCommand("AT+UART=9600,1,0");
    delay(100);
    sendATCommand("AT+NAME=IRRIGATION");
    delay(100);
    sendATCommand("AT+INIT");
    delay(100);
}

void setup() 
{
  Serial.begin(115200);   

  // AT+ORGL     
  // AT+ROLE=0
  // AT+POLAR=1,0  
  // AT+UART=9600,0,0  
  // AT+NAME=POV_CLOCK_1  
  // AT+INIT  
  
  // 300, 600, 1200, 2400, 4800, *9600*, 14400, *19200*, 28800, *38400*, *57600*, or *115200*
  serialHC05.begin(300);
  sendATCommand("AT");
  serialHC05.begin(600);
  sendATCommand("AT");
  serialHC05.begin(1200);
  sendATCommand("AT");
  serialHC05.begin(2400);
  sendATCommand("AT");
  serialHC05.begin(4800);
  sendATCommand("AT");
  serialHC05.begin(9600);
  sendATCommand("AT");
  serialHC05.begin(14400);
  sendATCommand("AT");
  serialHC05.begin(19200);
  sendATCommand("AT");
  serialHC05.begin(28800);
  sendATCommand("AT");
  serialHC05.begin(38400);
  sendATCommand("AT");
  serialHC05.begin(57600);
  sendATCommand("AT");
  serialHC05.begin(115200);
  sendATCommand("AT");
}

void loop() 
{
}