From 9d32240c6781fef5cc0b95925365be59a76c78d8 Mon Sep 17 00:00:00 2001 From: PaulZC Date: Sun, 17 Oct 2021 14:20:17 +0100 Subject: [PATCH 1/4] Add repair file option to UBX_Integrity_Checker.py --- Utils/UBX_Integrity_Checker.py | 60 ++++++++++++++++++++++++++++++++-- 1 file changed, 58 insertions(+), 2 deletions(-) diff --git a/Utils/UBX_Integrity_Checker.py b/Utils/UBX_Integrity_Checker.py index 2fac318..a956881 100644 --- a/Utils/UBX_Integrity_Checker.py +++ b/Utils/UBX_Integrity_Checker.py @@ -1,10 +1,11 @@ # Checks the integrity of u-blox binary files # Written by: Paul Clark -# Last update: August 26th 2020 +# Last update: October 17th 2021 # Reads a UBX file and checks the integrity of both UBX and NMEA data # Will rewind and re-sync if an error is found +# Will create a repaired file if desired # SparkFun code, firmware, and software is released under the MIT License (http://opensource.org/licenses/MIT) # @@ -70,6 +71,17 @@ def csum(byte, sum1, sum2): else: containsNMEA = False +# Ask user if the file should be repaired +response = input('Do you want to repair the file? (y/N): ') # Get the response +if (response == '') or (response == 'N') or (response == 'n'): + repairFile = False +else: + repairFile = True + if (filename[-4] == '.'): + repairFilename = filename[:-4] + '.repair' + filename[-4:] + else: + repairFilename = filename + '.repair' + print() print('Processing',filename) print() @@ -81,7 +93,14 @@ def csum(byte, sum1, sum2): except: raise Exception('Invalid file!') -processed = -1 # The nunber of bytes processed +# Try to open repair file for writing +if (repairFile): + try: + fo = open(repairFilename,"wb") + except: + raise Exception('Could not open repair file!') + +processed = -1 # The number of bytes processed messages = {} # The collected message types longest = 0 # The length of the longest UBX message keepGoing = True @@ -137,6 +156,9 @@ def csum(byte, sum1, sum2): resync_in_progress = False # Flag to indicate if a resync is in progress message_start_byte = 0 # Record where the latest message started (for resync reporting) +rewind_repair_file_to = 0 # Keep a note of where to rewind the repair file to if sync is lost +repaired_file_bytes = 0 # Keep a note of how many bytes have been written to the repair file + try: while keepGoing: @@ -149,6 +171,11 @@ def csum(byte, sum1, sum2): processed = processed + 1 # Keep a record of how many bytes have been read and processed + # Write the byte to the repair file if desired + if (repairFile): + fo.write(fileBytes) + repaired_file_bytes = repaired_file_bytes + 1 + # Process data bytes according to ubx_nmea_state # For UBX messages: # Sync Char 1: 0xB5 @@ -267,6 +294,18 @@ def csum(byte, sum1, sum2): resyncs += 1 # Increment the number of successful resyncs print("Sync successfully re-established at byte "+str(processed)+". The UBX message started at byte "+str(message_start_byte)) print() + if (repairFile): + fo.seek(rewind_repair_file_to) # Rewind the repaired file + repaired_file_bytes = rewind_repair_file_to + fi.seek(message_start_byte) # Copy the valid message into the repair file + repaired_bytes_to_write = processed - message_start_byte + fileBytes = fi.read(repaired_bytes_to_write) + fo.write(fileBytes) + repaired_file_bytes = repaired_file_bytes + repaired_bytes_to_write + else: + if (repairFile): + rewind_repair_file_to = repaired_file_bytes # Rewind repair file to here if sync is lost + # NMEA messages elif (ubx_nmea_state == looking_for_asterix): nmea_length = nmea_length + 1 # Increase the message length count @@ -359,6 +398,17 @@ def csum(byte, sum1, sum2): resyncs += 1 # Increment the number of successful resyncs print("Sync successfully re-established at byte "+str(processed)+". The NMEA message started at byte "+str(message_start_byte)) print() + if (repairFile): + fo.seek(rewind_repair_file_to) # Rewind the repaired file + repaired_file_bytes = rewind_repair_file_to + fi.seek(message_start_byte) # Copy the valid message into the repair file + repaired_bytes_to_write = processed - message_start_byte + fileBytes = fi.read(repaired_bytes_to_write) + fo.write(fileBytes) + repaired_file_bytes = repaired_file_bytes + repaired_bytes_to_write + else: + if (repairFile): + rewind_repair_file_to = repaired_file_bytes # Rewind repair file to here if sync is lost # Check if the end of the file has been reached if (processed >= filesize - 1): keepGoing = False @@ -381,6 +431,9 @@ def csum(byte, sum1, sum2): finally: fi.close() # Close the file + if (repairFile): + fo.close() + # Print the file statistics print() processed += 1 @@ -396,4 +449,7 @@ def csum(byte, sum1, sum2): if (resyncs > 0): print('Number of successful resyncs:',resyncs) print() + if (repairFile): + print('Repaired data written to:', repairFilename) + print() print('Bye!') From 2e0faf6d3f1d512504e7b4721f5366c58b6ee31d Mon Sep 17 00:00:00 2001 From: PaulZC Date: Mon, 18 Oct 2021 11:44:01 +0100 Subject: [PATCH 2/4] Update DataLoggingExample5_Fast_RXM so it will run correctly on Apollo3 v2 --- .../DataLoggingExample5_Fast_RXM.ino | 37 ++++++++++++++++--- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/examples/Data_Logging/DataLoggingExample5_Fast_RXM/DataLoggingExample5_Fast_RXM.ino b/examples/Data_Logging/DataLoggingExample5_Fast_RXM/DataLoggingExample5_Fast_RXM.ino index 9a5881c..51ebbfa 100644 --- a/examples/Data_Logging/DataLoggingExample5_Fast_RXM/DataLoggingExample5_Fast_RXM.ino +++ b/examples/Data_Logging/DataLoggingExample5_Fast_RXM/DataLoggingExample5_Fast_RXM.ino @@ -3,7 +3,7 @@ without using callbacks and ** as fast as your module can go! ** By: Paul Clark SparkFun Electronics - Date: December 30th, 2020 + Date: October 18th, 2021 License: MIT. See license file for more information but you can basically do whatever you want with this code. @@ -35,7 +35,9 @@ 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. Ensure you have the SparkFun Apollo3 boards installed: http://boardsmanager/All#SparkFun_Apollo3 - This code has been tested using version 1.2.1 of the Apollo3 boards on Arduino IDE 1.8.13. + This code has been tested using version 2.1.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 "SparkFun Artemis MicroMod" as the board type. Press upload to upload the code onto the Artemis. Open the Serial Monitor at 115200 baud to see the output. @@ -58,7 +60,20 @@ SFE_UBLOX_GNSS myGNSS; File myFile; //File that all GNSS data is written to -#define sdChipSelect CS //Primary SPI Chip Select is CS for the MicroMod Artemis Processor. Adjust for your processor if necessary. +//Define the microSD (SPI) Chip Select pin. Adjust for your processor if necessary. +#if defined(ARDUINO_ARCH_APOLLO3) // Check for SparkFun Apollo3 (Artemis) v1 or v2 + #if defined(ARDUINO_APOLLO3_SFE_ARTEMIS_MM_PB) // Check for the Artemis MicroMod Processor Board on Apollo3 v2 + #define sdChipSelect SPI_CS // SPI (microSD) Chip Select for the Artemis MicroMod Processor Board on Apollo3 v2 + #elif defined(ARDUINO_AM_AP3_SFE_ARTEMIS_MICROMOD) // Check for the Artemis MicroMod Processor Board on Apollo3 v1 + #define sdChipSelect CS // SPI (microSD) Chip Select for the Artemis MicroMod Processor Board on Apollo3 v1 + #else + #define sdChipSelect CS // Catch-all for the other Artemis Boards - change this if required to match your hardware + #endif +#else + + #define sdChipSelect CS // Catch-all for all non-Artemis boards - change this if required to match your hardware + +#endif #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 @@ -77,8 +92,20 @@ void setup() Wire.begin(); // Start I2C communication -#if defined(AM_PART_APOLLO3) - Wire.setPullups(0); // On the Artemis, we can disable the internal I2C pull-ups too to help reduce bus errors +// On the Artemis, we can disable the internal I2C pull-ups too to help reduce bus errors +#if defined(AM_PART_APOLLO3) // Check for SparkFun Apollo3 (Artemis) v1 + Wire.setPullups(0); // Disable the internal I2C pull-ups on Apollo3 v1 +#elif defined(ARDUINO_ARCH_APOLLO3) // Else check for SparkFun Apollo3 (Artemis) (v2) + #if defined(ARDUINO_APOLLO3_SFE_ARTEMIS_MM_PB) // Check for the Artemis MicroMod Processor Board on Apollo3 v2 + // On Apollo3 v2 we can still disable the pull-ups but we need to do it manually + // The IOM and pin numbers here are specific to the Artemis MicroMod Processor Board + am_hal_gpio_pincfg_t sclPinCfg = g_AM_BSP_GPIO_IOM4_SCL; // Artemis MicroMod Processor Board uses IOM4 for I2C communication + am_hal_gpio_pincfg_t sdaPinCfg = g_AM_BSP_GPIO_IOM4_SDA; + sclPinCfg.ePullup = AM_HAL_GPIO_PIN_PULLUP_NONE; // Disable the pull-ups + sdaPinCfg.ePullup = AM_HAL_GPIO_PIN_PULLUP_NONE; + pin_config(PinName(39), sclPinCfg); // Artemis MicroMod Processor Board uses Pin/Pad 39 for SCL + pin_config(PinName(40), sdaPinCfg); // Artemis MicroMod Processor Board uses Pin/Pad 40 for SDA + #endif #endif while (Serial.available()) // Make sure the Serial buffer is empty From bf24ef9041401fb570fe5faa7b838abb00f1ea11 Mon Sep 17 00:00:00 2001 From: PaulZC Date: Mon, 18 Oct 2021 12:29:58 +0100 Subject: [PATCH 3/4] Update remaining data logging examples for Apollo3 v2 --- .../DataLoggingExample1_NAV_PVT.ino | 41 +++++++++++++++---- .../DataLoggingExample2_TIM_TM2.ino | 41 +++++++++++++++---- ...DataLoggingExample3_RXM_SFRBX_and_RAWX.ino | 39 +++++++++++++++--- ...aLoggingExample4_RXM_without_Callbacks.ino | 39 +++++++++++++++--- .../DataLoggingExample5_Fast_RXM.ino | 2 +- .../DataLoggingExample6_NMEA.ino | 39 +++++++++++++++--- 6 files changed, 168 insertions(+), 33 deletions(-) diff --git a/examples/Data_Logging/DataLoggingExample1_NAV_PVT/DataLoggingExample1_NAV_PVT.ino b/examples/Data_Logging/DataLoggingExample1_NAV_PVT/DataLoggingExample1_NAV_PVT.ino index 0f09f64..e214c42 100644 --- a/examples/Data_Logging/DataLoggingExample1_NAV_PVT/DataLoggingExample1_NAV_PVT.ino +++ b/examples/Data_Logging/DataLoggingExample1_NAV_PVT/DataLoggingExample1_NAV_PVT.ino @@ -2,7 +2,7 @@ Configuring the GNSS to automatically send NAV PVT reports over I2C and log them to file on SD card By: Paul Clark SparkFun Electronics - Date: December 30th, 2020 + Date: October 18th, 2021 License: MIT. See license file for more information but you can basically do whatever you want with this code. @@ -22,8 +22,10 @@ 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. Ensure you have the SparkFun Apollo3 boards installed: http://boardsmanager/All#SparkFun_Apollo3 - This code has been tested using version 1.2.1 of the Apollo3 boards on Arduino IDE 1.8.13. - Select "SparkFun Artemis MicroMod" as the board type. + This code has been tested using version 2.1.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. Press upload to upload the code onto the Artemis. Open the Serial Monitor at 115200 baud to see the output. @@ -51,7 +53,20 @@ SFE_UBLOX_GNSS myGNSS; File myFile; //File that all GNSS data is written to -#define sdChipSelect CS //Primary SPI Chip Select is CS for the MicroMod Artemis Processor. Adjust for your processor if necessary. +//Define the microSD (SPI) Chip Select pin. Adjust for your processor if necessary. +#if defined(ARDUINO_ARCH_APOLLO3) // Check for SparkFun Apollo3 (Artemis) v1 or v2 + #if defined(ARDUINO_APOLLO3_SFE_ARTEMIS_MM_PB) // Check for the Artemis MicroMod Processor Board on Apollo3 v2 + #define sdChipSelect SPI_CS // SPI (microSD) Chip Select for the Artemis MicroMod Processor Board on Apollo3 v2 + #elif defined(ARDUINO_AM_AP3_SFE_ARTEMIS_MICROMOD) // Check for the Artemis MicroMod Processor Board on Apollo3 v1 + #define sdChipSelect CS // SPI (microSD) Chip Select for the Artemis MicroMod Processor Board on Apollo3 v1 + #else + #define sdChipSelect CS // Catch-all for the other Artemis Boards - change this if required to match your hardware + #endif +#else + + #define sdChipSelect CS // Catch-all for all non-Artemis boards - change this if required to match your hardware + +#endif #define packetLength 100 // NAV PVT is 92 + 8 bytes in length (including the sync chars, class, id, length and checksum bytes) @@ -107,8 +122,20 @@ void setup() Wire.begin(); // Start I2C communication with the GNSS -#if defined(AM_PART_APOLLO3) - Wire.setPullups(0); // On the Artemis, we can disable the internal I2C pull-ups too to help reduce bus errors +// On the Artemis, we can disable the internal I2C pull-ups too to help reduce bus errors +#if defined(AM_PART_APOLLO3) // Check for SparkFun Apollo3 (Artemis) v1 + Wire.setPullups(0); // Disable the internal I2C pull-ups on Apollo3 v1 +#elif defined(ARDUINO_ARCH_APOLLO3) // Else check for SparkFun Apollo3 (Artemis) (v2) + #if defined(ARDUINO_APOLLO3_SFE_ARTEMIS_MM_PB) // Check for the Artemis MicroMod Processor Board on Apollo3 v2 + // On Apollo3 v2 we can still disable the pull-ups but we need to do it manually + // The IOM and pin numbers here are specific to the Artemis MicroMod Processor Board + am_hal_gpio_pincfg_t sclPinCfg = g_AM_BSP_GPIO_IOM4_SCL; // Artemis MicroMod Processor Board uses IOM4 for I2C communication + am_hal_gpio_pincfg_t sdaPinCfg = g_AM_BSP_GPIO_IOM4_SDA; + sclPinCfg.ePullup = AM_HAL_GPIO_PIN_PULLUP_NONE; // Disable the pull-ups + sdaPinCfg.ePullup = AM_HAL_GPIO_PIN_PULLUP_NONE; + pin_config(PinName(39), sclPinCfg); // Artemis MicroMod Processor Board uses Pin/Pad 39 for SCL + pin_config(PinName(40), sdaPinCfg); // Artemis MicroMod Processor Board uses Pin/Pad 40 for SDA + #endif #endif while (Serial.available()) // Make sure the Serial buffer is empty @@ -199,7 +226,7 @@ void loop() if (Serial.available()) // Check if the user wants to stop logging { myFile.close(); // Close the data file - Serial.println(F("Logging stopped. Freezing...")); + Serial.println(F("\r\nLogging stopped. Freezing...")); while(1); // Do nothing more } diff --git a/examples/Data_Logging/DataLoggingExample2_TIM_TM2/DataLoggingExample2_TIM_TM2.ino b/examples/Data_Logging/DataLoggingExample2_TIM_TM2/DataLoggingExample2_TIM_TM2.ino index 05417ae..a06084f 100644 --- a/examples/Data_Logging/DataLoggingExample2_TIM_TM2/DataLoggingExample2_TIM_TM2.ino +++ b/examples/Data_Logging/DataLoggingExample2_TIM_TM2/DataLoggingExample2_TIM_TM2.ino @@ -2,7 +2,7 @@ Configuring the GNSS to automatically send TIM TM2 reports over I2C and log them to file on SD card By: Paul Clark SparkFun Electronics - Date: December 30th, 2020 + Date: October 18th, 2021 License: MIT. See license file for more information but you can basically do whatever you want with this code. @@ -22,8 +22,10 @@ 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. Ensure you have the SparkFun Apollo3 boards installed: http://boardsmanager/All#SparkFun_Apollo3 - This code has been tested using version 1.2.1 of the Apollo3 boards on Arduino IDE 1.8.13. - Select "SparkFun Artemis MicroMod" as the board type. + This code has been tested using version 2.1.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. Press upload to upload the code onto the Artemis. Open the Serial Monitor at 115200 baud to see the output. @@ -64,7 +66,20 @@ SFE_UBLOX_GNSS myGNSS; File myFile; //File that all GNSS data is written to -#define sdChipSelect CS //Primary SPI Chip Select is CS for the MicroMod Artemis Processor. Adjust for your processor if necessary. +//Define the microSD (SPI) Chip Select pin. Adjust for your processor if necessary. +#if defined(ARDUINO_ARCH_APOLLO3) // Check for SparkFun Apollo3 (Artemis) v1 or v2 + #if defined(ARDUINO_APOLLO3_SFE_ARTEMIS_MM_PB) // Check for the Artemis MicroMod Processor Board on Apollo3 v2 + #define sdChipSelect SPI_CS // SPI (microSD) Chip Select for the Artemis MicroMod Processor Board on Apollo3 v2 + #elif defined(ARDUINO_AM_AP3_SFE_ARTEMIS_MICROMOD) // Check for the Artemis MicroMod Processor Board on Apollo3 v1 + #define sdChipSelect CS // SPI (microSD) Chip Select for the Artemis MicroMod Processor Board on Apollo3 v1 + #else + #define sdChipSelect CS // Catch-all for the other Artemis Boards - change this if required to match your hardware + #endif +#else + + #define sdChipSelect CS // Catch-all for all non-Artemis boards - change this if required to match your hardware + +#endif #define packetLength 36 // TIM TM2 is 28 + 8 bytes in length (including the sync chars, class, id, length and checksum bytes) @@ -113,8 +128,20 @@ void setup() Wire.begin(); // Start I2C communication with the GNSS -#if defined(AM_PART_APOLLO3) - Wire.setPullups(0); // On the Artemis, we can disable the internal I2C pull-ups too to help reduce bus errors +// On the Artemis, we can disable the internal I2C pull-ups too to help reduce bus errors +#if defined(AM_PART_APOLLO3) // Check for SparkFun Apollo3 (Artemis) v1 + Wire.setPullups(0); // Disable the internal I2C pull-ups on Apollo3 v1 +#elif defined(ARDUINO_ARCH_APOLLO3) // Else check for SparkFun Apollo3 (Artemis) (v2) + #if defined(ARDUINO_APOLLO3_SFE_ARTEMIS_MM_PB) // Check for the Artemis MicroMod Processor Board on Apollo3 v2 + // On Apollo3 v2 we can still disable the pull-ups but we need to do it manually + // The IOM and pin numbers here are specific to the Artemis MicroMod Processor Board + am_hal_gpio_pincfg_t sclPinCfg = g_AM_BSP_GPIO_IOM4_SCL; // Artemis MicroMod Processor Board uses IOM4 for I2C communication + am_hal_gpio_pincfg_t sdaPinCfg = g_AM_BSP_GPIO_IOM4_SDA; + sclPinCfg.ePullup = AM_HAL_GPIO_PIN_PULLUP_NONE; // Disable the pull-ups + sdaPinCfg.ePullup = AM_HAL_GPIO_PIN_PULLUP_NONE; + pin_config(PinName(39), sclPinCfg); // Artemis MicroMod Processor Board uses Pin/Pad 39 for SCL + pin_config(PinName(40), sdaPinCfg); // Artemis MicroMod Processor Board uses Pin/Pad 40 for SDA + #endif #endif while (Serial.available()) // Make sure the Serial buffer is empty @@ -205,7 +232,7 @@ void loop() if (Serial.available()) // Check if the user wants to stop logging { myFile.close(); // Close the data file - Serial.println(F("Logging stopped. Freezing...")); + Serial.println(F("\r\nLogging stopped. Freezing...")); while(1); // Do nothing more } diff --git a/examples/Data_Logging/DataLoggingExample3_RXM_SFRBX_and_RAWX/DataLoggingExample3_RXM_SFRBX_and_RAWX.ino b/examples/Data_Logging/DataLoggingExample3_RXM_SFRBX_and_RAWX/DataLoggingExample3_RXM_SFRBX_and_RAWX.ino index 952f840..6b0c286 100644 --- a/examples/Data_Logging/DataLoggingExample3_RXM_SFRBX_and_RAWX/DataLoggingExample3_RXM_SFRBX_and_RAWX.ino +++ b/examples/Data_Logging/DataLoggingExample3_RXM_SFRBX_and_RAWX/DataLoggingExample3_RXM_SFRBX_and_RAWX.ino @@ -2,7 +2,7 @@ Configuring the GNSS to automatically send RXM SFRBX and RAWX reports over I2C and log them to file on SD card By: Paul Clark SparkFun Electronics - Date: December 30th, 2020 + Date: October 18th, 2021 License: MIT. See license file for more information but you can basically do whatever you want with this code. @@ -34,8 +34,10 @@ 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. Ensure you have the SparkFun Apollo3 boards installed: http://boardsmanager/All#SparkFun_Apollo3 - This code has been tested using version 1.2.1 of the Apollo3 boards on Arduino IDE 1.8.13. - Select "SparkFun Artemis MicroMod" as the board type. + This code has been tested using version 2.1.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. Press upload to upload the code onto the Artemis. Open the Serial Monitor at 115200 baud to see the output. @@ -57,7 +59,20 @@ SFE_UBLOX_GNSS myGNSS; File myFile; //File that all GNSS data is written to -#define sdChipSelect CS //Primary SPI Chip Select is CS for the MicroMod Artemis Processor. Adjust for your processor if necessary. +//Define the microSD (SPI) Chip Select pin. Adjust for your processor if necessary. +#if defined(ARDUINO_ARCH_APOLLO3) // Check for SparkFun Apollo3 (Artemis) v1 or v2 + #if defined(ARDUINO_APOLLO3_SFE_ARTEMIS_MM_PB) // Check for the Artemis MicroMod Processor Board on Apollo3 v2 + #define sdChipSelect SPI_CS // SPI (microSD) Chip Select for the Artemis MicroMod Processor Board on Apollo3 v2 + #elif defined(ARDUINO_AM_AP3_SFE_ARTEMIS_MICROMOD) // Check for the Artemis MicroMod Processor Board on Apollo3 v1 + #define sdChipSelect CS // SPI (microSD) Chip Select for the Artemis MicroMod Processor Board on Apollo3 v1 + #else + #define sdChipSelect CS // Catch-all for the other Artemis Boards - change this if required to match your hardware + #endif +#else + + #define sdChipSelect CS // Catch-all for all non-Artemis boards - change this if required to match your hardware + +#endif #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 @@ -106,8 +121,20 @@ void setup() Wire.begin(); // Start I2C communication -#if defined(AM_PART_APOLLO3) - Wire.setPullups(0); // On the Artemis, we can disable the internal I2C pull-ups too to help reduce bus errors +// On the Artemis, we can disable the internal I2C pull-ups too to help reduce bus errors +#if defined(AM_PART_APOLLO3) // Check for SparkFun Apollo3 (Artemis) v1 + Wire.setPullups(0); // Disable the internal I2C pull-ups on Apollo3 v1 +#elif defined(ARDUINO_ARCH_APOLLO3) // Else check for SparkFun Apollo3 (Artemis) (v2) + #if defined(ARDUINO_APOLLO3_SFE_ARTEMIS_MM_PB) // Check for the Artemis MicroMod Processor Board on Apollo3 v2 + // On Apollo3 v2 we can still disable the pull-ups but we need to do it manually + // The IOM and pin numbers here are specific to the Artemis MicroMod Processor Board + am_hal_gpio_pincfg_t sclPinCfg = g_AM_BSP_GPIO_IOM4_SCL; // Artemis MicroMod Processor Board uses IOM4 for I2C communication + am_hal_gpio_pincfg_t sdaPinCfg = g_AM_BSP_GPIO_IOM4_SDA; + sclPinCfg.ePullup = AM_HAL_GPIO_PIN_PULLUP_NONE; // Disable the pull-ups + sdaPinCfg.ePullup = AM_HAL_GPIO_PIN_PULLUP_NONE; + pin_config(PinName(39), sclPinCfg); // Artemis MicroMod Processor Board uses Pin/Pad 39 for SCL + pin_config(PinName(40), sdaPinCfg); // Artemis MicroMod Processor Board uses Pin/Pad 40 for SDA + #endif #endif while (Serial.available()) // Make sure the Serial buffer is empty diff --git a/examples/Data_Logging/DataLoggingExample4_RXM_without_Callbacks/DataLoggingExample4_RXM_without_Callbacks.ino b/examples/Data_Logging/DataLoggingExample4_RXM_without_Callbacks/DataLoggingExample4_RXM_without_Callbacks.ino index 9e4737c..9391c25 100644 --- a/examples/Data_Logging/DataLoggingExample4_RXM_without_Callbacks/DataLoggingExample4_RXM_without_Callbacks.ino +++ b/examples/Data_Logging/DataLoggingExample4_RXM_without_Callbacks/DataLoggingExample4_RXM_without_Callbacks.ino @@ -3,7 +3,7 @@ ** without using callbacks ** By: Paul Clark SparkFun Electronics - Date: December 30th, 2020 + Date: October 18th, 2021 License: MIT. See license file for more information but you can basically do whatever you want with this code. @@ -35,8 +35,10 @@ 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. Ensure you have the SparkFun Apollo3 boards installed: http://boardsmanager/All#SparkFun_Apollo3 - This code has been tested using version 1.2.1 of the Apollo3 boards on Arduino IDE 1.8.13. - Select "SparkFun Artemis MicroMod" as the board type. + This code has been tested using version 2.1.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. Press upload to upload the code onto the Artemis. Open the Serial Monitor at 115200 baud to see the output. @@ -58,7 +60,20 @@ SFE_UBLOX_GNSS myGNSS; File myFile; //File that all GNSS data is written to -#define sdChipSelect CS //Primary SPI Chip Select is CS for the MicroMod Artemis Processor. Adjust for your processor if necessary. +//Define the microSD (SPI) Chip Select pin. Adjust for your processor if necessary. +#if defined(ARDUINO_ARCH_APOLLO3) // Check for SparkFun Apollo3 (Artemis) v1 or v2 + #if defined(ARDUINO_APOLLO3_SFE_ARTEMIS_MM_PB) // Check for the Artemis MicroMod Processor Board on Apollo3 v2 + #define sdChipSelect SPI_CS // SPI (microSD) Chip Select for the Artemis MicroMod Processor Board on Apollo3 v2 + #elif defined(ARDUINO_AM_AP3_SFE_ARTEMIS_MICROMOD) // Check for the Artemis MicroMod Processor Board on Apollo3 v1 + #define sdChipSelect CS // SPI (microSD) Chip Select for the Artemis MicroMod Processor Board on Apollo3 v1 + #else + #define sdChipSelect CS // Catch-all for the other Artemis Boards - change this if required to match your hardware + #endif +#else + + #define sdChipSelect CS // Catch-all for all non-Artemis boards - change this if required to match your hardware + +#endif #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 @@ -77,8 +92,20 @@ void setup() Wire.begin(); // Start I2C communication -#if defined(AM_PART_APOLLO3) - Wire.setPullups(0); // On the Artemis, we can disable the internal I2C pull-ups too to help reduce bus errors +// On the Artemis, we can disable the internal I2C pull-ups too to help reduce bus errors +#if defined(AM_PART_APOLLO3) // Check for SparkFun Apollo3 (Artemis) v1 + Wire.setPullups(0); // Disable the internal I2C pull-ups on Apollo3 v1 +#elif defined(ARDUINO_ARCH_APOLLO3) // Else check for SparkFun Apollo3 (Artemis) (v2) + #if defined(ARDUINO_APOLLO3_SFE_ARTEMIS_MM_PB) // Check for the Artemis MicroMod Processor Board on Apollo3 v2 + // On Apollo3 v2 we can still disable the pull-ups but we need to do it manually + // The IOM and pin numbers here are specific to the Artemis MicroMod Processor Board + am_hal_gpio_pincfg_t sclPinCfg = g_AM_BSP_GPIO_IOM4_SCL; // Artemis MicroMod Processor Board uses IOM4 for I2C communication + am_hal_gpio_pincfg_t sdaPinCfg = g_AM_BSP_GPIO_IOM4_SDA; + sclPinCfg.ePullup = AM_HAL_GPIO_PIN_PULLUP_NONE; // Disable the pull-ups + sdaPinCfg.ePullup = AM_HAL_GPIO_PIN_PULLUP_NONE; + pin_config(PinName(39), sclPinCfg); // Artemis MicroMod Processor Board uses Pin/Pad 39 for SCL + pin_config(PinName(40), sdaPinCfg); // Artemis MicroMod Processor Board uses Pin/Pad 40 for SDA + #endif #endif while (Serial.available()) // Make sure the Serial buffer is empty diff --git a/examples/Data_Logging/DataLoggingExample5_Fast_RXM/DataLoggingExample5_Fast_RXM.ino b/examples/Data_Logging/DataLoggingExample5_Fast_RXM/DataLoggingExample5_Fast_RXM.ino index 51ebbfa..1170997 100644 --- a/examples/Data_Logging/DataLoggingExample5_Fast_RXM/DataLoggingExample5_Fast_RXM.ino +++ b/examples/Data_Logging/DataLoggingExample5_Fast_RXM/DataLoggingExample5_Fast_RXM.ino @@ -38,7 +38,7 @@ This code has been tested using version 2.1.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 "SparkFun Artemis MicroMod" as the board type. + Select "Artemis MicroMod Processor" as the board type. Press upload to upload the code onto the Artemis. Open the Serial Monitor at 115200 baud to see the output. diff --git a/examples/Data_Logging/DataLoggingExample6_NMEA/DataLoggingExample6_NMEA.ino b/examples/Data_Logging/DataLoggingExample6_NMEA/DataLoggingExample6_NMEA.ino index fcf00c1..9feee04 100644 --- a/examples/Data_Logging/DataLoggingExample6_NMEA/DataLoggingExample6_NMEA.ino +++ b/examples/Data_Logging/DataLoggingExample6_NMEA/DataLoggingExample6_NMEA.ino @@ -2,7 +2,7 @@ Demonstrate how to log NMEA and UBX data simultaneously By: Paul Clark SparkFun Electronics - Date: April 13th, 2021 + Date: October 18th, 2021 License: MIT. See license file for more information but you can basically do whatever you want with this code. @@ -24,8 +24,10 @@ 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. Ensure you have the SparkFun Apollo3 boards installed: http://boardsmanager/All#SparkFun_Apollo3 - This code has been tested using version 1.2.1 of the Apollo3 boards on Arduino IDE 1.8.13. - Select "SparkFun Artemis MicroMod" as the board type. + This code has been tested using version 2.1.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. Press upload to upload the code onto the Artemis. Open the Serial Monitor at 115200 baud to see the output. @@ -49,7 +51,20 @@ SFE_UBLOX_GNSS myGNSS; File myFile; //File that all GNSS data is written to -#define sdChipSelect CS //Primary SPI Chip Select is CS for the MicroMod Artemis Processor. Adjust for your processor if necessary. +//Define the microSD (SPI) Chip Select pin. Adjust for your processor if necessary. +#if defined(ARDUINO_ARCH_APOLLO3) // Check for SparkFun Apollo3 (Artemis) v1 or v2 + #if defined(ARDUINO_APOLLO3_SFE_ARTEMIS_MM_PB) // Check for the Artemis MicroMod Processor Board on Apollo3 v2 + #define sdChipSelect SPI_CS // SPI (microSD) Chip Select for the Artemis MicroMod Processor Board on Apollo3 v2 + #elif defined(ARDUINO_AM_AP3_SFE_ARTEMIS_MICROMOD) // Check for the Artemis MicroMod Processor Board on Apollo3 v1 + #define sdChipSelect CS // SPI (microSD) Chip Select for the Artemis MicroMod Processor Board on Apollo3 v1 + #else + #define sdChipSelect CS // Catch-all for the other Artemis Boards - change this if required to match your hardware + #endif +#else + + #define sdChipSelect CS // Catch-all for all non-Artemis boards - change this if required to match your hardware + +#endif #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 @@ -68,8 +83,20 @@ void setup() Wire.begin(); // Start I2C communication -#if defined(AM_PART_APOLLO3) - Wire.setPullups(0); // On the Artemis, we can disable the internal I2C pull-ups too to help reduce bus errors +// On the Artemis, we can disable the internal I2C pull-ups too to help reduce bus errors +#if defined(AM_PART_APOLLO3) // Check for SparkFun Apollo3 (Artemis) v1 + Wire.setPullups(0); // Disable the internal I2C pull-ups on Apollo3 v1 +#elif defined(ARDUINO_ARCH_APOLLO3) // Else check for SparkFun Apollo3 (Artemis) (v2) + #if defined(ARDUINO_APOLLO3_SFE_ARTEMIS_MM_PB) // Check for the Artemis MicroMod Processor Board on Apollo3 v2 + // On Apollo3 v2 we can still disable the pull-ups but we need to do it manually + // The IOM and pin numbers here are specific to the Artemis MicroMod Processor Board + am_hal_gpio_pincfg_t sclPinCfg = g_AM_BSP_GPIO_IOM4_SCL; // Artemis MicroMod Processor Board uses IOM4 for I2C communication + am_hal_gpio_pincfg_t sdaPinCfg = g_AM_BSP_GPIO_IOM4_SDA; + sclPinCfg.ePullup = AM_HAL_GPIO_PIN_PULLUP_NONE; // Disable the pull-ups + sdaPinCfg.ePullup = AM_HAL_GPIO_PIN_PULLUP_NONE; + pin_config(PinName(39), sclPinCfg); // Artemis MicroMod Processor Board uses Pin/Pad 39 for SCL + pin_config(PinName(40), sdaPinCfg); // Artemis MicroMod Processor Board uses Pin/Pad 40 for SDA + #endif #endif while (Serial.available()) // Make sure the Serial buffer is empty From c80212e105c522ce796e4a2f124d21ed9be71970 Mon Sep 17 00:00:00 2001 From: PaulZC Date: Mon, 18 Oct 2021 12:30:47 +0100 Subject: [PATCH 4/4] v2.0.16 --- library.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library.properties b/library.properties index 4701fa8..912bc3a 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=SparkFun u-blox GNSS Arduino Library -version=2.0.15 +version=2.0.16 author=SparkFun Electronics maintainer=SparkFun Electronics sentence=Library for I2C and Serial Communication with u-blox GNSS modules