Go Down

Topic: (mkr gsm 1400 + mkr gps) or (mkr wan 1310 + mkr gps) problems (Read 203 times) previous topic - next topic

szheltov

Hello!
Got 3 modules - mkr gsm 1400, mkr wan 1310, mkr gps. Tried to use gps with one of these modules. Nothing working. Below are experiments description:
1. gsm 1400 + mkr gps as shield:
sketch compiles, uploads, but after that always "GPS not available" in main loop().
2. gsm 1400 + mkr gps via i2c cable:
sketch compiles, uploads, but after that always "GPS init failed" in setup().
3. wan 1310 + mkr gps as shield:
sketch compiles, uploads, but after that always "GPS not available" in main loop(). (the same as #1)
4. wan 1310 + mkr gps via i2c cable:
sketch compiles, uploads. After it uploaded, com port seems lost (gray) in arduino ide and i cannot get it accessible until bootloader reset of arduino board.

IDE version is 1.8.12, used libraries - latest versions on 4/28 for all modules, OS - Win10, scketch code attached. Waited for GPS as at home, as on open space outside. For "shield" cases used GPS_MODE_SHIELD for GPS.begin(), for i2c - GPS_MODE_I2C.

Could someone help what is going with that GPS?

sterretje

No experience with MKR or GPS, so can't help

OP's code
Code: [Select]

#include <Arduino_MKRGPS.h>

void setup()
{
  Serial.begin(9600);
  while(!Serial);
  Serial.println("Init");

  //GPS_MODE_SHIELD GPS_MODE_I2C GPS_MODE_UART
  while(!GPS.begin(GPS_MODE_I2C))
  {
    Serial.println("GPS init failed");
    delay(1000);
    //while(1);
  }
  Serial.println("GPS initialized");
}

char str[128];

void loop()
{
float lat, lng, alt, s, crs, var;
unsigned long etime;
int nsat;

  if(GPS.available())
  {
    lat  = GPS.latitude();
    lng  = GPS.longitude();
    alt  = GPS.altitude();
    s    = GPS.speed();
    crs  = GPS.course();
    var  = GPS.variation();
    nsat = GPS.satellites();
    etime = GPS.getTime();  // 1980.01.05 sec

    sprintf(str, "lat: %f    lng: %f    alt: %f    v: %f    crs: %f    var: %f    sat: %d\n",
            lat, lng, alt, s, crs, var, nsat);

    Serial.println(str);                                                                                                                                                                                                                               
  }
  else
  {
    Serial.println("GPS not available");
  }

  delay(2000);
}
If you understand an example, use it.
If you don't understand an example, don't use it.

Electronics engineer by trade, software engineer by profession. Trying to get back into electronics after 15 years absence.

Go Up