3
3
without using callbacks and ** as fast as your module can go! **
4
4
By: Paul Clark
5
5
SparkFun Electronics
6
- Date: December 30th, 2020
6
+ Date: October 18th, 2021
7
7
License: MIT. See license file for more information but you can
8
8
basically do whatever you want with this code.
9
9
35
35
Insert a formatted micro-SD card into the socket on the Carrier Board.
36
36
Connect the Carrier Board to your computer using a USB-C cable.
37
37
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.
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
39
41
Select "SparkFun Artemis MicroMod" as the board type.
40
42
Press upload to upload the code onto the Artemis.
41
43
Open the Serial Monitor at 115200 baud to see the output.
@@ -58,7 +60,20 @@ SFE_UBLOX_GNSS myGNSS;
58
60
59
61
File myFile; // File that all GNSS data is written to
60
62
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
62
77
63
78
#define sdWriteSize 512 // Write data to the SD card in blocks of 512 bytes
64
79
#define fileBufferSize 32768 // Allocate 32KBytes of RAM for UBX message storage
@@ -77,8 +92,20 @@ void setup()
77
92
78
93
Wire.begin (); // Start I2C communication
79
94
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
82
109
#endif
83
110
84
111
while (Serial.available ()) // Make sure the Serial buffer is empty
0 commit comments