Open Freeno83 opened 3 years ago
I am having this problem too. I'll do some digging, but I am not all that familiar with how these libraries are built so some help would be appreciated.
I think it might have something to do with the address assignments of GPS_MASK_GGA and GPS_MASK_RMC since it appears that those addresses are being used by the ArduinoIoTCloud library on line 52 and 53 of this file https://github.com/arduino-libraries/ArduinoIoTCloud/blob/master/src/ArduinoIoTCloud.h.
I am going to try changing the addresses in the GPS library and see what happens.
I have tried changing the default address of the GPS module itself using the SparkFun library and it did not work. After trying different things for a couple hours I read this article, https://learn.adafruit.com/memories-of-an-arduino?view=all, and now I think it may simply be that there is not enough free memory to run both the Cloud libraries and the GPS libraries.
Does that sound like something that is possible?
I see the same incompatibility between the MKRGPS and MKRGSM library.
The follow sketch will not print the number of satellites:
#include <Arduino_MKRGPS.h>
#include <MKRGSM.h>
GSM gsmAccess;
void setup() {
Serial.begin(115200);
while (!Serial) {}
Serial.println("Booting");
Serial.println(GPS.begin(GPS_MODE_SHIELD) ? "GPS OK" : "GPS not OK");
gsmAccess.begin("");
Serial.println("Registered");
}
void loop() {
gsmAccess.isAccessAlive(); // removing this line will make it work
if (GPS.available())
Serial.println(GPS.satellites());
}
Removing the 1st line in the loop (gsmAccess.isAccessAlive();
), will make it work!!
Replacing MKRGPS with the Sparkfun u-blox GNSS library works:
#include <SparkFun_u-blox_GNSS_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
SFE_UBLOX_GNSS myGNSS;
#include <MKRGSM.h>
GSM gsmAccess;
void setup() {
Serial.begin(115200);
while (!Serial) {}
Serial.println("Booting");
Serial1.begin(9600);
Serial.println(myGNSS.begin(Serial1) ? "GPS OK" : "GPS not OK");
gsmAccess.begin("");
Serial.println("Registered");
}
void loop() {
gsmAccess.isAccessAlive(); // no influence on capturing GPS information
Serial.println(myGNSS.getSIV());
}
The MKRGPS library builds a message in GPS.available() async, whilst the Sparkfun lib seems to do it Sync (in getPVT). gsmAccess.isAccessAlive()
is not called that frequenctly in the Sparkfun lib.
Are SerialGSM and Serial1 in SAMD21 overlapping?
Update: The example below is closer to the MKRGPS example above (building the EMEA message in the loop) - and provides a good result.
#include <SparkFun_u-blox_GNSS_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
SFE_UBLOX_GNSS myGNSS;
#include <MKRGSM.h>
GSM gsmAccess;
void setup() {
Serial.begin(115200);
while (!Serial) {}
Serial.println("Booting");
Serial1.begin(9600);
Serial.println(myGNSS.begin(Serial1) ? "GPS OK" : "GPS not OK");
myGNSS.setAutoPVT(true); //Tell the GNSS to "send" each solution
gsmAccess.begin("");
Serial.println("Registered");
}
void loop() {
gsmAccess.isAccessAlive();
if (myGNSS.getPVT())
Serial.println(myGNSS.getSIV());
}
Any news regarding this problem? Has it been officially fixed?
@lathoub
The Reset PIN is shared between the GSM and the GPS chips.
It looks like when you write gsmAccess.begin("");
, it ask the GSM library to do a reset cycle (""
is true
in C) ... which by design reset as well the GPS chip and hence its serial connection. Could you try to either do it before the GPS begin
(just like you did with SparkFun library) or replace it with gsmAccess.begin(false);
? By chance the GPS library is not doing a reset cycle in the begin
method.
@Freeno83 @PhysicsUofRAUI The Reset PIN is also shared between the GSM and the Wifi chips. I'm not ultra familiar with the IOT Cloud library but I would beg that the library is also doing a reset of the wifi module. Just try to initialize the IOT Cloud library before the GPS it I assume it will work (I'm still waiting for my GPS shield to confirm this)
Hello,
Any updates on this issue ? Did anyone manage to get it working using MKR 1400 GSM to MKR1010 with the MKR GPS shield.
I am using the Sparkfun Ublox GPS library but still not working for me. Getting negative and 0 values in the IoT cloud dashboard.
Hardware used
MKR GSM 1400 with MKR GPS attached as a shield.
Issue description
When using the MKR GPS example sketch, GPS data immediately appears in the serial monitor.
However, when using the following code to send GPS data to Arduino IoT hub, the GPS data never comes.
A connection to IoT cloud is made successfully but the function
GPS.available()
always returns 0.Code