Xinyuan-LilyGO / LilyGO-T-SIM7000G

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

Multiple card GPS stops working without explanation #91

Closed eueduardo3 closed 3 years ago

eueduardo3 commented 3 years ago

GPS simply stops working without explanation, it was days running. More than one plate, which were in different locations, had the same defect

lewisxhe commented 3 years ago

Have you used this test?

https://github.com/Xinyuan-LilyGO/LilyGO-T-SIM7000G/tree/master/examples/Arduino_GPSTest

Mr-HaleYa commented 3 years ago

you really didn't explain it that well... code sample? location? sim carrier?

eueduardo3 commented 3 years ago

Have you used this test?

https://github.com/Xinyuan-LilyGO/LilyGO-T-SIM7000G/tree/master/examples/Arduino_GPSTest

HI, thanks for reply. Yes, I tested this example

eueduardo3 commented 3 years ago

you really didn't explain it that well... code sample? location? sim carrier?

I have some T-SIM7000 boards. With any script that uses GPS, none of them restore the location.

The modem network celullar functions are ok.

Mr-HaleYa commented 3 years ago

It can take up to 3 minutes for it to find a GPS location and you should be outside in an open area or it will fail. AT+CGNSINF just means its searching

code I use for GPS, works perfect on all 40 of our boards

void getGPS() {
  float lat=0;
  float lon=0;
  Serial.println("Turning on GPS  power");
  modem.sendAT("+SGPIO=0,4,1,1"); // V20200415 set GPIO4 HIGH to turn on GPS power
  delay(1000);
  modem.enableGPS();
  long startTime = millis();
  Serial.println("Scanning for location for 2 mins");
  while (millis() - startTime <= 120000 ) {    // scans for 1 min 
    if (modem.getGPS(&lat, &lon)) {
      Serial.printf("lat:%f lon:%f\n", lat, lon);
      break;
    }
    delay(2000);
  }
  if (lat == 0) { Serial.println("Failed to get location"); }
  modem.disableGPS();
  Serial.println("Turning off GPS power");
  delay(1000);
  modem.sendAT("+SGPIO=0,4,1,0"); // V20200415 set GPIO4 LOW to turn off GPS power
}
eueduardo3 commented 3 years ago

It can take up to 3 minutes for it to find a GPS location and you should be outside in an open area or it will fail. AT+CGNSINF just means its searching

code I use for GPS, works perfect on all 40 of our boards

void getGPS() {
  float lat=0;
  float lon=0;
  Serial.println("Turning on GPS  power");
  modem.sendAT("+SGPIO=0,4,1,1"); // V20200415 set GPIO4 HIGH to turn on GPS power
  delay(1000);
  modem.enableGPS();
  long startTime = millis();
  Serial.println("Scanning for location for 2 mins");
  while (millis() - startTime <= 120000 ) {    // scans for 1 min 
    if (modem.getGPS(&lat, &lon)) {
      Serial.printf("lat:%f lon:%f\n", lat, lon);
      break;
    }
    delay(2000);
  }
  if (lat == 0) { Serial.println("Failed to get location"); }
  modem.disableGPS();
  Serial.println("Turning off GPS power");
  delay(1000);
  modem.sendAT("+SGPIO=0,4,1,0"); // V20200415 set GPIO4 LOW to turn off GPS power
}

Thanks for posting, I recovered some of the devices by placing the 1 second delay you used between modem.sendAT ("+ SGPIO = 0,4,1,1") and modem.enableGPS () :

modem.sendAT("+SGPIO=0,4,1,1"); delay(1000); modem.enableGPS();

Mr-HaleYa commented 3 years ago

@eueduardo3 why did you reopen this then???

eueduardo3 commented 3 years ago

@eueduardo3 why did you reopen this then???

so that this answer can help other people who have a problem with GPS also because of this delay. I hadn’t seen anywhere commenting that this delay is necessary to avoid GPS problems