I have been using a MKR WiFi 1010 board with GPS shield for a very long time (year+) and have not been able to solve my problems with the GPS data dropping out.
The setup for my field application is a MKR WiFi 1010 stacked with the MKR GPS shield, the MKR ENV Shield (version1), and 2 analog sensors, with data saved to a microSD card onboard the ENV sensor and GPS data transmitted over BLE to a phone app (this was done to try to keep an eye on the GPS connection in real time).
This field application runs on battery power, so uses no serial commuincation with the laptop (i.e. no Serial Monitor). This code has run for long periods of time, collecting hours worth of data on the SD card... but this is not EVERY time. In fact, it's only about half. Other times, I use the same sketch and check the SD card to find that only the headers have printed and no data was saved. I've explored forums and taken the suggestions of removing delays and editing the library (MKR GPS Shield Sampling Frequency) but to no avail.
Now, I have gone entirely back to basics and am still left puzzled. I am using the GPSLocation example sketch that comes with the Arduino_MKRGPS library (only edit is the line that initializes the GPS in shield mode, GPS_MODE_SHIELD).
There are no delays in this sketch, and of course I have the SM open on the correct baud rate. It is supposed to just continuously print 5 parameters to the SM. I have run this sketch repeatedly in the same, unobstructed location over the last few days and this is what has happened:
- Sometimes, the initial connection is quick (<30 s- 1 min). Sometimes it takes a few minutes, and sometimes I wait an extremely long time (25 mins with still no connection) at which point I give up.
- Once the GPS has connected, it does not appear to stay connected in a consistent manner. I've attached a part of the SM printout with time stamps. The time between printing varies from 1s to tens of seconds, to over a minute. All with 6+ satellite connections.

Being that there are no delays in the code to regulate the frequency of printing to the SM, my thought is that the inconsistent gaps of time between printing come from either:
- an unstable connection to the GPS, which I would have no clue how to solve. Or, more likely,
- something wrong with the way the
GPS.available()function is structured in the library.
I have made my way into the CPP files of GPS, minmea, and SerialDDC and right now it is beyond my current programming abilities / comprehension. I will be doing some reading to understand NMEA and parsing and how the data being received by the GPS actually gets printed to the SM.
Being that time is a very precious resource and this problem is currently holding up field work for my dissertation, I am hoping you kind people may be able to help me narrow down my issue. Just getting the GPS to print at a consistent rate to the SM is step 1. Then I can get to figuring out if this fixes my problem in my field application.
Link to the Arduino_MKRGPS library with the sketches and files I mention: https://github.com/arduino-libraries/Arduino_MKRGPS/tree/master