Skip to content

Commit bf24ef9

Browse files
committed
Update remaining data logging examples for Apollo3 v2
1 parent 2e0faf6 commit bf24ef9

File tree

6 files changed

+168
-33
lines changed

6 files changed

+168
-33
lines changed

Diff for: examples/Data_Logging/DataLoggingExample1_NAV_PVT/DataLoggingExample1_NAV_PVT.ino

+34-7
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Configuring the GNSS to automatically send NAV PVT reports over I2C and log them to file on SD card
33
By: Paul Clark
44
SparkFun Electronics
5-
Date: December 30th, 2020
5+
Date: October 18th, 2021
66
License: MIT. See license file for more information but you can
77
basically do whatever you want with this code.
88
@@ -22,8 +22,10 @@
2222
Insert a formatted micro-SD card into the socket on the Carrier Board.
2323
Connect the Carrier Board to your computer using a USB-C cable.
2424
Ensure you have the SparkFun Apollo3 boards installed: http://boardsmanager/All#SparkFun_Apollo3
25-
This code has been tested using version 1.2.1 of the Apollo3 boards on Arduino IDE 1.8.13.
26-
Select "SparkFun Artemis MicroMod" as the board type.
25+
This code has been tested using version 2.1.0 of the Apollo3 boards on Arduino IDE 1.8.13.
26+
- Version 2.1.1 of Apollo3 contains a feature which makes I2C communication with u-blox modules problematic
27+
- We recommend using v2.1.0 of Apollo3 until v2.2.0 is released
28+
Select "Artemis MicroMod Processor" as the board type.
2729
Press upload to upload the code onto the Artemis.
2830
Open the Serial Monitor at 115200 baud to see the output.
2931
@@ -51,7 +53,20 @@ SFE_UBLOX_GNSS myGNSS;
5153

5254
File myFile; //File that all GNSS data is written to
5355

54-
#define sdChipSelect CS //Primary SPI Chip Select is CS for the MicroMod Artemis Processor. Adjust for your processor if necessary.
56+
//Define the microSD (SPI) Chip Select pin. Adjust for your processor if necessary.
57+
#if defined(ARDUINO_ARCH_APOLLO3) // Check for SparkFun Apollo3 (Artemis) v1 or v2
58+
#if defined(ARDUINO_APOLLO3_SFE_ARTEMIS_MM_PB) // Check for the Artemis MicroMod Processor Board on Apollo3 v2
59+
#define sdChipSelect SPI_CS // SPI (microSD) Chip Select for the Artemis MicroMod Processor Board on Apollo3 v2
60+
#elif defined(ARDUINO_AM_AP3_SFE_ARTEMIS_MICROMOD) // Check for the Artemis MicroMod Processor Board on Apollo3 v1
61+
#define sdChipSelect CS // SPI (microSD) Chip Select for the Artemis MicroMod Processor Board on Apollo3 v1
62+
#else
63+
#define sdChipSelect CS // Catch-all for the other Artemis Boards - change this if required to match your hardware
64+
#endif
65+
#else
66+
67+
#define sdChipSelect CS // Catch-all for all non-Artemis boards - change this if required to match your hardware
68+
69+
#endif
5570

5671
#define packetLength 100 // NAV PVT is 92 + 8 bytes in length (including the sync chars, class, id, length and checksum bytes)
5772

@@ -107,8 +122,20 @@ void setup()
107122

108123
Wire.begin(); // Start I2C communication with the GNSS
109124

110-
#if defined(AM_PART_APOLLO3)
111-
Wire.setPullups(0); // On the Artemis, we can disable the internal I2C pull-ups too to help reduce bus errors
125+
// On the Artemis, we can disable the internal I2C pull-ups too to help reduce bus errors
126+
#if defined(AM_PART_APOLLO3) // Check for SparkFun Apollo3 (Artemis) v1
127+
Wire.setPullups(0); // Disable the internal I2C pull-ups on Apollo3 v1
128+
#elif defined(ARDUINO_ARCH_APOLLO3) // Else check for SparkFun Apollo3 (Artemis) (v2)
129+
#if defined(ARDUINO_APOLLO3_SFE_ARTEMIS_MM_PB) // Check for the Artemis MicroMod Processor Board on Apollo3 v2
130+
// On Apollo3 v2 we can still disable the pull-ups but we need to do it manually
131+
// The IOM and pin numbers here are specific to the Artemis MicroMod Processor Board
132+
am_hal_gpio_pincfg_t sclPinCfg = g_AM_BSP_GPIO_IOM4_SCL; // Artemis MicroMod Processor Board uses IOM4 for I2C communication
133+
am_hal_gpio_pincfg_t sdaPinCfg = g_AM_BSP_GPIO_IOM4_SDA;
134+
sclPinCfg.ePullup = AM_HAL_GPIO_PIN_PULLUP_NONE; // Disable the pull-ups
135+
sdaPinCfg.ePullup = AM_HAL_GPIO_PIN_PULLUP_NONE;
136+
pin_config(PinName(39), sclPinCfg); // Artemis MicroMod Processor Board uses Pin/Pad 39 for SCL
137+
pin_config(PinName(40), sdaPinCfg); // Artemis MicroMod Processor Board uses Pin/Pad 40 for SDA
138+
#endif
112139
#endif
113140

114141
while (Serial.available()) // Make sure the Serial buffer is empty
@@ -199,7 +226,7 @@ void loop()
199226
if (Serial.available()) // Check if the user wants to stop logging
200227
{
201228
myFile.close(); // Close the data file
202-
Serial.println(F("Logging stopped. Freezing..."));
229+
Serial.println(F("\r\nLogging stopped. Freezing..."));
203230
while(1); // Do nothing more
204231
}
205232

Diff for: examples/Data_Logging/DataLoggingExample2_TIM_TM2/DataLoggingExample2_TIM_TM2.ino

+34-7
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Configuring the GNSS to automatically send TIM TM2 reports over I2C and log them to file on SD card
33
By: Paul Clark
44
SparkFun Electronics
5-
Date: December 30th, 2020
5+
Date: October 18th, 2021
66
License: MIT. See license file for more information but you can
77
basically do whatever you want with this code.
88
@@ -22,8 +22,10 @@
2222
Insert a formatted micro-SD card into the socket on the Carrier Board.
2323
Connect the Carrier Board to your computer using a USB-C cable.
2424
Ensure you have the SparkFun Apollo3 boards installed: http://boardsmanager/All#SparkFun_Apollo3
25-
This code has been tested using version 1.2.1 of the Apollo3 boards on Arduino IDE 1.8.13.
26-
Select "SparkFun Artemis MicroMod" as the board type.
25+
This code has been tested using version 2.1.0 of the Apollo3 boards on Arduino IDE 1.8.13.
26+
- Version 2.1.1 of Apollo3 contains a feature which makes I2C communication with u-blox modules problematic
27+
- We recommend using v2.1.0 of Apollo3 until v2.2.0 is released
28+
Select "Artemis MicroMod Processor" as the board type.
2729
Press upload to upload the code onto the Artemis.
2830
Open the Serial Monitor at 115200 baud to see the output.
2931
@@ -64,7 +66,20 @@ SFE_UBLOX_GNSS myGNSS;
6466

6567
File myFile; //File that all GNSS data is written to
6668

67-
#define sdChipSelect CS //Primary SPI Chip Select is CS for the MicroMod Artemis Processor. Adjust for your processor if necessary.
69+
//Define the microSD (SPI) Chip Select pin. Adjust for your processor if necessary.
70+
#if defined(ARDUINO_ARCH_APOLLO3) // Check for SparkFun Apollo3 (Artemis) v1 or v2
71+
#if defined(ARDUINO_APOLLO3_SFE_ARTEMIS_MM_PB) // Check for the Artemis MicroMod Processor Board on Apollo3 v2
72+
#define sdChipSelect SPI_CS // SPI (microSD) Chip Select for the Artemis MicroMod Processor Board on Apollo3 v2
73+
#elif defined(ARDUINO_AM_AP3_SFE_ARTEMIS_MICROMOD) // Check for the Artemis MicroMod Processor Board on Apollo3 v1
74+
#define sdChipSelect CS // SPI (microSD) Chip Select for the Artemis MicroMod Processor Board on Apollo3 v1
75+
#else
76+
#define sdChipSelect CS // Catch-all for the other Artemis Boards - change this if required to match your hardware
77+
#endif
78+
#else
79+
80+
#define sdChipSelect CS // Catch-all for all non-Artemis boards - change this if required to match your hardware
81+
82+
#endif
6883

6984
#define packetLength 36 // TIM TM2 is 28 + 8 bytes in length (including the sync chars, class, id, length and checksum bytes)
7085

@@ -113,8 +128,20 @@ void setup()
113128

114129
Wire.begin(); // Start I2C communication with the GNSS
115130

116-
#if defined(AM_PART_APOLLO3)
117-
Wire.setPullups(0); // On the Artemis, we can disable the internal I2C pull-ups too to help reduce bus errors
131+
// On the Artemis, we can disable the internal I2C pull-ups too to help reduce bus errors
132+
#if defined(AM_PART_APOLLO3) // Check for SparkFun Apollo3 (Artemis) v1
133+
Wire.setPullups(0); // Disable the internal I2C pull-ups on Apollo3 v1
134+
#elif defined(ARDUINO_ARCH_APOLLO3) // Else check for SparkFun Apollo3 (Artemis) (v2)
135+
#if defined(ARDUINO_APOLLO3_SFE_ARTEMIS_MM_PB) // Check for the Artemis MicroMod Processor Board on Apollo3 v2
136+
// On Apollo3 v2 we can still disable the pull-ups but we need to do it manually
137+
// The IOM and pin numbers here are specific to the Artemis MicroMod Processor Board
138+
am_hal_gpio_pincfg_t sclPinCfg = g_AM_BSP_GPIO_IOM4_SCL; // Artemis MicroMod Processor Board uses IOM4 for I2C communication
139+
am_hal_gpio_pincfg_t sdaPinCfg = g_AM_BSP_GPIO_IOM4_SDA;
140+
sclPinCfg.ePullup = AM_HAL_GPIO_PIN_PULLUP_NONE; // Disable the pull-ups
141+
sdaPinCfg.ePullup = AM_HAL_GPIO_PIN_PULLUP_NONE;
142+
pin_config(PinName(39), sclPinCfg); // Artemis MicroMod Processor Board uses Pin/Pad 39 for SCL
143+
pin_config(PinName(40), sdaPinCfg); // Artemis MicroMod Processor Board uses Pin/Pad 40 for SDA
144+
#endif
118145
#endif
119146

120147
while (Serial.available()) // Make sure the Serial buffer is empty
@@ -205,7 +232,7 @@ void loop()
205232
if (Serial.available()) // Check if the user wants to stop logging
206233
{
207234
myFile.close(); // Close the data file
208-
Serial.println(F("Logging stopped. Freezing..."));
235+
Serial.println(F("\r\nLogging stopped. Freezing..."));
209236
while(1); // Do nothing more
210237
}
211238

Diff for: examples/Data_Logging/DataLoggingExample3_RXM_SFRBX_and_RAWX/DataLoggingExample3_RXM_SFRBX_and_RAWX.ino

+33-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Configuring the GNSS to automatically send RXM SFRBX and RAWX reports over I2C and log them to file on SD card
33
By: Paul Clark
44
SparkFun Electronics
5-
Date: December 30th, 2020
5+
Date: October 18th, 2021
66
License: MIT. See license file for more information but you can
77
basically do whatever you want with this code.
88
@@ -34,8 +34,10 @@
3434
Insert a formatted micro-SD card into the socket on the Carrier Board.
3535
Connect the Carrier Board to your computer using a USB-C cable.
3636
Ensure you have the SparkFun Apollo3 boards installed: http://boardsmanager/All#SparkFun_Apollo3
37-
This code has been tested using version 1.2.1 of the Apollo3 boards on Arduino IDE 1.8.13.
38-
Select "SparkFun Artemis MicroMod" as the board type.
37+
This code has been tested using version 2.1.0 of the Apollo3 boards on Arduino IDE 1.8.13.
38+
- Version 2.1.1 of Apollo3 contains a feature which makes I2C communication with u-blox modules problematic
39+
- We recommend using v2.1.0 of Apollo3 until v2.2.0 is released
40+
Select "Artemis MicroMod Processor" as the board type.
3941
Press upload to upload the code onto the Artemis.
4042
Open the Serial Monitor at 115200 baud to see the output.
4143
@@ -57,7 +59,20 @@ SFE_UBLOX_GNSS myGNSS;
5759

5860
File myFile; //File that all GNSS data is written to
5961

60-
#define sdChipSelect CS //Primary SPI Chip Select is CS for the MicroMod Artemis Processor. Adjust for your processor if necessary.
62+
//Define the microSD (SPI) Chip Select pin. Adjust for your processor if necessary.
63+
#if defined(ARDUINO_ARCH_APOLLO3) // Check for SparkFun Apollo3 (Artemis) v1 or v2
64+
#if defined(ARDUINO_APOLLO3_SFE_ARTEMIS_MM_PB) // Check for the Artemis MicroMod Processor Board on Apollo3 v2
65+
#define sdChipSelect SPI_CS // SPI (microSD) Chip Select for the Artemis MicroMod Processor Board on Apollo3 v2
66+
#elif defined(ARDUINO_AM_AP3_SFE_ARTEMIS_MICROMOD) // Check for the Artemis MicroMod Processor Board on Apollo3 v1
67+
#define sdChipSelect CS // SPI (microSD) Chip Select for the Artemis MicroMod Processor Board on Apollo3 v1
68+
#else
69+
#define sdChipSelect CS // Catch-all for the other Artemis Boards - change this if required to match your hardware
70+
#endif
71+
#else
72+
73+
#define sdChipSelect CS // Catch-all for all non-Artemis boards - change this if required to match your hardware
74+
75+
#endif
6176

6277
#define sdWriteSize 512 // Write data to the SD card in blocks of 512 bytes
6378
#define fileBufferSize 16384 // Allocate 16KBytes of RAM for UBX message storage
@@ -106,8 +121,20 @@ void setup()
106121

107122
Wire.begin(); // Start I2C communication
108123

109-
#if defined(AM_PART_APOLLO3)
110-
Wire.setPullups(0); // On the Artemis, we can disable the internal I2C pull-ups too to help reduce bus errors
124+
// On the Artemis, we can disable the internal I2C pull-ups too to help reduce bus errors
125+
#if defined(AM_PART_APOLLO3) // Check for SparkFun Apollo3 (Artemis) v1
126+
Wire.setPullups(0); // Disable the internal I2C pull-ups on Apollo3 v1
127+
#elif defined(ARDUINO_ARCH_APOLLO3) // Else check for SparkFun Apollo3 (Artemis) (v2)
128+
#if defined(ARDUINO_APOLLO3_SFE_ARTEMIS_MM_PB) // Check for the Artemis MicroMod Processor Board on Apollo3 v2
129+
// On Apollo3 v2 we can still disable the pull-ups but we need to do it manually
130+
// The IOM and pin numbers here are specific to the Artemis MicroMod Processor Board
131+
am_hal_gpio_pincfg_t sclPinCfg = g_AM_BSP_GPIO_IOM4_SCL; // Artemis MicroMod Processor Board uses IOM4 for I2C communication
132+
am_hal_gpio_pincfg_t sdaPinCfg = g_AM_BSP_GPIO_IOM4_SDA;
133+
sclPinCfg.ePullup = AM_HAL_GPIO_PIN_PULLUP_NONE; // Disable the pull-ups
134+
sdaPinCfg.ePullup = AM_HAL_GPIO_PIN_PULLUP_NONE;
135+
pin_config(PinName(39), sclPinCfg); // Artemis MicroMod Processor Board uses Pin/Pad 39 for SCL
136+
pin_config(PinName(40), sdaPinCfg); // Artemis MicroMod Processor Board uses Pin/Pad 40 for SDA
137+
#endif
111138
#endif
112139

113140
while (Serial.available()) // Make sure the Serial buffer is empty

Diff for: examples/Data_Logging/DataLoggingExample4_RXM_without_Callbacks/DataLoggingExample4_RXM_without_Callbacks.ino

+33-6
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
** without using callbacks **
44
By: Paul Clark
55
SparkFun Electronics
6-
Date: December 30th, 2020
6+
Date: October 18th, 2021
77
License: MIT. See license file for more information but you can
88
basically do whatever you want with this code.
99
@@ -35,8 +35,10 @@
3535
Insert a formatted micro-SD card into the socket on the Carrier Board.
3636
Connect the Carrier Board to your computer using a USB-C cable.
3737
Ensure you have the SparkFun Apollo3 boards installed: http://boardsmanager/All#SparkFun_Apollo3
38-
This code has been tested using version 1.2.1 of the Apollo3 boards on Arduino IDE 1.8.13.
39-
Select "SparkFun Artemis MicroMod" as the board type.
38+
This code has been tested using version 2.1.0 of the Apollo3 boards on Arduino IDE 1.8.13.
39+
- Version 2.1.1 of Apollo3 contains a feature which makes I2C communication with u-blox modules problematic
40+
- We recommend using v2.1.0 of Apollo3 until v2.2.0 is released
41+
Select "Artemis MicroMod Processor" as the board type.
4042
Press upload to upload the code onto the Artemis.
4143
Open the Serial Monitor at 115200 baud to see the output.
4244
@@ -58,7 +60,20 @@ SFE_UBLOX_GNSS myGNSS;
5860

5961
File myFile; //File that all GNSS data is written to
6062

61-
#define sdChipSelect CS //Primary SPI Chip Select is CS for the MicroMod Artemis Processor. Adjust for your processor if necessary.
63+
//Define the microSD (SPI) Chip Select pin. Adjust for your processor if necessary.
64+
#if defined(ARDUINO_ARCH_APOLLO3) // Check for SparkFun Apollo3 (Artemis) v1 or v2
65+
#if defined(ARDUINO_APOLLO3_SFE_ARTEMIS_MM_PB) // Check for the Artemis MicroMod Processor Board on Apollo3 v2
66+
#define sdChipSelect SPI_CS // SPI (microSD) Chip Select for the Artemis MicroMod Processor Board on Apollo3 v2
67+
#elif defined(ARDUINO_AM_AP3_SFE_ARTEMIS_MICROMOD) // Check for the Artemis MicroMod Processor Board on Apollo3 v1
68+
#define sdChipSelect CS // SPI (microSD) Chip Select for the Artemis MicroMod Processor Board on Apollo3 v1
69+
#else
70+
#define sdChipSelect CS // Catch-all for the other Artemis Boards - change this if required to match your hardware
71+
#endif
72+
#else
73+
74+
#define sdChipSelect CS // Catch-all for all non-Artemis boards - change this if required to match your hardware
75+
76+
#endif
6277

6378
#define sdWriteSize 512 // Write data to the SD card in blocks of 512 bytes
6479
#define fileBufferSize 16384 // Allocate 16KBytes of RAM for UBX message storage
@@ -77,8 +92,20 @@ void setup()
7792

7893
Wire.begin(); // Start I2C communication
7994

80-
#if defined(AM_PART_APOLLO3)
81-
Wire.setPullups(0); // On the Artemis, we can disable the internal I2C pull-ups too to help reduce bus errors
95+
// On the Artemis, we can disable the internal I2C pull-ups too to help reduce bus errors
96+
#if defined(AM_PART_APOLLO3) // Check for SparkFun Apollo3 (Artemis) v1
97+
Wire.setPullups(0); // Disable the internal I2C pull-ups on Apollo3 v1
98+
#elif defined(ARDUINO_ARCH_APOLLO3) // Else check for SparkFun Apollo3 (Artemis) (v2)
99+
#if defined(ARDUINO_APOLLO3_SFE_ARTEMIS_MM_PB) // Check for the Artemis MicroMod Processor Board on Apollo3 v2
100+
// On Apollo3 v2 we can still disable the pull-ups but we need to do it manually
101+
// The IOM and pin numbers here are specific to the Artemis MicroMod Processor Board
102+
am_hal_gpio_pincfg_t sclPinCfg = g_AM_BSP_GPIO_IOM4_SCL; // Artemis MicroMod Processor Board uses IOM4 for I2C communication
103+
am_hal_gpio_pincfg_t sdaPinCfg = g_AM_BSP_GPIO_IOM4_SDA;
104+
sclPinCfg.ePullup = AM_HAL_GPIO_PIN_PULLUP_NONE; // Disable the pull-ups
105+
sdaPinCfg.ePullup = AM_HAL_GPIO_PIN_PULLUP_NONE;
106+
pin_config(PinName(39), sclPinCfg); // Artemis MicroMod Processor Board uses Pin/Pad 39 for SCL
107+
pin_config(PinName(40), sdaPinCfg); // Artemis MicroMod Processor Board uses Pin/Pad 40 for SDA
108+
#endif
82109
#endif
83110

84111
while (Serial.available()) // Make sure the Serial buffer is empty

Diff for: examples/Data_Logging/DataLoggingExample5_Fast_RXM/DataLoggingExample5_Fast_RXM.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
This code has been tested using version 2.1.0 of the Apollo3 boards on Arduino IDE 1.8.13.
3939
- Version 2.1.1 of Apollo3 contains a feature which makes I2C communication with u-blox modules problematic
4040
- We recommend using v2.1.0 of Apollo3 until v2.2.0 is released
41-
Select "SparkFun Artemis MicroMod" as the board type.
41+
Select "Artemis MicroMod Processor" as the board type.
4242
Press upload to upload the code onto the Artemis.
4343
Open the Serial Monitor at 115200 baud to see the output.
4444

0 commit comments

Comments
 (0)