SAM M8Q module communication problem

So, I connected my Seeeduino Xiao to my matek systems sam m8q module and I used StuartsProjects' code (it was recommended to someone in a related topic), the GPS_checker program to be specific. It doesn't work (I am using it inside for now so I didn't have high hopes of it working), but the curious part is that the program's setup function starts with a println of "GPS_Checker Starting" which I don't see on the serial monitor. Furthermore I keep seeing this random text and none of the println messages. Anyone have any ideas as to what's going on? Thanks for your time.

Code:

/*******************************************************************************************************
  Tracker Programs for Arduino - Copyright of the author Stuart Robinson - 17/12/19

  This program is supplied as is, it is up to the user of the program to decide if the program is
  suitable for the intended purpose and free from errors.
*******************************************************************************************************/

/*******************************************************************************************************
  Program Operation -  This program is a GPS checker. At startup the program starts checking the data
  coming from the GPS for a valid fix. The GPS data is printed to the Serial monitor. When the program
  detects that the GPS has a fix, it prints the GPS fix time, Latitude, Longitude, Altitude, Number of
  satellites in use and the HDOP value to the serial monitor.

  Serial monitor baud rate is set at 115200, GPS baud rate to 9600, both are configured in setup().
*******************************************************************************************************/

#include <TinyGPS++.h>                           //get library here > http://arduiniana.org/libraries/tinygpsplus/
TinyGPSPlus gps;                                 //create the TinyGPS++ object

#define RX A4                                    //pin number for GPS RX input into Arduino - TX from GPS
#define TX A5                                    //pin number for GPS TX output from Arduino- RX into GPS

#include <SoftwareSerial.h>
SoftwareSerial GPSserial(RX, TX);

float GPSLat;                                     //Latitude from GPS
float GPSLon;                                     //Longitude from GPS
float GPSAlt;                                     //Altitude from GPS
uint8_t GPSSats;                                  //number of GPS satellites in use
uint32_t GPSHdop;                                 //HDOP from GPS
uint32_t GPSstarttimemS;                          //time in mS when GPS is scanned fo fix
uint32_t GPSendtimemS;                            //time in mS when GPS got a fix

  
void loop()
{
  gpsWaitFix();
  displayGPSfix();
  Serial.print(GPSLat);//ADDED BY ME
  Serial.print("   ");//ADDED BY ME
  Serial.println(GPSLon);//ADDED BY ME
  delay(2000); //ADDED BY ME
}


void gpsWaitFix()
{
  //waits till the GPS gets an updated fix

  uint8_t GPSchar;

  Serial.println(F("Wait for updated GPS Fix"));
  GPSstarttimemS = millis();

  while (1)
  {
    if (GPSserial.available() > 0)
    {
      GPSchar = GPSserial.read();
      gps.encode(GPSchar);
      Serial.write(GPSchar);
    }

    if (gps.location.isUpdated() && gps.altitude.isUpdated())
    {
      GPSendtimemS = millis();
      break;
    }
  }
}


void displayGPSfix()
{
  float tempfloat;

  Serial.println();
  Serial.println();
  Serial.print(F("New GPS Fix "));
  Serial.print(GPSendtimemS - GPSstarttimemS);
  Serial.print(F("mS  "));

  GPSLat = gps.location.lat();
  GPSLon = gps.location.lng();
  GPSAlt = gps.altitude.meters();
  GPSSats = gps.satellites.value();
  GPSHdop = gps.hdop.value();
  tempfloat = ( (float) GPSHdop / 100);

  Serial.print(F("Lat,"));
  Serial.print(GPSLat, 6);
  Serial.print(F(",Lon,"));
  Serial.print(GPSLon, 6);
  Serial.print(F(",Alt,"));
  Serial.print(GPSAlt, 1);
  Serial.print(F("m,Sats,"));
  Serial.print(GPSSats);
  Serial.print(F(",HDOP,"));
  Serial.print(tempfloat, 2);

  Serial.println();
  Serial.println();
}


void setup()
{
  GPSserial.begin(9600);

  Serial.begin(115200);

  Serial.println(F("GPS_Checker Starting"));
  Serial.println();
}

looks like your output is the raw GPS NEMA data - have you connected a suitable antenna?

1 Like

Thanks for the website, it was very helpful😀. My module doesn't have an antenna connector. It appears to be an "all-in-one" module. Do you thing that I will get a proper position value if I use it outside?

what is the module?
even with an external antenna when working indoors it can be difficult to get a GPS signal
try the module by a window or outside - may take a few minutes to get a fix?

This is the module I am using:

I will take it outside and post the results.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.