Xinyuan-LilyGO / LilyGO-T-SIM7000G

LilyGO T-SIM7000G
https://pt.aliexpress.com/item/4000542688096.html
296 stars 129 forks source link

Can't Communicate with SIM7070G #232

Open AltayAtaman opened 1 year ago

AltayAtaman commented 1 year ago

I have been working with LilyGO SIM7070G for a while but I had issues getting it to work.

First I tried "examples/Arduino_TinyGSM/AllFunctions" this example but it didn't work. It gave "GPRS Status: not connected" despite everything I tried. I have two theories about this issue. First one is possible differences between 7000G and 7070G and second one is not using a CAT-M or NB-Iot supporting SIM Card. I'm using 2G SIM Card for prototyping.

Then, after failing to use LilyGO library, I tried writing a simple code on my own using application notes and AT command manual provided by SIMCom. But I even didn't manage to get the simplest code possible to work as well. This is the code:

#define GSM_ENABLED 1
#define PIN_DTR 32
#define PIN_TX 26
#define PIN_RX 27
#define PWR_PIN 4
#define SerialMon Serial
#define SerialAT Serial2

void setup() {
    Serial.begin(9600);
    Serial2.begin(115200, SERIAL_8N1, PIN_RX, PIN_TX);
    Serial.println("Device Initializing...");
    delay(1000);
    SIM7070_Initialize();  
}

void loop() {  
    updateSerial(); 
}

void SIM7070_Initialize() {
    if (GSM_ENABLED) {
      pinMode(PWR_PIN, OUTPUT);
      modemPowerOff();
      delay(250);
      modemPowerOn();
      delay(1000);

      while (!SerialAT){ 
          Serial.println("Waiting for gsm serial.");
          delay(5000);
       }    

       SerialAT.println("AT+CPIN?"); // SIM Status
       updateSerial();
       SerialAT.println("AT+CSQ"); // Signal Quality Status
       updateSerial();
       SerialAT.println("AT+CGATT=1"); // GPRS Connect
       updateSerial();
       SerialAT.println("AT+CGATT?"); // GPRS Status
       updateSerial();    
    }

    else {
      return;
    }
}

void modemPowerOn() {
    digitalWrite(PWR_PIN, LOW);
    delay(1000);    
    digitalWrite(PWR_PIN, HIGH);
}

void modemPowerOff() {
   digitalWrite(PWR_PIN, LOW);
   delay(1500); 
   digitalWrite(PWR_PIN, HIGH);
}

void updateSerial() {
  delay(500);
  while (Serial.available()) 
  {
    SerialAT.write(Serial.read());//Forward what Serial received to Software Serial Port
  }
  while(SerialAT.available()) 
  {
    Serial.write(SerialAT.read());//Forward what Software Serial received to Serial Port
  }
}

Despite all my effords I'm not able to get a respond from the device. I was able to get few responses with code above but then I stopped getting anything. I really need help and any help would be really appreciated.

lewisxhe commented 1 year ago

Unable to connect is usually caused by the default network not supporting the current region. You can use NetworkTest Conduct testing, all network parameters are set to automatic, and the search shortlisted time may be a bit long. Please be patient and wait

zinkett commented 1 year ago

Are you sure the modem power on? With 7070 seems 1 second is too much for power on. In my case this work:

void modemPowerOn() {
    digitalWrite(PWR_PIN, LOW);
    delay(600);    
    digitalWrite(PWR_PIN, HIGH);
}
lewisxhe commented 1 year ago

600ms is obviously an error. Please refer to the 7070 hardware design manual, the minimum boot time must be 1 second image

AltayAtaman commented 1 year ago

Seems like I needed to select "Both NL & CR" option from Arduino IDE. It can be found by opening Serial Monitor. Problem solved thanks for the replies.

zinkett commented 1 year ago

600ms is obviously an error. Please refer to the 7070 hardware design manual, the minimum boot time must be 1 second

I read this datasheet of 7070G-HP where is write 0.5 s. Immagine 2023-05-05 083458

lewisxhe commented 1 year ago

SIM7070-HP? We didn't use this version, I don't know what the difference is

adnk13 commented 1 year ago

@AltayAtaman Excuse my English, but I'm not very good. Do you still have the problem? I had the same problem until I was reading the source code of the libraries that are used. In my case, I only replaced the line where the card is defined, #define TINY_GSM_MODEM_SIM7000 with #define TINY_GSM_MODEM_SIM7070; It took approximately 2 minutes, but I did the test without problems.