Update data logging examples 4-6
This commit is contained in:
+6
-9
@@ -35,9 +35,7 @@
|
|||||||
Insert a formatted micro-SD card into the socket on the Carrier Board.
|
Insert a formatted micro-SD card into the socket on the Carrier Board.
|
||||||
Connect the Carrier Board to your computer using a USB-C cable.
|
Connect the Carrier Board to your computer using a USB-C cable.
|
||||||
Ensure you have the SparkFun Apollo3 boards installed: http://boardsmanager/All#SparkFun_Apollo3
|
Ensure you have the SparkFun Apollo3 boards installed: http://boardsmanager/All#SparkFun_Apollo3
|
||||||
This code has been tested using version 2.1.0 of the Apollo3 boards on Arduino IDE 1.8.13.
|
This code has been tested using version 2.2.0 of the Apollo3 boards on Arduino IDE 1.8.13.
|
||||||
- Version 2.1.1 of Apollo3 contains a feature which makes I2C communication with u-blox modules problematic
|
|
||||||
- We recommend using v2.1.0 of Apollo3 until v2.2.0 is released
|
|
||||||
Select "Artemis MicroMod Processor" as the board type.
|
Select "Artemis MicroMod Processor" as the board type.
|
||||||
Press upload to upload the code onto the Artemis.
|
Press upload to upload the code onto the Artemis.
|
||||||
Open the Serial Monitor at 115200 baud to see the output.
|
Open the Serial Monitor at 115200 baud to see the output.
|
||||||
@@ -77,6 +75,7 @@ File myFile; //File that all GNSS data is written to
|
|||||||
|
|
||||||
#define sdWriteSize 512 // Write data to the SD card in blocks of 512 bytes
|
#define sdWriteSize 512 // Write data to the SD card in blocks of 512 bytes
|
||||||
#define fileBufferSize 16384 // Allocate 16KBytes of RAM for UBX message storage
|
#define fileBufferSize 16384 // Allocate 16KBytes of RAM for UBX message storage
|
||||||
|
uint8_t *myBuffer; // A buffer to hold the data while we write it to SD card
|
||||||
|
|
||||||
unsigned long lastPrint; // Record when the last Serial print took place
|
unsigned long lastPrint; // Record when the last Serial print took place
|
||||||
unsigned long bytesWritten = 0; // Record how many bytes have been written to SD card
|
unsigned long bytesWritten = 0; // Record how many bytes have been written to SD card
|
||||||
@@ -181,6 +180,8 @@ void setup()
|
|||||||
|
|
||||||
myGNSS.logRXMRAWX(); // Enable RXM RAWX data logging
|
myGNSS.logRXMRAWX(); // Enable RXM RAWX data logging
|
||||||
|
|
||||||
|
myBuffer = new uint8_t[sdWriteSize]; // Create our own buffer to hold the data while we write it to SD card
|
||||||
|
|
||||||
Serial.println(F("Press any key to stop logging."));
|
Serial.println(F("Press any key to stop logging."));
|
||||||
|
|
||||||
lastPrint = millis(); // Initialize lastPrint
|
lastPrint = millis(); // Initialize lastPrint
|
||||||
@@ -198,9 +199,7 @@ void loop()
|
|||||||
{
|
{
|
||||||
digitalWrite(LED_BUILTIN, HIGH); // Flash LED_BUILTIN each time we write to the SD card
|
digitalWrite(LED_BUILTIN, HIGH); // Flash LED_BUILTIN each time we write to the SD card
|
||||||
|
|
||||||
uint8_t myBuffer[sdWriteSize]; // Create our own buffer to hold the data while we write it to SD card
|
myGNSS.extractFileBufferData(myBuffer, sdWriteSize); // Extract exactly sdWriteSize bytes from the UBX file buffer and put them into myBuffer
|
||||||
|
|
||||||
myGNSS.extractFileBufferData((uint8_t *)&myBuffer, sdWriteSize); // Extract exactly sdWriteSize bytes from the UBX file buffer and put them into myBuffer
|
|
||||||
|
|
||||||
myFile.write(myBuffer, sdWriteSize); // Write exactly sdWriteSize bytes from myBuffer to the ubxDataFile on the SD card
|
myFile.write(myBuffer, sdWriteSize); // Write exactly sdWriteSize bytes from myBuffer to the ubxDataFile on the SD card
|
||||||
|
|
||||||
@@ -242,15 +241,13 @@ void loop()
|
|||||||
{
|
{
|
||||||
digitalWrite(LED_BUILTIN, HIGH); // Flash LED_BUILTIN while we write to the SD card
|
digitalWrite(LED_BUILTIN, HIGH); // Flash LED_BUILTIN while we write to the SD card
|
||||||
|
|
||||||
uint8_t myBuffer[sdWriteSize]; // Create our own buffer to hold the data while we write it to SD card
|
|
||||||
|
|
||||||
uint16_t bytesToWrite = remainingBytes; // Write the remaining bytes to SD card sdWriteSize bytes at a time
|
uint16_t bytesToWrite = remainingBytes; // Write the remaining bytes to SD card sdWriteSize bytes at a time
|
||||||
if (bytesToWrite > sdWriteSize)
|
if (bytesToWrite > sdWriteSize)
|
||||||
{
|
{
|
||||||
bytesToWrite = sdWriteSize;
|
bytesToWrite = sdWriteSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
myGNSS.extractFileBufferData((uint8_t *)&myBuffer, bytesToWrite); // Extract bytesToWrite bytes from the UBX file buffer and put them into myBuffer
|
myGNSS.extractFileBufferData(myBuffer, bytesToWrite); // Extract bytesToWrite bytes from the UBX file buffer and put them into myBuffer
|
||||||
|
|
||||||
myFile.write(myBuffer, bytesToWrite); // Write bytesToWrite bytes from myBuffer to the ubxDataFile on the SD card
|
myFile.write(myBuffer, bytesToWrite); // Write bytesToWrite bytes from myBuffer to the ubxDataFile on the SD card
|
||||||
|
|
||||||
|
|||||||
@@ -35,9 +35,7 @@
|
|||||||
Insert a formatted micro-SD card into the socket on the Carrier Board.
|
Insert a formatted micro-SD card into the socket on the Carrier Board.
|
||||||
Connect the Carrier Board to your computer using a USB-C cable.
|
Connect the Carrier Board to your computer using a USB-C cable.
|
||||||
Ensure you have the SparkFun Apollo3 boards installed: http://boardsmanager/All#SparkFun_Apollo3
|
Ensure you have the SparkFun Apollo3 boards installed: http://boardsmanager/All#SparkFun_Apollo3
|
||||||
This code has been tested using version 2.1.0 of the Apollo3 boards on Arduino IDE 1.8.13.
|
This code has been tested using version 2.2.0 of the Apollo3 boards on Arduino IDE 1.8.13.
|
||||||
- Version 2.1.1 of Apollo3 contains a feature which makes I2C communication with u-blox modules problematic
|
|
||||||
- We recommend using v2.1.0 of Apollo3 until v2.2.0 is released
|
|
||||||
Select "Artemis MicroMod Processor" as the board type.
|
Select "Artemis MicroMod Processor" as the board type.
|
||||||
Press upload to upload the code onto the Artemis.
|
Press upload to upload the code onto the Artemis.
|
||||||
Open the Serial Monitor at 115200 baud to see the output.
|
Open the Serial Monitor at 115200 baud to see the output.
|
||||||
@@ -77,6 +75,7 @@ File myFile; //File that all GNSS data is written to
|
|||||||
|
|
||||||
#define sdWriteSize 512 // Write data to the SD card in blocks of 512 bytes
|
#define sdWriteSize 512 // Write data to the SD card in blocks of 512 bytes
|
||||||
#define fileBufferSize 32768 // Allocate 32KBytes of RAM for UBX message storage
|
#define fileBufferSize 32768 // Allocate 32KBytes of RAM for UBX message storage
|
||||||
|
uint8_t *myBuffer; // A buffer to hold the data while we write it to SD card
|
||||||
|
|
||||||
unsigned long lastPrint; // Record when the last Serial print took place
|
unsigned long lastPrint; // Record when the last Serial print took place
|
||||||
unsigned long bytesWritten = 0; // Record how many bytes have been written to SD card
|
unsigned long bytesWritten = 0; // Record how many bytes have been written to SD card
|
||||||
@@ -196,6 +195,8 @@ void setup()
|
|||||||
|
|
||||||
myGNSS.logRXMRAWX(); // Enable RXM RAWX data logging
|
myGNSS.logRXMRAWX(); // Enable RXM RAWX data logging
|
||||||
|
|
||||||
|
myBuffer = new uint8_t[sdWriteSize]; // Create our own buffer to hold the data while we write it to SD card
|
||||||
|
|
||||||
Serial.println(F("Press any key to stop logging."));
|
Serial.println(F("Press any key to stop logging."));
|
||||||
|
|
||||||
lastPrint = millis(); // Initialize lastPrint
|
lastPrint = millis(); // Initialize lastPrint
|
||||||
@@ -213,9 +214,7 @@ void loop()
|
|||||||
{
|
{
|
||||||
digitalWrite(LED_BUILTIN, HIGH); // Flash LED_BUILTIN each time we write to the SD card
|
digitalWrite(LED_BUILTIN, HIGH); // Flash LED_BUILTIN each time we write to the SD card
|
||||||
|
|
||||||
uint8_t myBuffer[sdWriteSize]; // Create our own buffer to hold the data while we write it to SD card
|
myGNSS.extractFileBufferData(myBuffer, sdWriteSize); // Extract exactly sdWriteSize bytes from the UBX file buffer and put them into myBuffer
|
||||||
|
|
||||||
myGNSS.extractFileBufferData((uint8_t *)&myBuffer, sdWriteSize); // Extract exactly sdWriteSize bytes from the UBX file buffer and put them into myBuffer
|
|
||||||
|
|
||||||
myFile.write(myBuffer, sdWriteSize); // Write exactly sdWriteSize bytes from myBuffer to the ubxDataFile on the SD card
|
myFile.write(myBuffer, sdWriteSize); // Write exactly sdWriteSize bytes from myBuffer to the ubxDataFile on the SD card
|
||||||
|
|
||||||
@@ -263,15 +262,13 @@ void loop()
|
|||||||
{
|
{
|
||||||
digitalWrite(LED_BUILTIN, HIGH); // Flash LED_BUILTIN while we write to the SD card
|
digitalWrite(LED_BUILTIN, HIGH); // Flash LED_BUILTIN while we write to the SD card
|
||||||
|
|
||||||
uint8_t myBuffer[sdWriteSize]; // Create our own buffer to hold the data while we write it to SD card
|
|
||||||
|
|
||||||
uint16_t bytesToWrite = remainingBytes; // Write the remaining bytes to SD card sdWriteSize bytes at a time
|
uint16_t bytesToWrite = remainingBytes; // Write the remaining bytes to SD card sdWriteSize bytes at a time
|
||||||
if (bytesToWrite > sdWriteSize)
|
if (bytesToWrite > sdWriteSize)
|
||||||
{
|
{
|
||||||
bytesToWrite = sdWriteSize;
|
bytesToWrite = sdWriteSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
myGNSS.extractFileBufferData((uint8_t *)&myBuffer, bytesToWrite); // Extract bytesToWrite bytes from the UBX file buffer and put them into myBuffer
|
myGNSS.extractFileBufferData(myBuffer, bytesToWrite); // Extract bytesToWrite bytes from the UBX file buffer and put them into myBuffer
|
||||||
|
|
||||||
myFile.write(myBuffer, bytesToWrite); // Write bytesToWrite bytes from myBuffer to the ubxDataFile on the SD card
|
myFile.write(myBuffer, bytesToWrite); // Write bytesToWrite bytes from myBuffer to the ubxDataFile on the SD card
|
||||||
|
|
||||||
|
|||||||
@@ -24,9 +24,7 @@
|
|||||||
Insert a formatted micro-SD card into the socket on the Carrier Board.
|
Insert a formatted micro-SD card into the socket on the Carrier Board.
|
||||||
Connect the Carrier Board to your computer using a USB-C cable.
|
Connect the Carrier Board to your computer using a USB-C cable.
|
||||||
Ensure you have the SparkFun Apollo3 boards installed: http://boardsmanager/All#SparkFun_Apollo3
|
Ensure you have the SparkFun Apollo3 boards installed: http://boardsmanager/All#SparkFun_Apollo3
|
||||||
This code has been tested using version 2.1.0 of the Apollo3 boards on Arduino IDE 1.8.13.
|
This code has been tested using version 2.2.0 of the Apollo3 boards on Arduino IDE 1.8.13.
|
||||||
- Version 2.1.1 of Apollo3 contains a feature which makes I2C communication with u-blox modules problematic
|
|
||||||
- We recommend using v2.1.0 of Apollo3 until v2.2.0 is released
|
|
||||||
Select "Artemis MicroMod Processor" as the board type.
|
Select "Artemis MicroMod Processor" as the board type.
|
||||||
Press upload to upload the code onto the Artemis.
|
Press upload to upload the code onto the Artemis.
|
||||||
Open the Serial Monitor at 115200 baud to see the output.
|
Open the Serial Monitor at 115200 baud to see the output.
|
||||||
@@ -68,6 +66,7 @@ File myFile; //File that all GNSS data is written to
|
|||||||
|
|
||||||
#define sdWriteSize 512 // Write data to the SD card in blocks of 512 bytes
|
#define sdWriteSize 512 // Write data to the SD card in blocks of 512 bytes
|
||||||
#define fileBufferSize 16384 // Allocate 16KBytes of RAM for UBX message storage
|
#define fileBufferSize 16384 // Allocate 16KBytes of RAM for UBX message storage
|
||||||
|
uint8_t *myBuffer; // A buffer to hold the data while we write it to SD card
|
||||||
|
|
||||||
unsigned long lastPrint; // Record when the last Serial print took place
|
unsigned long lastPrint; // Record when the last Serial print took place
|
||||||
unsigned long bytesWritten = 0; // Record how many bytes have been written to SD card
|
unsigned long bytesWritten = 0; // Record how many bytes have been written to SD card
|
||||||
@@ -175,6 +174,8 @@ void setup()
|
|||||||
myGNSS.setNMEALoggingMask(SFE_UBLOX_FILTER_NMEA_ALL); // Enable logging of all enabled NMEA messages
|
myGNSS.setNMEALoggingMask(SFE_UBLOX_FILTER_NMEA_ALL); // Enable logging of all enabled NMEA messages
|
||||||
//myGNSS.setNMEALoggingMask(SFE_UBLOX_FILTER_NMEA_GGA | SFE_UBLOX_FILTER_NMEA_GSA); // Or we can, for example, log only GxGGA & GxGSA and ignore GxGSV
|
//myGNSS.setNMEALoggingMask(SFE_UBLOX_FILTER_NMEA_GGA | SFE_UBLOX_FILTER_NMEA_GSA); // Or we can, for example, log only GxGGA & GxGSA and ignore GxGSV
|
||||||
|
|
||||||
|
myBuffer = new uint8_t[sdWriteSize]; // Create our own buffer to hold the data while we write it to SD card
|
||||||
|
|
||||||
Serial.println(F("Press any key to stop logging."));
|
Serial.println(F("Press any key to stop logging."));
|
||||||
|
|
||||||
lastPrint = millis(); // Initialize lastPrint
|
lastPrint = millis(); // Initialize lastPrint
|
||||||
@@ -192,9 +193,7 @@ void loop()
|
|||||||
{
|
{
|
||||||
digitalWrite(LED_BUILTIN, HIGH); // Flash LED_BUILTIN each time we write to the SD card
|
digitalWrite(LED_BUILTIN, HIGH); // Flash LED_BUILTIN each time we write to the SD card
|
||||||
|
|
||||||
uint8_t myBuffer[sdWriteSize]; // Create our own buffer to hold the data while we write it to SD card
|
myGNSS.extractFileBufferData(myBuffer, sdWriteSize); // Extract exactly sdWriteSize bytes from the UBX file buffer and put them into myBuffer
|
||||||
|
|
||||||
myGNSS.extractFileBufferData((uint8_t *)&myBuffer, sdWriteSize); // Extract exactly sdWriteSize bytes from the UBX file buffer and put them into myBuffer
|
|
||||||
|
|
||||||
myFile.write(myBuffer, sdWriteSize); // Write exactly sdWriteSize bytes from myBuffer to the ubxDataFile on the SD card
|
myFile.write(myBuffer, sdWriteSize); // Write exactly sdWriteSize bytes from myBuffer to the ubxDataFile on the SD card
|
||||||
|
|
||||||
@@ -236,15 +235,13 @@ void loop()
|
|||||||
{
|
{
|
||||||
digitalWrite(LED_BUILTIN, HIGH); // Flash LED_BUILTIN while we write to the SD card
|
digitalWrite(LED_BUILTIN, HIGH); // Flash LED_BUILTIN while we write to the SD card
|
||||||
|
|
||||||
uint8_t myBuffer[sdWriteSize]; // Create our own buffer to hold the data while we write it to SD card
|
|
||||||
|
|
||||||
uint16_t bytesToWrite = remainingBytes; // Write the remaining bytes to SD card sdWriteSize bytes at a time
|
uint16_t bytesToWrite = remainingBytes; // Write the remaining bytes to SD card sdWriteSize bytes at a time
|
||||||
if (bytesToWrite > sdWriteSize)
|
if (bytesToWrite > sdWriteSize)
|
||||||
{
|
{
|
||||||
bytesToWrite = sdWriteSize;
|
bytesToWrite = sdWriteSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
myGNSS.extractFileBufferData((uint8_t *)&myBuffer, bytesToWrite); // Extract bytesToWrite bytes from the UBX file buffer and put them into myBuffer
|
myGNSS.extractFileBufferData(myBuffer, bytesToWrite); // Extract bytesToWrite bytes from the UBX file buffer and put them into myBuffer
|
||||||
|
|
||||||
myFile.write(myBuffer, bytesToWrite); // Write bytesToWrite bytes from myBuffer to the ubxDataFile on the SD card
|
myFile.write(myBuffer, bytesToWrite); // Write bytesToWrite bytes from myBuffer to the ubxDataFile on the SD card
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user