Hi,
Could someone please point to more info or examples on how to use GPS with the new 4G Module Global? I have tried the example in Arduino_Cellular>GetLocation but getting:
Enabling GPS...
Failed to set GPS mode.
Response:
ERROR
Failed to enable GPS
Connecting to the ArduinoCloud works fine with the same setup (Mid Carrier, C33, 4G Module Global, Arduino IDE)
Thank you
Hi
Ran the example code and this is the serial output I got
09:58:01.625 -> AT+CSCS="GSM"
09:58:01.625 ->
09:58:01.669 -> OK
09:58:01.669 -> AT+CNMI=2,1,0,0,0
09:58:01.669 ->
09:58:01.669 -> OK
09:58:01.669 -> Enabling GPS...
09:58:01.669 -> AT+QGPSCFG="agpsposmode",8388608
09:58:01.669 ->
09:58:01.669 -> OK
09:58:01.669 -> AT+QGPS=1
09:58:01.669 ->
09:58:01.669 -> OK
09:58:03.646 -> AT+QGPSLOC=2
09:58:03.680 ->
09:58:03.680 -> ERROR
09:58:04.648 -> AT+QGPSLOC=2
09:58:04.691 ->
09:58:04.691 -> ERROR
From the EC25&EC21 GNSS AT Commands Manual it would seem its failing to acquire positioning info
Got the AT command feedback by modifying my local copy of ModemInterface.h
/**
* @file ModemInterface.h
* @brief Header file for the ModemInterface class.
*/
#ifndef ARDUINO_4G_MODULE_H
#define ARDUINO_4G_MODULE_H
#define DUMP_AT_COMMANDS //<----unhash to get serial dump
#define TINY_GSM_RX_BUFFER 1024
#define TINY_GSM_MODEM_BG96
#if defined(ARDUINO_PORTENTA_H7_M
Must also mention that I'm sitting in an office building, and haven't tried going outside with a clear line of sight. Could be interference causing this.
Hi Community,
Did anyone managed to run the GPS example code successfully with the new 4G Module Global?
Thanks
Just FYI below code works for me now with longer timeout in setup() for 1st time fetching GPS location and then in loop() only short timeout works.
#include "ArduinoCellular.h"
ArduinoCellular cellular = ArduinoCellular();
void setup(){
Serial.begin(115200);
while (!Serial);
cellular.setDebugStream(Serial);
cellular.begin();
delay(2000); // Give the modem some time to initialize
Serial.println("Enable GPS...");
cellular.enableGPS(true);
Serial.println("Getting initial GPS location...");
Geolocation location = cellular.getGPSLocation(60000);
Serial.println("Initial GPS Location:");
Serial.print("* Latitude: "); Serial.println(location.latitude, 6);
Serial.print("* Longitude: "); Serial.println(location.longitude, 6);
Serial.println("--------DONE--------\n");
Serial.println("Setup done");
}
void loop(){
Serial.println("Getting GPS location...");
Geolocation location = cellular.getGPSLocation(1000);
Serial.println("GPS Location:");
Serial.print("* Latitude: "); Serial.println(location.latitude, 6);
Serial.print("* Longitude: "); Serial.println(location.longitude, 6);
Serial.println("--------------------\n");
}