🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Unable to read data from GNSS Module with Core 2

    Modules
    4
    15
    3.7k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • F
      FRA222
      last edited by

      Hi,

      My configuration is a Core2 stacked to a M5Stack GNSS Module, newly bought on M5Stack Store.

      I don't manage to receive valid data from the GPS Module. The Serial stream and the source code are copied below.

      Thank you in advance for your support,

      Regards,
      Philippe

      ``
      --- Settings: /dev/cu.usbserial-57130480381 115200,8,N,1
      --- RTS: active DTR: active BREAK: inactive
      --- CTS: inactive DSR: inactive RI: inactive CD: inactive
      --- software flow control: inactive
      --- hardware flow control: inactive
      --- serial input encoding: UTF-8
      --- serial output encoding: UTF-8
      --- EOL: CRLF
      --- filters: default
      **** ***** 0.000000 *********** **** ********** ******** **** ****** ****** ***** *** ******** ****** *** 9960 0 0
      **** ***** 0.000000 *********** **** ********** ******** **** ****** ****** ***** *** ******** ****** *** 11392 0 0
      **** ***** 0.000000 *********** **** ********** ******** **** ****** ****** ***** *** ******** ****** *** 12828 0 0
      **** ***** 0.000000 *********** **** ********** ******** **** ****** ****** ***** *** ******** ****** *** 14268 0 0
      **** ***** 0.000000 *********** **** ********** ******** **** ****** ****** ***** *** ******** ****** *** 15710 0 0
      **** ***** 0.000000 *********** **** ********** ******** **** ****** ****** ***** *** ******** ****** *** 17152 0 0
      **** ***** 0.000000 *********** **** ********** ******** **** ****** ****** ***** *** ******** ****** *** 18599 0 0
      **** ***** 0.000000 *********** **** ********** ******** **** ****** ****** ***** *** ******** ****** *** 20048 0 0
      **** ***** 0.000000 *********** **** ********** ******** **** ****** ****** ***** *** ******** ****** *** 21519 0 0
      **** ***** 0.000000 *********** **** ********** ******** **** ****** ****** ***** *** ******** ****** *** 22972 0 0
      **** ***** 0.000000 *********** **** ********** ******** **** ****** ****** ***** *** ******** ****** *** 24435 0 0
      **** ***** 0.000000 *********** **** ********** ******** **** ****** ****** ***** *** ******** ****** *** 25906 0 0
      **** ***** 0.000000 *********** **** ********** ******** **** ****** ****** ***** *** ******** ****** *** 27544 0 0
      **** ***** 0.000000 *********** **** ********** ******** **** ****** ****** ***** *** ******** ****** *** 29184 0 0
      **** ***** 0.000000 *********** **** ********** ******** **** ****** ****** ***** *** ******** ****** *** 30819 0 0
      **** ***** 0.000000 *********** **** ********** ******** **** ****** ****** ***** *** ******** ****** *** 32460 0 0
      **** ***** 0.000000 *********** **** ********** ******** **** ****** ****** ***** *** ******** ****** *** 34108 0 0
      **** ***** 0.000000 *********** **** ********** ******** **** ****** ****** ***** *** ******** ****** *** 35775 0 0
      **** ***** 0.000000 *********** **** ********** ******** **** ****** ****** ***** *** ******** ****** *** 37424 0 0
      **** ***** 0.000000 *********** **** ********** ******** **** ****** ****** ***** *** ******** ****** *** 39081 0 0
      **** ***** 0.000000 *********** **** ********** ******** **** ****** ****** ***** *** ******** ****** *** 40724 0 0
      **** ***** 0.000000 *********** **** ********** ******** **** ****** ****** ***** *** ******** ****** *** 42372 0 0
      **** ***** 0.000000 *********** **** ********** ******** **** ****** ****** ***** *** ******** ****** *** 44017 0 0
      **** ***** 0.000000 *********** **** ********** ******** **** ****** ****** ***** *** ******** ****** *** 45657 0 0
      **** ***** 0.000000 *********** **** ********** ******** **** ****** ****** ***** *** ******** ****** *** 47299 0 0
      **** ***** 0.000000 *********** **** ********** ******** **** ****** ****** ***** *** ******** ****** *** 48941 0 0

      The Code is below :

      #include <M5Core2.h>
      #include "M5Module_GNSS.h"
      #include <TinyGPSPlus.h>
      #include <Adafruit_BMP280.h>
      #include <WiFiManager.h> // https://github.com/tzapu/WiFiManager
      #include <SPI.h>
      #include <WiFi.h>
      #include <MQTT.h>
      
      
      static void smartDelay(unsigned long ms);
      static void printFloat(float val, bool valid, int len, int prec);
      static void printInt(unsigned long val, bool valid, int len);
      static void printDateTime(TinyGPSDate &d, TinyGPSTime &t);
      static void printStr(const char *str, int len);
      
      TinyGPSPlus gps;
      static const double LONDON_LAT = 51.508131, LONDON_LON = -0.128002;
      
      
      //Fonction pour MQTT
      unsigned long lastMillis = 0;
      
      void setup()
      {
          //M5.begin(true, true, true, false, kMBusModeInput);  
          //M5.begin(); 
          M5.begin();
          
          Serial.begin(115200);
          while (!Serial)
              ;
      
      
          //Connexion du GPS
          Serial2.begin(115200, SERIAL_8N1, 13, 14);
      
          M5.Lcd.println();
          M5.Lcd.println(F(
              "Sats HDOP  Latitude   Longitude   Fix  Date       Time     Date Alt   "
              " Course Speed Card  Distance Course Card  Chars Sentences Checksum"));
          M5.Lcd.println(
              F("           (deg)      (deg)       Age                      Age  (m) "
                "   --- from GPS ----  ---- to London  ----  RX    RX        Fail"));
          M5.Lcd.println(F(
              "----------------------------------------------------------------------"
              "------------------------------------------------------------------"));
        
         
      
      }
      
      void loop()
      {
        
          printInt(gps.satellites.value(), gps.satellites.isValid(), 5);
          printFloat(gps.hdop.hdop(), gps.hdop.isValid(), 6, 1);
          //printFloat(gps.location.lat(), gps.location.isValid(), 11, 6);
          printFloat(gps.location.lat(), true, 11, 6);
      
          printFloat(gps.location.lng(), gps.location.isValid(), 12, 6);
          printInt(gps.location.age(), gps.location.isValid(), 5);
          printDateTime(gps.date, gps.time);
          printFloat(gps.altitude.meters(), gps.altitude.isValid(), 7, 2);
          printFloat(gps.course.deg(), gps.course.isValid(), 7, 2);
          printFloat(gps.speed.kmph(), gps.speed.isValid(), 6, 2);
          printStr(
              gps.course.isValid() ? TinyGPSPlus::cardinal(gps.course.deg()) : "*** ",
              6);
      
          unsigned long distanceKmToLondon =
              (unsigned long)TinyGPSPlus::distanceBetween(
                  gps.location.lat(), gps.location.lng(), LONDON_LAT, LONDON_LON) /
              1000;
          printInt(distanceKmToLondon, gps.location.isValid(), 9);
      
          double courseToLondon = TinyGPSPlus::courseTo(
              gps.location.lat(), gps.location.lng(), LONDON_LAT, LONDON_LON);
      
          printFloat(courseToLondon, gps.location.isValid(), 7, 2);
      
          const char *cardinalToLondon = TinyGPSPlus::cardinal(courseToLondon);
      
          printStr(gps.location.isValid() ? cardinalToLondon : "*** ", 6);
      
          printInt(gps.charsProcessed(), true, 6);
          printInt(gps.sentencesWithFix(), true, 10);
          printInt(gps.failedChecksum(), true, 9);
          Serial.println();
      
          smartDelay(1000);
      
          if (millis() > 5000 && gps.charsProcessed() < 10)
              Serial.println(F("No GPS data received: check wiring"));
      
          
              
      }
      
      // This custom version of delay() ensures that the gps object
      // is being "fed".
      static void smartDelay(unsigned long ms) {
          unsigned long start = millis();
          do {
              while (Serial2.available()) gps.encode(Serial2.read());
          } while (millis() - start < ms);
      }
      
      static void printFloat(float val, bool valid, int len, int prec) {
          if (!valid) {
              while (len-- > 1) Serial.print('*');
              Serial.print(' ');
          } else {
              Serial.print(val, prec);
              int vi   = abs((int)val);
              int flen = prec + (val < 0.0 ? 2 : 1);  // . and -
              flen += vi >= 1000 ? 4 : vi >= 100 ? 3 : vi >= 10 ? 2 : 1;
              for (int i = flen; i < len; ++i) Serial.print(' ');
          }
          smartDelay(0);
      }
      
      static void printInt(unsigned long val, bool valid, int len) {
          char sz[32] = "*****************";
          if (valid) sprintf(sz, "%ld", val);
          sz[len] = 0;
          for (int i = strlen(sz); i < len; ++i) sz[i] = ' ';
          if (len > 0) sz[len - 1] = ' ';
          Serial.print(sz);
          smartDelay(0);
      }
      
      static void printDateTime(TinyGPSDate &d, TinyGPSTime &t) {
          if (!d.isValid()) {
              Serial.print(F("********** "));
          } else {
              char sz[32];
              sprintf(sz, "%02d/%02d/%02d ", d.month(), d.day(), d.year());
              Serial.print(sz);
          }
      
          if (!t.isValid()) {
              Serial.print(F("******** "));
          } else {
              char sz[32];
              sprintf(sz, "%02d:%02d:%02d ", t.hour(), t.minute(), t.second());
              Serial.print(sz);
          }
      
          printInt(d.age(), d.isValid(), 5);
          smartDelay(0);
      }
      
      static void printStr(const char *str, int len) {
          int slen = strlen(str);
          for (int i = 0; i < len; ++i) Serial.print(i < slen ? str[i] : ' ');
          smartDelay(0);
      }
      1 Reply Last reply Reply Quote 0
      • robskiR
        robski
        last edited by

        have you tried diff baudrates for GNSS like 9600 or 38400 which is NEO chip default as per docs

        M5StickC, M5StickCPlus, M5StickCplus2,M5GO, M5Core, M5Tough, M5Core2, M5 Demo Board, M5Dial, M5Paper, M5Atom, M5Cardputer, M5StampS3, CoreMP135, StamPLC, AirQ

        F 1 Reply Last reply Reply Quote 0
        • ajb2k3A
          ajb2k3
          last edited by

          Are you trying it inside building or outside as they don't often work inside buildings

          UIFlow, so easy an adult can learn it!
          If I don't know it, be patient!
          I've ether not learned it or am too drunk to remember it!
          Author of the WIP UIFlow Handbook!
          M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

          F 1 Reply Last reply Reply Quote 0
          • F
            FRA222 @robski
            last edited by

            @robski Thank you very much for your answer. I tried 115200, 57600 and 9600 without any success. I will try tomorrow the other one you gave in your message and will tell you.

            F 1 Reply Last reply Reply Quote 0
            • F
              FRA222 @ajb2k3
              last edited by

              @ajb2k3 Thank you very much for your help. I did the tests with the external antenna, outside, on the roof close to a window.

              1 Reply Last reply Reply Quote 0
              • F
                FRA222 @FRA222
                last edited by

                @fra222 Thanks a lot again. It is working perfectly now with the 38 400 baudrate. The precision is impressing !

                robskiR 1 Reply Last reply Reply Quote 0
                • robskiR
                  robski @FRA222
                  last edited by

                  @fra222 said in Unable to read data from GNSS Module with Core 2:

                  @fra222 Thanks a lot again. It is working perfectly now with the 38 400 baudrate. The precision is impressing !

                  good to hear that you have it sorted now @FRA222

                  M5StickC, M5StickCPlus, M5StickCplus2,M5GO, M5Core, M5Tough, M5Core2, M5 Demo Board, M5Dial, M5Paper, M5Atom, M5Cardputer, M5StampS3, CoreMP135, StamPLC, AirQ

                  1 Reply Last reply Reply Quote 0
                  • U
                    UnumDesignum
                    last edited by

                    Hello,

                    I struggle to get GPS data from the GNSS module to the Core2.
                    I'm using the demo code here:
                    https://github.com/m5stack/M5Module-GNSS/blob/main/examples/getPosition/getPosition.ino
                    with the following settings: Serial2.begin(38400, SERIAL_8N1, 13, 14);

                    it seems like the Core2 is receiving data from the module, but it doesn't catches any satellite.

                    The external antenna is connected and left outside.
                    I tried with another Core2 and another GNSS module with same result.

                    Any idea ?

                    rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
                    configsip: 0, SPIWP:0xee
                    clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
                    mode:DIO, clock div:1
                    load:0x3fff0030,len:1344
                    load:0x40078000,len:13964
                    load:0x40080400,len:3600
                    entry 0x400805f0

                    Sats HDOP Latitude Longitude Fix Date Time Date Alt Course Speed Card Distance Course Card Chars Sentences Checksum
                    (deg) (deg) Age Age (m) --- from GPS ---- ---- to London ---- RX RX Fail

                    **** ***** ********** *********** **** ********** ******** **** ****** ****** ***** *** ******** ****** *** 0 0 0
                    0 100.0 ********** *********** **** 00/00/2000 00:00:00 951 ****** ****** ***** *** ******** ****** *** 369 0 0
                    0 100.0 ********** *********** **** 00/00/2000 00:00:00 952 ****** ****** ***** *** ******** ****** *** 738 0 0
                    0 100.0 ********** *********** **** 00/00/2000 00:00:00 953 ****** ****** ***** *** ******** ****** *** 1107 0 0
                    ....

                    0 100.0 ********** *********** **** 00/00/2000 00:00:00 655 ****** ****** ***** *** ******** ****** *** 25400 0 0
                    0 100.0 ********** *********** **** 00/00/2000 00:00:00 656 ****** ****** ***** *** ******** ****** *** 25437 0 0
                    0 100.0 ********** *********** **** 00/00/2000 00:00:00 657 ****** ****** ***** *** ******** ****** *** 25474 0 0
                    0 100.0 ********** *********** **** 00/00/2000 00:00:00 657 ****** ****** ***** *** ******** ****** *** 25511 0 0

                    0_1713188342770_gnss-core2.jpeg

                    1 Reply Last reply Reply Quote 0
                    • robskiR
                      robski
                      last edited by

                      would it matter if your PPS dip switch isn't set as default?

                      M5StickC, M5StickCPlus, M5StickCplus2,M5GO, M5Core, M5Tough, M5Core2, M5 Demo Board, M5Dial, M5Paper, M5Atom, M5Cardputer, M5StampS3, CoreMP135, StamPLC, AirQ

                      U 1 Reply Last reply Reply Quote 0
                      • U
                        UnumDesignum @robski
                        last edited by

                        @robski Thank you for your message. I tried to set dip 1 to on but without any success nor changes.
                        (I actually wonder what this PPS is)

                        There are data coming out from Serial2, but it seems that they cannot be decoded by tinyGPS.

                        0x24 0x47 0x4e 0x52 0x4d 0x43 0x2c 0x2c 0x56 0x2c 0x2c 0x2c 0x2c 0x2c 0x2c 0x2c 0x2c 0x2c 0x2c 0x4e 0x2c 0x56 0x2a 0x33 0x37 0x0d 0x0a 0x24 0x47 0x4e 0x56 0x54 0x47 0x2c 0x2c 0x2c 0x2c 0x2c 0x2c 0x2c 0x2c 0x2c 0x4e 0x2a 0x32 0x45 0x0d 0x0a 0x24 0x47 0x4e 0x47 0x47 0x41 0x2c 0x2c 0x2c 0x2c 0x2c 0x2c 0x30 0x2c 0x30 0x30 0x2c 0x39 0x39 0x2e 0x39 0x39 0x2c 0x2c 0x2c 0x2c 0x2c 0x2c 0x2a 0x35 0x36 0x0d 0x0a 0x24 0x47 0x4e 0x47 0x53 0x41 0x2c 0x41 0x2c 0x31 0x2c 0x2c 0x2c 0x2c 0x2c 0x2c 0x2c 0x2c 0x2c 0x2c 0x2c 0x2c 0x2c 0x39 0x39 0x2e 0x39 0x39 0x2c 0x39 0x39 0x2e 0x39 0x39 0x2c 0x39 0x39 0x2e 0x39 0x39 0x2c 0x31 0x2a 0x33 0x33 0x0d 0x0a 0x24 0x47 0x4e 0x47 0x53 0x41 0x2c 0x41 0x2c 0x31 0x2c 0x2c 0x2c 0x2c 0x2c 0x2c 0x2c 0x2c 0x2c 0x2c 0x2c 0x2c 0x2c 0x39 0x39 0x2e 0x39 0x39 0x2c 0x39 0x39 0x2e 0x39 0x39 0x2c 0x39 0x39 0x2e 0x39 0x39 0x2c 0x32 0x2a 0x33 0x30 0x0d 0x0a 0x24 0x47 0x4e 0x47 0x53 0x41 0x2c 0x41 0x2c 0x31 0x2c 0x2c 0x2c 0x2c 0x2c 0x2c 0x2c 0x2c 0x2c 0x2c 0x2c 0x2c 0x2c 0x39 0x39 0x2e 0x39 0x39 0x2c 0x39 0x39 0x2e 0x39 0x39 0x2c 0x39 0x39 0x2e 0x39 0x39 0x2c 0x33 0x2a 0x33 0x31 0x0d 0x0a 0x24 0x47 0x4e 0x47 0x53 0x41 0x2c 0x41 0x2c 0x31 0x2c 0x2c 0x2c 0x2c 0x2c 0x2c 0x2c 0x2c 0x2c 0x2c 0x2c 0x2c 0x2c 0x39 0x39 0x2e 0x39 0x39 0x2c 0x39 0x39 0x2e 0x39 0x39 0x2c 0x39 0x39 0x2e 0x39 0x39 0x2c 0x34 0x2a 0x33 0x36 0x0d 0x0a 0x24 0x47 0x50 0x47 0x53 0x56 0x2c 0x31 0x2c 0x31 0x2c 0x30 0x30 0x2c 0x31 0x2a 0x36 0x34 0x0d 0x0a 0x24 0x47 0x4c 0x47 0x53 0x56 0x2c 0x31 0x2c 0x31 0x2c 0x30 0x30 0x2c 0x31 0x2a 0x37 0x38 0x0d 0x0a 0x24 0x47 0x41 0x47 0x53 0x56 0x2c 0x31 0x2c 0x31 0x2c 0x30 0x30 0x2c 0x37 0x2a 0x37 0x33 0x0d 0x0a 0x24 0x47 0x42 0x47 0x53 0x56 0x2c 0x31 0x2c 0x31 0x2c 0x30 0x30 0x2c 0x31 0x2a 0x37 0x36 0x0d 0x0a 0x24 0x47 0x4e 0x47 0x4c 0x4c 0x2c 0x2c 0x2c 0x2c 0x2c 0x2c 0x56 0x2c 0x4e 0x2a 0x37 0x41 0x0d 0x0a 0 100.0 ********** *********** **** 00/00/2000 00:00:00 245 ****** ****** ***** *** ******** ****** *** 369 0 0

                        U 1 Reply Last reply Reply Quote 0
                        • U
                          UnumDesignum @UnumDesignum
                          last edited by

                          @unumdesignum The data returned by the GNSS module in ASCII:

                          $GNRMC,,V,,,,,,,,,,N,V37
                          $GNVTG,,,,,,,,,N
                          2E
                          $GNGGA,,,,,,0,00,99.99,,,,,,56
                          $GNGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99,1
                          33
                          $GNGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99,230
                          $GNGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99,3
                          31
                          $GNGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99,436
                          $GPGSV,1,1,00,1
                          64
                          $GLGSV,1,1,00,178
                          $GAGSV,1,1,00,7
                          73
                          $GBGSV,1,1,00,176
                          $GNGLL,,,,,,V,N
                          7A

                          1 Reply Last reply Reply Quote 0
                          • robskiR
                            robski
                            last edited by

                            Have you tried different baudrates?

                            M5StickC, M5StickCPlus, M5StickCplus2,M5GO, M5Core, M5Tough, M5Core2, M5 Demo Board, M5Dial, M5Paper, M5Atom, M5Cardputer, M5StampS3, CoreMP135, StamPLC, AirQ

                            U 1 Reply Last reply Reply Quote 0
                            • U
                              UnumDesignum @robski
                              last edited by

                              @robski yes I did. At 38400 I have a communication with the GNSS module. At other baud rates, I've got nothing.
                              Issue is not to communicate with the module, it is that the module does not return any valid position.

                              After some researches, my understanding is that I need to find out how to configure the GNSS module to make it work in my location (France). It seems that the actual configuration does not work. I'm learning the uBlox PBX commands as we speak.

                              1 Reply Last reply Reply Quote 0
                              • U
                                UnumDesignum
                                last edited by

                                I connected the module to the u-center app to have more information, but nothing helpful here.
                                The GNSS module does not see any satellite (GSV sentences).
                                Is there any GPS expert able to check the configuration ?

                                0_1713299332068_config.jpeg
                                0_1713299346969_log1.jpeg 0_1713299360561_log2.jpeg

                                1 Reply Last reply Reply Quote 0
                                • U
                                  UnumDesignum
                                  last edited by UnumDesignum

                                  For information to future readers, this morning one device Core2+GNSS suddenly started to work without any changes. The other one (same hw/sw) is now able to see satellites (between 11 to 14) but is totally unable to get a fix.

                                  ~~I wanted to use the magnetic gyroscope (BMM150) as well, but the data seems crazy and I cannot get any heading from them. Moreover, since this morning, the BIM270 initialisation is not more working.

                                  So I give up this module and I will use another GPS solution.~~

                                  Edit: thanks to M5Stack Support, the GNSS modules work fine now.
                                  The magnetic gyroscope BMM150, as other magnetometer requires a proper calibration to be used.

                                  1 Reply Last reply Reply Quote 0
                                  • First post
                                    Last post