[SOLVED] No GPS Fix with Model H

Discussion about software developed by Freematics, including Freematics Builder and Freematics Emulator GUI
Post Reply
barmeier
Posts: 5
Joined: Thu Aug 13, 2020 7:54 pm

[SOLVED] No GPS Fix with Model H

Post by barmeier »

Hi,

I encounter the problem that I cannot get a GPS FIX with Model H. Unfortunately it is not possible to use search in this forum for words like gps, fix, led and so on.

I tried to build a minimal GPS client. I cannot get a GPS FIX with the following code.

I would be happy if someone more experienced could give me a hint what I am doing wrong.

Code: Select all

#include <FreematicsPlus.h>

#define GPS_SERIAL_BAUDRATE 115200L
#define USE_GNSS 2

FreematicsESP32 sys;

GPS_DATA* gd = 0;
uint32_t lastGPStime = 0;

void setup() {
  delay(1000);

  // initialize USB serial
  Serial.begin(115200);

  if (sys.begin(USE_GNSS == 1, USE_GNSS == 2)) {
    Serial.print("TYPE:");
    Serial.println(sys.devType);
  }

  gd = new GPS_DATA;
  if (sys.gpsBegin(GPS_SERIAL_BAUDRATE)) {
    Serial.println("GPS: module initialized");
  }
  else {
    Serial.println("GPS: module is unavailable");
  }

  // init LED pin
  pinMode(PIN_LED, OUTPUT);
  digitalWrite(PIN_LED, LOW);

}

void printLocationData (GPS_DATA* gd) {
  float kph = gd->speed * 1852 / 1000;
  Serial.print("[GPS] - ");
  if (gd->time != 0 && lastGPStime == gd->time) {
    char buf[32];
    sprintf(buf, "%02u:%02u:%02u.%c",
            gd->time / 1000000, (gd->time % 1000000) / 10000, (gd->time % 10000) / 100, '0' + (gd->time % 100) / 10);
    Serial.print(buf);
    Serial.print(' ');
    Serial.print(gd->lat, 6);
    Serial.print(' ');
    Serial.print(gd->lng, 6);
    Serial.print(' ');
    Serial.print((int)kph);
    Serial.print("km/h");
    if (gd->sat) {
      Serial.print(" SATS:");
      Serial.print(gd->sat);
    }
    Serial.println();
    digitalWrite(PIN_LED, HIGH);
  }
  else {
    Serial.println("NO FIX");
  }
}

void loop() {
  sys.gpsGetData(&gd);
  printLocationData(gd);
  delay (15000);
}
When I dump the GPS_DATA structure I get this:

Code: Select all

TS       : 0
Date     : 260820
Time     : 10203450
LAT      : 0.00
LON      : 0.00
ALT      : 0.00
Speed    : 0.00
Heading  : 0
HDOP     : 15
Sats     : 0
Sentences: 0
Errors   : 0
Last edited by barmeier on Wed Sep 02, 2020 8:44 pm, edited 1 time in total.
barmeier
Posts: 5
Joined: Thu Aug 13, 2020 7:54 pm

Re: No GPS Fix with Model H

Post by barmeier »

Hi all,

just another newbie fail. I just have to wait for an hour (weather ?) before the first fix occurs. After this fix it now tooks about 10 minutes for a fix.
This is OK fro me.

The Listing below woks, but it could take a fairly long time before the fix occurs.
Post Reply