SIM7600 does not report call status

I recently upgraded to the SIM7600 after the termination of 2G service supported by the SIM800.

Previously, with the SIM800, the command AT+MORING=1 would cause the device to send certain call stats via the serial connection. I could then use the information to determine the status of a relay at the end of the call.

My initial effort was done with the MEGA 2560. I have switched to the UNO R3 due to its ability doe generate tones, (dial tones and touch tones). With the Mega I had to have separate IC's perform this function.

The UNO only supports one serial port, thus I have not been able to do much diagnostics to see if any information similar to the SIM800 is getting back to the UNO. I have considered the software serial approach but have not had much luck setting it up. I also only have ports 12 & 13 available. All others are used by the current sketch.

In addition to I'm not sure the method used to capture serial data from the Mega is appropriate for the UNO,

Attached is a snippet of the code that makes the call and is suppose to set a flag callGood. If the call is successful. Note the the code worked nicely with the MEGA AND the sim800.

Any help to detect something from the SIM7600 (including but not limited to simplifying the code) that would indicate the call is successful would be greatly appreciated.

t    while (coin==24){  //Prepare to dial number
        digitalWrite(10, LOW); //Change audio source
          if (initCall==0) {
          phonenumber=phonenumber+";";
          phonenumber="ATD"+phonenumber;
          Serial.println(phonenumber);  //Send number to GSM
          receivedChars=="";
          initCall=1;
        }
        delay(1000);
        while (initCall==1){
          static byte ndx = 0;  //Look for successfull connection
          char endMarker = '\n';
            char rc;
            if (digitalRead(telhookpin)==LOW){ //Set Coin to 9999 to exit if phone hungup
              coin=9999;
              initCall=0;
              dialTone(1); //Disable dialtone
              delay(500);
            }
          while (Serial.available() > 0 && newData == false) {
            rc = Serial.read();
            if (rc != endMarker) {
              receivedChars[ndx] = rc;
              ndx++;
              if (ndx >= numChars) {
                ndx = numChars - 1;
              }
            }
            else {
           receivedChars[ndx] = '\0';   // terminate the string
           ndx = 0;
           newData = true;
          }
         }
            if (newData == true) {
              Check == receivedChars;
              Serial.print(Check);
              if (strcmp(receivedChars,"MO CONNECTED\r") == 0) {
                callGood=1;
              }
              if (strcmp(receivedChars,"NO CARRIER\r") == 0) {
                lc=1;
              }
              if (strcmp(receivedChars,"VOICE CALL: BEGIN\r") == 0) {
                callGood=1;
              }
              if (Check.substring(0,15)=="VOICE CALL: END") {
                coin=9999;
              }
              if (Check.substring(0,17)=="VOICE CALL: BEGIN") {
                callGood=1;
              }
              newData = false;
            }
            if (digitalRead(telhookpin)==LOW or lc==1){ //Watch for phone on hook or no carrier
              delay (1000);
              Serial.println("AT+CHUP"); //Send hangup to GSM
              initCall=2;
              coin=9999;
            }
          }
        }
      }
      if (coin==9999){
        Serial.println("AT+CHUP"); 
        countdigit = 0;
        coin=0;
        initCall=0;
        ln=0;
        trigger=0;
        phonenumber="";
        digitalWrite(10, HIGH); //Change to Tones audio
        if (callGood==1){ //Check to see if money is kept
          digitalWrite (R1,LOW);
          delay(2000);
          digitalWrite (R1,HIGH);
        }
      if (callGood==0){
          digitalWrite (R2,LOW);
          delay(2000);
          digitalWrite (R2,HIGH);
      }
      callGood=0;
    }
  }
}ype or paste code here

surprising that the UNO can do it and not the MEGA...


if you mean this

          while (Serial.available() > 0 && newData == false) {
            rc = Serial.read();
            if (rc != endMarker) {
              receivedChars[ndx] = rc;
              ndx++;
              if (ndx >= numChars) {
                ndx = numChars - 1;
              }
            }
            else {
           receivedChars[ndx] = '\0';   // terminate the string
           ndx = 0;
           newData = true;
          }
         }

then sure, it's a blocking way to read what comes on the Serial line until you've emptied the Rx buffer or received the end marker.

depending on how fast the data comes in and when you get there, you might not get the full answer if you emptied the Rx buffer. This is true on the MEGA or the UNO.

J-M-L; Thank you for your response. Yes I was surprised as well that the UNO could do the tones but the Mega would not. I looked at the library to see if perhaps the tones might be on another pin for the Mega but had no luck. I would have been nice if it had worked on the mega.

Yes the code you Highlighted was what I used on the Mega with the SIM800. I was watching specifically for

      if (strcmp(receivedChars,"MO CONNECTED\r") == 0) {
                callGood=1;
              }
      if (strcmp(receivedChars,"NO CARRIER\r") == 0) {
                lc=1;
              }

These reports were activated by the setting AT+MORING=1 and worked well with the SIM800. While the SIM7600 accepts the AT+MORING=1, I suspect it is not sending the above responses during call flow. Thus callGood=1 never happens.
The SIM7600 has a utility that runs on Windows. I get the message VOICE CALL: BEGIN when a call connects in the utility. I have tried to also watch for that message to trigger callGood=1, but with out luck.

Again I appreciate your time and effort to provide feed back,

Can you share a link to that library?

You don’t read the Serial line correctly - I would suggest to study Serial Input Basics to handle this

Thanks again for the assistance and I apologize for the delay in my response.

Below is the link to the synth.h library. I will post my complete sketch at the end of this message.

As a reminder my first project was with the Mega2560 and the SIM800. Tones, such as dial tones and touch tones were generated by IC's:

With the demise of the SIM800 as a result of the termination of 2G in the US. I invested in the SIM7600. I also rebuilt my PCB, eliminating the IC's and used the UNO to generate the tones. I switched to the UNO after determining the library for tones did not work with the Mega2560.

Today the only consideration for using the MEGA2560 would be the advantage of multiple serial ports. The extra ports would be used purely for diagnostic purposes of the current show stopper which is:

The SIM7600 is not sending, "MO CONNECTED" responses that were previously used with the SIM800 to determine a call was successful. If a call was successful, a flag was set to fire a relay to keep the money deposited for a call.

Over the last day, I have used software serial to create a second serial port on the UNO. I was able to monitor the software serial with Putty. I added several check points in the sketch where data was sent to putty (via) the software serial connection. I received positive results to all of these check points. I did not receive any of the expected messages from the SIM7600. Most importantly the "MO CONNECTED". Note, that the command AT+MORING=1 is/was what enabled notifications with the SIM800

It is interesting to note, If I use the Windows utility to make phone calls with the SIM7600, the GUI gives the message "VOICE CALL; BEGIN (time)" when the opposite end picks up the phone. I do not see this message when monitoring the serial traffic (Specifically the content of receivedChars) with putty.

Conclusion: unless I can find a method to determine a call has successfully connected with the SIM7600, I can not determine if a refund of money is due. It makes no difference if I am using the MEGA2560 or the UNO, as the response is expected from the SIM7600.

Thanks again for your help!

#include <Time.h>
#include <synth.h>
#include <Keypad.h>

const byte ROWS = 4; //four rows
const byte COLS = 3; //three columns
const byte rxPin = 2;
const byte txPin = 12;

char keys[ROWS][COLS] = {
  {'1','2','3'},
  {'4','5','6'},
  {'7','8','9'},
  {'*','0','#'}
};
byte rowPins[ROWS] = {6, 7, 8, 9}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {3, 4, 5}; //connect to the column pinouts of the keypad

//Create an object of keypad
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

synth tones;    //-Make a synth

int keypressDelay   = 200;  // delay in mS to hold down a touch tone key
int keyReleaseDelay = 500;  // delay in mS to remain silent after a key has been released

//Global variables-----------------------------------------------------------------------------------------


boolean wasHigh = false;
String phonenumber = "";
String response = "";
String toneNumber = "";

const byte numChars = 32;
char receivedChars[numChars]; // an array to store the received data
boolean newData = false;
 
int countdigit = 0;     // counts the number of digits that have been input
int trigger = 0;        // determined if long distant and to wait for 10 digits if 1 is dialed first.
int telhook = 0;         // current state of the button
int coin = 0;           // counting money
int ln = 0;             //determines if enought digits to dial
int initCall = 0; 
int callGood = 0;        // controls refund relays 3 & 4
int lc = 0;               // lost carrier
const int GSM = 2;         //turn on GSM
const int KeyPadC1 = 3;    // KeyPad 1 4 7 *
const int KeyPadC2 = 4;    // KeyPad 2 5 8 0 
const int KeyPadC3 = 5;    // KeyPad 3 6 9 #
const int KeyPadR1 = 6;    // KeyPad 1 2 3
const int KeyPadR2 = 7;    // KeyPad 4 5 6
const int KeyPadR3 = 8;    // KeyPad 7 8 9
const int KeyPadR4 = 9;    // KeyPad * 0 #
const int Audio = 10;       //Control ear peice source
const int telhookpin = 14; // To detect phone offhook
const int R1 = 15;        //Keep Money Relay
const int R2 = 16;        //Refund Money Relay
const int five = 17;      //Nickle detection pin
const int ten = 18;       //Dime Detection pin
const int twentyfive = 19; //Quarter Detection pin

void setup() {
  // put your setup code here, to run once:

  tones.begin(); //-Start it up
  tones.setupVoice(0, TRIANGLE, 60, ENVELOPE1, 127, 64); //-Set up voice 0
  tones.setupVoice(1, TRIANGLE, 60, ENVELOPE1, 127, 64); //-Set up voice 1
  tones.setupVoice(2, TRIANGLE, 60, ENVELOPE1, 127, 64); //-Set up voice 2
  tones.setupVoice(3, TRIANGLE, 60, ENVELOPE1, 127, 64); //-Set up voice 3

//Setup the INPUT pins on the Arduino
  
  pinMode(telhookpin, INPUT);
  pinMode(KeyPadC1, INPUT);
  pinMode(KeyPadC2, INPUT);
  pinMode(KeyPadC3, INPUT);
  pinMode(KeyPadR1, INPUT);
  pinMode(KeyPadR2, INPUT);
  pinMode(KeyPadR3, INPUT);
  pinMode(KeyPadR4, INPUT);
  pinMode(five, INPUT);
  pinMode(ten, INPUT);
  pinMode(twentyfive, INPUT);
  pinMode(R1, OUTPUT);
  pinMode(R2, OUTPUT);
  pinMode(GSM,OUTPUT);
  pinMode(Audio, OUTPUT);

 
  digitalWrite(R1, HIGH); //Set Money Keep/Return relays
  digitalWrite(R2, HIGH); 
  digitalWrite(Audio, HIGH); // Set audio for Arduino tones
  
  // start serial port
  //digitalWrite(2, LOW); 
  delay (1000); 
  //digitalWrite(2, HIGH); Enable GSM
  Serial.begin(9600);
  delay(10000); //Wait for GSM to come on line
  Serial.println("AT+MORING=1"); //old command suppost to trigger connection reports not working
  } 
  void clearCount() {
  countdigit = 0;
  coin = 0;
  trigger = 0;
  phonenumber = "";
  toneNumber = "";
  }

void loop() {
  while (digitalRead(telhookpin)==HIGH) { // Monitor HookFlash
    dialTone(0); //enable dialtone
    delay(500);
    while (coin<25) { //check if 25 Cents entered to proceed 
      if (digitalRead(five)==HIGH){
        coin=coin+5;
        delay(500);
      }
      if (digitalRead(ten)==HIGH){
        coin=coin+10;
        delay(500);
      }
      if (digitalRead(twentyfive)==HIGH){
        coin=coin+25;
        delay(500);
      }
      if (digitalRead(telhookpin)==LOW){ //Set Coin to 9999 to exit if phone hungup
        coin=9999;
        dialTone(1); //Disable dialtone
        delay(500);
      }
    }
    while (coin>24 and coin<9998){ //Collect Dial Digits
      char key = keypad.getKey();// Read the key
      if (digitalRead(telhookpin)==LOW){ //Set Coin to 9999 to exit if phone hungup
        coin=9999;
        dialTone(1); //Disable dialtone
        delay(500);
      }
      if (key){
        toneNumber=key;
        phonenumber=phonenumber+key;
        countdigit=countdigit+1;
        if (countdigit>0) { //Shut off dialtone when first digit is entered 
          dialTone(1);
        }
        if (toneNumber=="1"){
          oneTone(100);
        }
        if (toneNumber=="2"){
          twoTone(100);
        }
        if (toneNumber=="3"){
          threeTone(100);
        }
        if (toneNumber=="4"){
          fourTone(100);
        }
        if (toneNumber=="5"){
          fiveTone(100);
        }
        if (toneNumber=="6"){
          sixTone(100);
        }
        if (toneNumber=="7"){
          sevenTone(100);
        }
        if (toneNumber=="8"){
          eightTone(100);
        }
        if (toneNumber=="9"){
          nineTone(100);
        }
        if (toneNumber=="0"){
          zeroTone(100);
        }
        if (toneNumber=="*"){
          starTone(100);
        }
        if (toneNumber=="#"){
          poundTone(100);
        }
        if (countdigit==1 and toneNumber==1 and trigger==0){  //Determine how many digits to expect before dial
          trigger=11;
        } else if (trigger==0) {
            trigger=10;
          }
        ln=phonenumber.length();  //Check to see if phone number length has been met
        if (ln==trigger and trigger>0){
          coin=24;
        } 
      }
      while (coin==24){  //Prepare to dial number
        digitalWrite(Audio, LOW); //Change to GSM Audio
        if (initCall==0) {
          phonenumber=phonenumber+";";
          phonenumber="ATD"+phonenumber;
          initCall=1;
          Serial.println(phonenumber);  //Send number to GSM
                    }
          delay(1000);
          while (initCall==1){
            static byte ndx = 0;  //Look for successfull connection
            char endMarker = '\n';
            char rc;
            while (Serial.available() > 0 && newData == false) {
              rc = Serial.read();
              if (rc != endMarker) {
                receivedChars[ndx] = rc;
                ndx++;
                if (ndx >= numChars) {
                ndx = numChars - 1;
                }
              }
              else {
                receivedChars[ndx] = '\0';   // terminate the string
                ndx = 0;
                newData = true;
              }
            }
            if (newData == true) {
              if (strcmp(receivedChars,"NO CARRIER\r") == 0) {
                lc=1;
              }
              if (strcmp(receivedChars,"VOICE CALL: BEGIN\r") == 0) {
                callGood=1;
              }
              if (strcmp(receivedChars,"MO CONNECTED\r") == 0) {
                callGood=1;
              }
              newData = false;
            }
            if (digitalRead(telhookpin)==LOW or lc==1){ //Watch for phone on hook or no carrier
              delay (1000);
              Serial.println("AT+CHUP"); //Send hangup to GSM
              initCall=2;
              coin=9999;
            }
          }
        }
      }
      if (coin==9999){
        Serial.println("AT+CHUP"); //Issue Hangup to SIM7600
        countdigit = 0;
        coin=0;
        initCall=0;
        ln=0;
        trigger=0;
        phonenumber="";
        digitalWrite(Audio, HIGH); //Change to Arduino pin 11 audio
        if (callGood==1){ //keKeep Money
          digitalWrite (R2,LOW);
          delay(2000);
          digitalWrite (R2,HIGH);
        }
      if (callGood==0){ //Refund Money
          digitalWrite (R1,LOW);
          delay(2000);
          digitalWrite (R1,HIGH);
      }
      callGood=0;
    }
  }
}

// if onTime=0 the sound continuously plays until another sound is commanded elsewhere
// if onTime>0 the sound plays for the duration in mS
// dial tone 350Hz + 440Hz
void dialTone(int onTime) {
  tones.setFrequency(0, 440.0);
  tones.setFrequency(1, 350.0);
  tones.trigger(0);
  tones.trigger(1);
  if (onTime > 0) {
    delay(onTime);
    tones.setFrequency(0, 0);
    tones.setFrequency(1, 0);
  }
}
void oneTone(int onTime) {
  tones.setFrequency(0, 1209.0);
  tones.setFrequency(1, 697.0);
  tones.trigger(0);
  tones.trigger(1);
  if (onTime > 0) {
    delay(onTime);
    tones.setFrequency(0, 0);
    tones.setFrequency(1, 0);
  }
}
void twoTone(int onTime) {
  tones.setFrequency(0, 1336.0);
  tones.setFrequency(1, 697.0);
  tones.trigger(0);
  tones.trigger(1);
  if (onTime > 0) {
    delay(onTime);
    tones.setFrequency(0, 0);
    tones.setFrequency(1, 0);
  }
}
void threeTone(int onTime) {
  tones.setFrequency(0, 1477.0);
  tones.setFrequency(1, 697.0);
  tones.trigger(0);
  tones.trigger(1);
  if (onTime > 0) {
    delay(onTime);
    tones.setFrequency(0, 0);
    tones.setFrequency(1, 0);
  }
}
void fourTone(int onTime) {
  tones.setFrequency(0, 1209.0);
  tones.setFrequency(1, 770.0);
  tones.trigger(0);
  tones.trigger(1);
  if (onTime > 0) {
    delay(onTime);
    tones.setFrequency(0, 0);
    tones.setFrequency(1, 0);
  }
}
void fiveTone(int onTime) {
  tones.setFrequency(0, 1336.0);
  tones.setFrequency(1, 770.0);
  tones.trigger(0);
  tones.trigger(1);
  if (onTime > 0) {
    delay(onTime);
    tones.setFrequency(0, 0);
    tones.setFrequency(1, 0);
  }
}
void sixTone(int onTime) {
  tones.setFrequency(0, 1477.0);
  tones.setFrequency(1, 770.0);
  tones.trigger(0);
  tones.trigger(1);
  if (onTime > 0) {
    delay(onTime);
    tones.setFrequency(0, 0);
    tones.setFrequency(1, 0);
  }
}
void sevenTone(int onTime) {
  tones.setFrequency(0, 1209.0);
  tones.setFrequency(1, 852.0);
  tones.trigger(0);
  tones.trigger(1);
  if (onTime > 0) {
    delay(onTime);
    tones.setFrequency(0, 0);
    tones.setFrequency(1, 0);
  }
}
void eightTone(int onTime) {
  tones.setFrequency(0, 1336.0);
  tones.setFrequency(1, 852.0);
  tones.trigger(0);
  tones.trigger(1);
  if (onTime > 0) {
    delay(onTime);
    tones.setFrequency(0, 0);
    tones.setFrequency(1, 0);
  }
}
void nineTone(int onTime) {
  tones.setFrequency(0, 1477.0);
  tones.setFrequency(1, 852.0);
  tones.trigger(0);
  tones.trigger(1);
  if (onTime > 0) {
    delay(onTime);
    tones.setFrequency(0, 0);
    tones.setFrequency(1, 0);
  }
}
void zeroTone(int onTime) {
  tones.setFrequency(0, 1336.0);
  tones.setFrequency(1, 941.0);
  tones.trigger(0);
  tones.trigger(1);
  if (onTime > 0) {
    delay(onTime);
    tones.setFrequency(0, 0);
    tones.setFrequency(1, 0);
  }
}
void starTone(int onTime) {
  tones.setFrequency(0, 1209.0);
  tones.setFrequency(1, 941.0);
  tones.trigger(0);
  tones.trigger(1);
  if (onTime > 0) {
    delay(onTime);
    tones.setFrequency(0, 0);
    tones.setFrequency(1, 0);
  }
}
void poundTone(int onTime) {
  tones.setFrequency(0, 1477.0);
  tones.setFrequency(1, 941.0);
  tones.trigger(0);
  tones.trigger(1);
  if (onTime > 0) {
    delay(onTime);
    tones.setFrequency(0, 0);
    tones.setFrequency(1, 0);
  }
}

I have found a solution to this concern or should I say work around for this concern.

Symptom;
If I connect the SIM7600 to the tx/rx (pins 0 and 1) of the UNO. I was able to transmit to the SIM7600. eg: AT3179700949; or AT+MORING=1. However, the responses returned eg; NO CARRIER or VOICE CALL: BEGIN returned by the SIM7600 appear to be garbage characters and never match logic in the Arduino sketch that relies on those responses.

There is a free library available for the UNO called SoftwareSerial.h. I have found if I use this library and assign communications with the SIM7600 to different pins. I no longer have the issue with garbage characters. The responses from the SIM7600 are as expected and the Arduino acts on the response as expected.

I'm sure there must be some logical reason the UNO has issue with communication on the pins designed for serial communications. But it is beyond me. Using the SoftwareSerial has resolved the concern for my application.

Garbage characters means your MCU's UART baud rate is different from your SIMCOM's UART baud rate.

Try to play with that.

My SIM7600E works at 115200 by default.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.