SIM900 AT Commands failing

Ive got this sim900 module and Im able to send sms and make calls from it, using the marcomartines github sim900 library.

But when I try to communicate via AT commands directly I run into problems. When I try to send an sms using:

AT+CMGF=1
AT+CMGS="+504mynumber"

I do get the > prompt. I enter some text like:

hello there and immeditately I get nothing. If I send 26 or 1A, I get nothing back. If I send 0x1A I somtimes get the > prompt to disappear but not everytime.

So I tried some more basic commands and here are some results:

����ATD+504mynumber

NO CARRIER
����ATD+mynumber

NO CARRIER
����AT+CPIN?
����AT+CSQ

+CSQ: 0,0

OK
����AT+COPS?

+COPS: 0

OK
����AT+CGMI

SIMCOM_Ltd

OK
��������AT+CGMM

SIMCOM_SIM900

OK
����AT+CGSN

013955673954320

OK
AT+CNUM

ERROR
����AT+ATE1

ERROR
��������AT+ATE1

ERROR
AT+ATE0

ERROR

Any ideas what I could do?

PD 1: my sim is in the module 2: I can make calls and send sms when sim is in phone 3: I just noticed each time I put the sim back in the phone and try to send an sms, the phone notifies me that is is requesting a network configuration and if I don't click on Accept, the sms I was sending is not received. The instant I click on accept, the sms is received on my target phone.

So I'm wondering if I'm missing a command before being able to send the sms from the module?

Marciokoko: the marcomartines github sim900 library.

You should post a link to the library so we don't have to search for it. Make the link clickable to make it even easier. You will have the best chance of getting a solution if you help us help you.

Marciokoko: when I try to communicate via AT commands directly I run into problems.

You should explain how you're doing this. Are you using a sketch running on your Arduino? If so then post the sketch. If you have the SIM900 connected directly to your computer and are using the Arduino IDE's Serial Monitor, etc. then state that.

Marciokoko: Any ideas what I could do?

Look at the source code of the library and compare what it does to what you're doing when you send the AT commands directly.

Thanks

I didn’t post a link to the github library because I’m not using it. I’m trying to use the at commands directly. But here is the library: GSM-GPRS-GPS-Shield/ at GSMSHIELD · MarcoMartines/GSM-GPRS-GPS-Shield · GitHub

I’m doing all this because I’m trying to send an sms from a Nano to my mobile phone. Ia using the following sketch:

#include <SoftwareSerial.h>

SoftwareSerial mySerial(9,10);
void setup(){
  mySerial.begin(19200);
  Serial.begin(19200);
}
void loop() {
  if (mySerial.available())
    Serial.write(mySerial.read());
  if (Serial.available())
    mySerial.write(Serial.read());
}
[\code]

The module is connected to the Arduino via RX/TX pins to 9/10.

I've checked the library's Sim900.cpp and GSM.cpp and it seems most commands are the same as the ones I'm using.

MORE RESULTS:

GMR Revision:1137B05SIM900M64_ST_ENHANCE

CREG ALWAYS GIVES ME 0,4

+CGACT: 3,0

So the issue seems to be it is not registering on my network. But if I take the sim and put it on my other phone, it registers just fine.

Could it be these lines on GSM.cpp:

               // generate turn on pulse
               digitalWrite(GSM_ON, HIGH);
               delay(1200);
               digitalWrite(GSM_ON, LOW);
               delay(10000);
               WaitResp(1000, 1000);

Im thinking this one because it sends some pulse to the sim900 chip and ive read its needed to 'activate' it.

or

if(turnedON) {
          WaitResp(50, 50);
          InitParam(PARAM_SET_0);
          InitParam(PARAM_SET_1);//configure the module
          Echo(0);               //enable AT echo
          setStatus(READY);
          return(1);

     } else { ... }

Im thinking that in that InitParam method makes 2 command calls as below:

[code]
PARAM_0
SetCommLineStatus(CLS_ATCMD);
          // Reset to the factory settings
          SendATCmdWaitResp(F("AT&F"), 1000, 50, str_ok, 5);
          // switch off echo
          SendATCmdWaitResp(F("ATE0"), 500, 50, str_ok, 5);

and

          SetCommLineStatus(CLS_ATCMD);
          // Request calling line identification
          SendATCmdWaitResp(F("AT+CLIP=1"), 500, 50, str_ok, 5);
          // Mobile Equipment Error Code
          SendATCmdWaitResp(F("AT+CMEE=0"), 500, 50, str_ok, 5);

Im thinking this reset and echo off might be required or the CLIP/CMEE calls might be necessary.