You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: examples/Data_Logging/DataLoggingExample7_OpenLogESP32_SPI_SDIO/DataLoggingExample7_OpenLogESP32_SPI_SDIO.ino
+34-21Lines changed: 34 additions & 21 deletions
Original file line number
Diff line number
Diff line change
@@ -49,8 +49,10 @@ File myFile;
49
49
#include<SparkFun_u-blox_GNSS_Arduino_Library.h>//Click here to get the library: http://librarymanager/All#SparkFun_u-blox_GNSS
50
50
SFE_UBLOX_GNSS myGNSS;
51
51
52
-
#definesdWriteSize512// Write data to the SD card in blocks of 512 bytes
53
-
#definefileBufferSize16384// Allocate 16KBytes of RAM for UBX message storage
52
+
#definesdWriteSize2048// Write data to the SD card in blocks of n*512 bytes
53
+
#definefileBufferSize65530// Allocate just under 64KBytes of RAM for UBX message storage
54
+
#definenavRate20// Set the Nav Rate (Frequency) to 20Hz
55
+
//#define ubxOnly // Uncomment this line to log UBX (RAWX and SFRBX) only
54
56
uint8_t *myBuffer; // Use myBuffer to hold the data while we write it to SD card
55
57
56
58
unsignedlong lastPrint; // Record when the last Serial print took place
@@ -104,6 +106,7 @@ void setup()
104
106
105
107
// Do a fake transaction to initialize the SPI pins
pinMode(EN_3V3_SW, OUTPUT); // Enable power for the microSD card and GNSS
@@ -140,7 +143,11 @@ void setup()
140
143
141
144
//myGNSS.factoryDefault(); delay(5000); // Uncomment this line to reset the module back to its factory defaults
142
145
146
+
#ifdef ubxOnly
147
+
myGNSS.setSPIOutput(COM_TYPE_UBX); //Set the SPI port to output only UBX
148
+
#else
143
149
myGNSS.setSPIOutput(COM_TYPE_UBX | COM_TYPE_NMEA); //Set the SPI port to output both UBX and NMEA messages
150
+
#endif
144
151
145
152
//myGNSS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Optional: save (only) the communications port settings to flash and BBR
146
153
@@ -218,8 +225,6 @@ void setup()
218
225
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
219
226
// Enable RAWX and SFRBX
220
227
221
-
myGNSS.setNavigationFrequency(4); // Set navigation rate to 4Hz
222
-
223
228
myGNSS.setAutoRXMSFRBXcallbackPtr(&newSFRBX); // Enable automatic RXM SFRBX messages with callback to newSFRBX
224
229
225
230
myGNSS.logRXMSFRBX(); // Enable RXM SFRBX data logging
@@ -228,13 +233,18 @@ void setup()
228
233
229
234
myGNSS.logRXMRAWX(); // Enable RXM RAWX data logging
230
235
231
-
myGNSS.enableNMEAMessage(UBX_NMEA_GGA, COM_PORT_SPI, 1); // Ensure the GxGGA (Global positioning system fix data) message is enabled. Send every measurement.
232
-
myGNSS.enableNMEAMessage(UBX_NMEA_GSA, COM_PORT_SPI, 1); // Ensure the GxGSA (GNSS DOP and Active satellites) message is enabled. Send every measurement.
233
-
myGNSS.enableNMEAMessage(UBX_NMEA_GSV, COM_PORT_SPI, 1); // Ensure the GxGSV (GNSS satellites in view) message is enabled. Send every measurement.
236
+
myBuffer = newuint8_t[sdWriteSize]; // Create our own buffer to hold the data while we write it to SD card
234
237
235
-
myGNSS.setNMEALoggingMask(SFE_UBLOX_FILTER_NMEA_ALL); // Enable logging of all enabled NMEA messages
238
+
#ifndef ubxOnly
239
+
myGNSS.enableNMEAMessage(UBX_NMEA_GGA, COM_PORT_SPI, navRate); // Ensure the GxGGA (Global positioning system fix data) message is enabled. Send every second.
240
+
myGNSS.enableNMEAMessage(UBX_NMEA_GSA, COM_PORT_SPI, navRate); // Ensure the GxGSA (GNSS DOP and Active satellites) message is enabled. Send every second.
241
+
myGNSS.enableNMEAMessage(UBX_NMEA_GSV, COM_PORT_SPI, navRate); // Ensure the GxGSV (GNSS satellites in view) message is enabled. Send every second.
242
+
myGNSS.enableNMEAMessage(UBX_NMEA_GST, COM_PORT_SPI, navRate); // Ensure the GxGST (Position error statistics) message is enabled. Send every second.
243
+
myGNSS.enableNMEAMessage(UBX_NMEA_RMC, COM_PORT_SPI, navRate); // Ensure the GxRMC (Recommended minimum: position, velocity and time) message is enabled. Send every second.
244
+
myGNSS.setNMEALoggingMask(SFE_UBLOX_FILTER_NMEA_GGA | SFE_UBLOX_FILTER_NMEA_GSA | SFE_UBLOX_FILTER_NMEA_GSV | SFE_UBLOX_FILTER_NMEA_GST | SFE_UBLOX_FILTER_NMEA_RMC); // Log only these NMEA messages
245
+
#endif
236
246
237
-
myBuffer = newuint8_t[sdWriteSize]; //Create our own buffer to hold the data while we write it to SD card
0 commit comments