Hello everybody,
i am hitting a full stop here end and hope somebody can point me to the right direction.
Summary:
The issue is regarding reading data from a GPS module, writing log files on a SD card and periodically streaming the content of those collected log files via BLE to a peripheral for further handling. Somehow the readings from the gps module break down after the first successful exchange via BLE from the gps data logger client with the BLE Server.
All the parts have been successfully set up in isolated sketches, so i assume it is connected to the integration of the different parts.
What is working so far:
- Continously collect GPS Data from a Matek Systems GNSS SAM-M10Q via SoftwareSerial using the tinyGPS++ Library for parsing on an seeed xiao nrf52840 with the “non-embed” board (because later on battery i want to make use of the lower power features - not there yet)
- Save the newly received GPS Data into files on a SD Card using the SD Library. For now each Minute a new file is created for debugging purpose, later more GPS data will be written to the same file (hourly or daily file rotation) before trying to send the content to the peripheral.
- Continously sending text (at first only a fixed String, but also the content of such files like the ones created by sketch 2 via BLE (using Adafruit Bluefruit) to a ESP32 based BLE Server for further handling (which in turn stores the content of the transmitted files in new files on its own SD card until the BLE connection is released and the ESP32 Server is able to proceed with the file handling (which will be starting a wifi connection and passing the file further via ftp but this is an open todo and not an issue for this post)
When it stops working:
When everything is combined into one sketch the GPS starts fine, data is collected and written to the log files until the trigger is reached to send the content of the collected files on the SD card via BLE to the ESP32 Server.
The sending is also successfull, but when the sketch goes back to collecting new GPS data it seems to go stale and cannot get a new fix of GPS data.
This seems strange to me as gps.location.isValid(); is still returning 1 and all variables storing the interesting GPS Data have first been reset to empty strings “” to then be populated again with data from the GPS module.
It actually seems to me like the GPS Module itself is providing the stale data (thinking it is valid thus return isValid()=1) for some time, before the data goes to 0, 0, 0, 0
I tried to stop and reintialize the gps module by stopping and starting the SoftwareSerial, no luck so far.
So my questions are:
- Can somebody provide the reason for why this happens?
- How can i prevent this? I tried to reset the gps module but no luck.
A lot of write up, but i hope i provided all necessary details.
Thanks a lot
P.s.the Idea for the Project is a DIY pet tracker with wireless data offloading.