From b498c0bfbfe2630605318482b0ba2b619bee4663 Mon Sep 17 00:00:00 2001 From: Tom Fifield Date: Fri, 9 Aug 2024 09:18:18 +0800 Subject: [PATCH] [WIP] Add support for Airoha AG3335 GPS (#4394) * Add GPS detection code for Airoha AG3335 Airoha AG3335 is used in Seeed T-1000E Tracker * Add support for Airoha AG3335 Airoha AG3335 is used in Seeed T-1000E Tracker. This adds detection code, and code to configure its use. --------- Co-authored-by: Ben Meadors --- src/gps/GPS.cpp | 24 ++++++++++++++++++++++++ src/gps/GPS.h | 5 +++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/gps/GPS.cpp b/src/gps/GPS.cpp index 93742a99a..fcc7c0bd6 100644 --- a/src/gps/GPS.cpp +++ b/src/gps/GPS.cpp @@ -504,6 +504,22 @@ bool GPS::setup() delay(250); _serial_gps->write("$CFGMSG,6,1,0\r\n"); delay(250); + } else if (gnssModel == GNSS_MODEL_AG3335) { + + _serial_gps->write("$PAIR066,1,0,1,0,0,1*3B"); // Enable GPS+GALILEO+NAVIC + + // Configure NMEA (sentences will output once per fix) + _serial_gps->write("$PAIR062,0,0*3F"); // GGA ON + _serial_gps->write("$PAIR062,1,0*3F"); // GLL OFF + _serial_gps->write("$PAIR062,2,1*3D"); // GSA ON + _serial_gps->write("$PAIR062,3,0*3D"); // GSV OFF + _serial_gps->write("$PAIR062,4,0*3B"); // RMC ON + _serial_gps->write("$PAIR062,5,0*3B"); // VTG OFF + _serial_gps->write("$PAIR062,6,1*39"); // ZDA ON + + delay(250); + _serial_gps->write("$PAIR513*3D"); // save configuration + } else if (gnssModel == GNSS_MODEL_UBLOX) { // Configure GNSS system to GPS+SBAS+GLONASS (Module may restart after this command) // We need set it because by default it is GPS only, and we want to use GLONASS too @@ -1218,6 +1234,14 @@ GnssModel_t GPS::probe(int serialSpeed) return GNSS_MODEL_ATGM336H; } + /* Airoha (Mediatek) AG3335A/M/S, A3352Q, Quectel L89 2.0, SimCom SIM65M */ + clearBuffer(); + _serial_gps->write("PAIR020*38\r\n"); + if (getACK("$PAIR020,AG3335", 500) == GNSS_RESPONSE_OK) { + LOG_INFO("Aioha AG3335 detected, using AG3335 Module\n"); + return GNSS_MODEL_AG3335; + } + // Get version information clearBuffer(); _serial_gps->write("$PCAS06,0*1B\r\n"); diff --git a/src/gps/GPS.h b/src/gps/GPS.h index 87d03c592..1c0977bdd 100644 --- a/src/gps/GPS.h +++ b/src/gps/GPS.h @@ -28,7 +28,8 @@ typedef enum { GNSS_MODEL_UBLOX, GNSS_MODEL_UC6580, GNSS_MODEL_UNKNOWN, - GNSS_MODEL_MTK_L76B + GNSS_MODEL_MTK_L76B, + GNSS_MODEL_AG3335 } GnssModel_t; typedef enum { @@ -302,4 +303,4 @@ class GPS : private concurrency::OSThread }; extern GPS *gps; -#endif // Exclude GPS \ No newline at end of file +#endif // Exclude GPS