Go Down

Topic: Arduino_MKR GPS Shield library bug? (Read 2564 times) previous topic - next topic

Ventcy

Nov 13, 2019, 12:26 pm Last Edit: Nov 13, 2019, 12:28 pm by Ventcy
I am trying to connect MKR GPS shield to Arduino by using I2C interface. The instruction is on the link below :

https://www.arduino.cc/en/Guide/MKRGPSShield

but when I compiled the code, there are some errors from the Arduino_MKRGPS library:



Code: [Select]
C:\Users\....\Documents\Arduino\libraries\Arduino_MKRGPS\src/GPS.h:88:19: error: field '_ts' has incomplete type 'timespec'

   struct timespec _ts; 



I tried #include <time.h>  but it did not work.

Could you guys help me with this?


nachoherrera

Hello Ventcy,

Thank you for sharing your problem with the Arduino community.

Could you please provide the following additional information so we can look into this issue properly?

- Arduino IDE version
- Operating system (Windows version)
- The complete sketch that you uploaded
- The Arduino board you are using

Some general checks:
- Make sure you installed Arduino_MKRGPS library from Arduino IDE top menu > Sketch > Include Library > Manage Libraries: search for MKR_GPS and install.

- Make sure the library is included at the beginning of the sketch:
Code: [Select]
#include <Arduino_MKRGPS.h>


If after these check you keep having issues I recommend you contact Arduino Technical Support here
┗(•ˇ_ˇ•)―→ Member of the Ardunio customer service team
( ━☞´◔‿ゝ◔`)━☞ Contact us through https://bit.ly/2xxu1le

HiddenUser

#2
Jan 10, 2020, 04:40 pm Last Edit: Jan 10, 2020, 04:47 pm by HiddenUser
Hello,

I bought an Arduino MKR Zero and want to run a MKR GPS device as a shield on top of the zero.

When I read the serial port without any library, I get the NMEA code.
It looks like there are missing some numbers but anyway I get a response from the GPS.
Example:

Code: [Select]

void setup()
{
 // Open serial communications and wait for port to open:
 Serial.begin(9600);
 Serial1.begin(9600);
}

void loop() // run over and over
{
  if (Serial1.available()>0)
  {
   Serial.write(Serial1.read());
 }
}


To interpret the NMEA data I want to use the Arduino_MKRGPS.h library.
But if I try to use GPS.available(), GPS.altitude() oder any other function, there is nothing happening.
A simple code demonstration looks like this:

Code: [Select]

#include <Arduino_MKRGPS.h>

void setup()
{
 // Open serial communications and wait for port to open:
 Serial.begin(9600);

 //Start connection to GPS
 GPS.begin(GPS_MODE_UART);
 
}

void loop() // run over and over
 {
 // read GPS data
 if (!GPS.begin()){
    Serial.println("GPS Failed");
  while(1);
 }
  if (!GPS.available()){
   Serial.println("No data");
  }
  else
  {
   int satellites = GPS.satellites();
   Serial.print("Number of Satellites:");
   Serial.println(satellites);
  }
}


Can anyone help me?
Could there be a problem in the library itself?

HiddenUser

Hello guys,

just a little update in case anyone has the same problem.

It seems like there was a problem with the MKRGPS-library.
We switched to the TinyGPS++-Library and now it works flawlessly.

406

Everything works fine. It is amusing to read gentlemen:)

paulwhitby

There is a common thread that there are issues with using the MKRGPS shield. My experience is thus:

* MKR GSM 1400, all example sketches and additional code on Arduino site work.
* MKRGPS, used as a shield, both example sketches work.

Put the 2 together, i.e. to send an SMS with the location from the GPS - mysteriously goes into a hole. Stops printing debug to Serial, claims to not acquire a location from the GPS.

I'll try the TinyGPS++ library instead as recommended above. I suspect bugs in the MKRGPS library and/or interactions with other serial-using libraries such as GSM.

Writing "everything is fine" is not helpful, IMHO.

paulwhitby

I have successfully used the TinyGPS+ library

http://arduiniana.org/libraries/tinygpsplus/

instead of the MKRGPS. Just set the baud rate to 9600 and swap the SoftwareSerial references for Serial1 (the hardware serial port that the GPS communicates on when used as a shield).


horse_battery_staple_guy

Wait really? I'm also having issues with this module over I2C. I'm using the examples included in the Arduino_MKRGPS library. None of them work.

I haven't found an answer glossing over the forum, and it seems its been more than a year since the last commit in the library's repo.

Is the library just dead?

mikethomasmakes

I have successfully used the TinyGPS+ library

http://arduiniana.org/libraries/tinygpsplus/

instead of the MKRGPS. Just set the baud rate to 9600 and swap the SoftwareSerial references for Serial1 (the hardware serial port that the GPS communicates on when used as a shield).


I have tried this with the MKR GSM 1400 + MKR GPS Shield and only print 0s when trying to read position.

Code: [Select]

#include "TinyGPS++.h"
TinyGPSPlus gps;

void setup() {
  // initialize serial communications and wait for port to open:
  Serial.begin(9600);
  Serial1.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }
}

void loop() {
 
  while (Serial1.available() > 0){
    gps.encode(Serial1.read());
  }
 
  //if (GPS.altitude.isUpdated()){
  Serial.println(gps.location.lat(), 6);
  //}
  delay(1000);
 
}

philipdbrown

I'm having this issue as well.  I tried the TinyGPS example, and I too am getting 0.0000.  Has anyone found a solution?  I'm using a MKR 1010 Board and the MKR GPS Shield connected via the I2C.

Go Up