From 69d259b37d01aefb018d5decc8412b5ae5a3dcdb Mon Sep 17 00:00:00 2001 From: JR Date: Mon, 9 Sep 2024 16:22:31 +0200 Subject: [PATCH] Use digital pin for IMU powering on off --- .../INFO_compilation_output.txt | 70 ------------------- .../INFO_compilation_output_lib_infos.txt | 70 ------------------- .../README.md | 10 +-- .../TODOs.txt | 6 -- .../board_control.cpp | 16 ++--- .../board_control.h | 4 +- .../imu_manager.cpp | 11 --- .../imu_manager.h | 1 - .../params.cpp | 1 + .../params.h | 2 + 10 files changed, 18 insertions(+), 173 deletions(-) delete mode 100644 legacy_firmware/firmware/steval_gps_waves_pcbtraces_2ways_noqwiicswitch/INFO_compilation_output.txt delete mode 100644 legacy_firmware/firmware/steval_gps_waves_pcbtraces_2ways_noqwiicswitch/INFO_compilation_output_lib_infos.txt delete mode 100644 legacy_firmware/firmware/steval_gps_waves_pcbtraces_2ways_noqwiicswitch/TODOs.txt diff --git a/legacy_firmware/firmware/steval_gps_waves_pcbtraces_2ways_noqwiicswitch/INFO_compilation_output.txt b/legacy_firmware/firmware/steval_gps_waves_pcbtraces_2ways_noqwiicswitch/INFO_compilation_output.txt deleted file mode 100644 index fd25a13..0000000 --- a/legacy_firmware/firmware/steval_gps_waves_pcbtraces_2ways_noqwiicswitch/INFO_compilation_output.txt +++ /dev/null @@ -1,70 +0,0 @@ -Using board 'artemis' from platform in folder: /home/jrmet/.arduino15/packages/SparkFun/hardware/apollo3/1.2.1 -Using core 'arduino' from platform in folder: /home/jrmet/.arduino15/packages/SparkFun/hardware/apollo3/1.2.1 - -Detecting libraries used... -Alternatives for WDT.h: [WDT@0.1] -ResolveLibrary(WDT.h) - -> candidates: [WDT@0.1] -Alternatives for TimeLib.h: [Time@1.6] -ResolveLibrary(TimeLib.h) - -> candidates: [Time@1.6] -Alternatives for etl.h: [etl@19.3.9] -ResolveLibrary(etl.h) - -> candidates: [etl@19.3.9] -Alternatives for Wire.h: [Wire@1.0] -ResolveLibrary(Wire.h) - -> candidates: [Wire@1.0] -Alternatives for SparkFun_Qwiic_Power_Switch_Arduino_Library.h: [SparkFun_Qwiic_Power_Switch_Arduino_Library@1.0.0] -ResolveLibrary(SparkFun_Qwiic_Power_Switch_Arduino_Library.h) - -> candidates: [SparkFun_Qwiic_Power_Switch_Arduino_Library@1.0.0] -Alternatives for SparkFun_u-blox_GNSS_Arduino_Library.h: [SparkFun_u-blox_GNSS_Arduino_Library@2.0.2] -ResolveLibrary(SparkFun_u-blox_GNSS_Arduino_Library.h) - -> candidates: [SparkFun_u-blox_GNSS_Arduino_Library@2.0.2] -Alternatives for IridiumSBD.h: [Iridium_SBD@2.0 IridiumSBDi2c@3.0.1] -ResolveLibrary(IridiumSBD.h) - -> candidates: [Iridium_SBD@2.0 IridiumSBDi2c@3.0.1] -Alternatives for Adafruit_ISM330DHCX.h: [Adafruit_LSM6DS@4.2.0] -ResolveLibrary(Adafruit_ISM330DHCX.h) - -> candidates: [Adafruit_LSM6DS@4.2.0] -Alternatives for Adafruit_BusIO_Register.h: [Adafruit_BusIO@1.7.2] -ResolveLibrary(Adafruit_BusIO_Register.h) - -> candidates: [Adafruit_BusIO@1.7.2] -Alternatives for SPI.h: [SPI@1.0] -ResolveLibrary(SPI.h) - -> candidates: [SPI@1.0] -Alternatives for Adafruit_Sensor.h: [Adafruit_Sensor@1.1.4] -ResolveLibrary(Adafruit_Sensor.h) - -> candidates: [Adafruit_Sensor@1.1.4] -Alternatives for Adafruit_LIS3MDL.h: [Adafruit_LIS3MDL@1.0.7] -ResolveLibrary(Adafruit_LIS3MDL.h) - -> candidates: [Adafruit_LIS3MDL@1.0.7] -Alternatives for Adafruit_AHRS.h: [Adafruit_AHRS@2.2.4] -ResolveLibrary(Adafruit_AHRS.h) - -> candidates: [Adafruit_AHRS@2.2.4] -Alternatives for OneWire.h: [OneWire@2.3.5 OneWireNg@0.8.2] -ResolveLibrary(OneWire.h) - -> candidates: [OneWire@2.3.5 OneWireNg@0.8.2] - -Multiple libraries were found for "OneWire.h" - Used: /home/jrmet/Arduino/libraries/OneWire - Not used: /home/jrmet/Arduino/libraries/OneWireNg -Multiple libraries were found for "IridiumSBD.h" - Used: /home/jrmet/Arduino/libraries/IridiumSBDi2c - Not used: /home/jrmet/Arduino/libraries/Iridium_SBD -Using library WDT at version 0.1 in folder: /home/jrmet/.arduino15/packages/SparkFun/hardware/apollo3/1.2.1/libraries/WDT -Using library Time at version 1.6 in folder: /home/jrmet/Arduino/libraries/Time -Using library etl at version 19.3.9 in folder: /home/jrmet/Arduino/libraries/etl -Using library Wire at version 1.0 in folder: /home/jrmet/.arduino15/packages/SparkFun/hardware/apollo3/1.2.1/libraries/Wire -Using library SparkFun_Qwiic_Power_Switch_Arduino_Library at version 1.0.0 in folder: /home/jrmet/Arduino/libraries/SparkFun_Qwiic_Power_Switch_Arduino_Library -Using library SparkFun_u-blox_GNSS_Arduino_Library at version 2.0.2 in folder: /home/jrmet/Arduino/libraries/SparkFun_u-blox_GNSS_Arduino_Library -Using library IridiumSBDi2c at version 3.0.1 in folder: /home/jrmet/Arduino/libraries/IridiumSBDi2c -Using library Adafruit_LSM6DS at version 4.2.0 in folder: /home/jrmet/Arduino/libraries/Adafruit_LSM6DS -Using library Adafruit_BusIO at version 1.7.2 in folder: /home/jrmet/Arduino/libraries/Adafruit_BusIO -Using library SPI at version 1.0 in folder: /home/jrmet/.arduino15/packages/SparkFun/hardware/apollo3/1.2.1/libraries/SPI -Using library Adafruit_Sensor at version 1.1.4 in folder: /home/jrmet/Arduino/libraries/Adafruit_Sensor -Using library Adafruit_LIS3MDL at version 1.0.7 in folder: /home/jrmet/Arduino/libraries/Adafruit_LIS3MDL -Using library Adafruit_AHRS at version 2.2.4 in folder: /home/jrmet/Arduino/libraries/Adafruit_AHRS -Using library OneWire at version 2.3.5 in folder: /home/jrmet/Arduino/libraries/OneWire - -Sketch uses 124968 bytes (13%) of program storage space. Maximum is 960000 bytes. -Global variables use 158460 bytes of dynamic memory. diff --git a/legacy_firmware/firmware/steval_gps_waves_pcbtraces_2ways_noqwiicswitch/INFO_compilation_output_lib_infos.txt b/legacy_firmware/firmware/steval_gps_waves_pcbtraces_2ways_noqwiicswitch/INFO_compilation_output_lib_infos.txt deleted file mode 100644 index fd25a13..0000000 --- a/legacy_firmware/firmware/steval_gps_waves_pcbtraces_2ways_noqwiicswitch/INFO_compilation_output_lib_infos.txt +++ /dev/null @@ -1,70 +0,0 @@ -Using board 'artemis' from platform in folder: /home/jrmet/.arduino15/packages/SparkFun/hardware/apollo3/1.2.1 -Using core 'arduino' from platform in folder: /home/jrmet/.arduino15/packages/SparkFun/hardware/apollo3/1.2.1 - -Detecting libraries used... -Alternatives for WDT.h: [WDT@0.1] -ResolveLibrary(WDT.h) - -> candidates: [WDT@0.1] -Alternatives for TimeLib.h: [Time@1.6] -ResolveLibrary(TimeLib.h) - -> candidates: [Time@1.6] -Alternatives for etl.h: [etl@19.3.9] -ResolveLibrary(etl.h) - -> candidates: [etl@19.3.9] -Alternatives for Wire.h: [Wire@1.0] -ResolveLibrary(Wire.h) - -> candidates: [Wire@1.0] -Alternatives for SparkFun_Qwiic_Power_Switch_Arduino_Library.h: [SparkFun_Qwiic_Power_Switch_Arduino_Library@1.0.0] -ResolveLibrary(SparkFun_Qwiic_Power_Switch_Arduino_Library.h) - -> candidates: [SparkFun_Qwiic_Power_Switch_Arduino_Library@1.0.0] -Alternatives for SparkFun_u-blox_GNSS_Arduino_Library.h: [SparkFun_u-blox_GNSS_Arduino_Library@2.0.2] -ResolveLibrary(SparkFun_u-blox_GNSS_Arduino_Library.h) - -> candidates: [SparkFun_u-blox_GNSS_Arduino_Library@2.0.2] -Alternatives for IridiumSBD.h: [Iridium_SBD@2.0 IridiumSBDi2c@3.0.1] -ResolveLibrary(IridiumSBD.h) - -> candidates: [Iridium_SBD@2.0 IridiumSBDi2c@3.0.1] -Alternatives for Adafruit_ISM330DHCX.h: [Adafruit_LSM6DS@4.2.0] -ResolveLibrary(Adafruit_ISM330DHCX.h) - -> candidates: [Adafruit_LSM6DS@4.2.0] -Alternatives for Adafruit_BusIO_Register.h: [Adafruit_BusIO@1.7.2] -ResolveLibrary(Adafruit_BusIO_Register.h) - -> candidates: [Adafruit_BusIO@1.7.2] -Alternatives for SPI.h: [SPI@1.0] -ResolveLibrary(SPI.h) - -> candidates: [SPI@1.0] -Alternatives for Adafruit_Sensor.h: [Adafruit_Sensor@1.1.4] -ResolveLibrary(Adafruit_Sensor.h) - -> candidates: [Adafruit_Sensor@1.1.4] -Alternatives for Adafruit_LIS3MDL.h: [Adafruit_LIS3MDL@1.0.7] -ResolveLibrary(Adafruit_LIS3MDL.h) - -> candidates: [Adafruit_LIS3MDL@1.0.7] -Alternatives for Adafruit_AHRS.h: [Adafruit_AHRS@2.2.4] -ResolveLibrary(Adafruit_AHRS.h) - -> candidates: [Adafruit_AHRS@2.2.4] -Alternatives for OneWire.h: [OneWire@2.3.5 OneWireNg@0.8.2] -ResolveLibrary(OneWire.h) - -> candidates: [OneWire@2.3.5 OneWireNg@0.8.2] - -Multiple libraries were found for "OneWire.h" - Used: /home/jrmet/Arduino/libraries/OneWire - Not used: /home/jrmet/Arduino/libraries/OneWireNg -Multiple libraries were found for "IridiumSBD.h" - Used: /home/jrmet/Arduino/libraries/IridiumSBDi2c - Not used: /home/jrmet/Arduino/libraries/Iridium_SBD -Using library WDT at version 0.1 in folder: /home/jrmet/.arduino15/packages/SparkFun/hardware/apollo3/1.2.1/libraries/WDT -Using library Time at version 1.6 in folder: /home/jrmet/Arduino/libraries/Time -Using library etl at version 19.3.9 in folder: /home/jrmet/Arduino/libraries/etl -Using library Wire at version 1.0 in folder: /home/jrmet/.arduino15/packages/SparkFun/hardware/apollo3/1.2.1/libraries/Wire -Using library SparkFun_Qwiic_Power_Switch_Arduino_Library at version 1.0.0 in folder: /home/jrmet/Arduino/libraries/SparkFun_Qwiic_Power_Switch_Arduino_Library -Using library SparkFun_u-blox_GNSS_Arduino_Library at version 2.0.2 in folder: /home/jrmet/Arduino/libraries/SparkFun_u-blox_GNSS_Arduino_Library -Using library IridiumSBDi2c at version 3.0.1 in folder: /home/jrmet/Arduino/libraries/IridiumSBDi2c -Using library Adafruit_LSM6DS at version 4.2.0 in folder: /home/jrmet/Arduino/libraries/Adafruit_LSM6DS -Using library Adafruit_BusIO at version 1.7.2 in folder: /home/jrmet/Arduino/libraries/Adafruit_BusIO -Using library SPI at version 1.0 in folder: /home/jrmet/.arduino15/packages/SparkFun/hardware/apollo3/1.2.1/libraries/SPI -Using library Adafruit_Sensor at version 1.1.4 in folder: /home/jrmet/Arduino/libraries/Adafruit_Sensor -Using library Adafruit_LIS3MDL at version 1.0.7 in folder: /home/jrmet/Arduino/libraries/Adafruit_LIS3MDL -Using library Adafruit_AHRS at version 2.2.4 in folder: /home/jrmet/Arduino/libraries/Adafruit_AHRS -Using library OneWire at version 2.3.5 in folder: /home/jrmet/Arduino/libraries/OneWire - -Sketch uses 124968 bytes (13%) of program storage space. Maximum is 960000 bytes. -Global variables use 158460 bytes of dynamic memory. diff --git a/legacy_firmware/firmware/steval_gps_waves_pcbtraces_2ways_noqwiicswitch/README.md b/legacy_firmware/firmware/steval_gps_waves_pcbtraces_2ways_noqwiicswitch/README.md index 3ee00da..b0ccd5b 100644 --- a/legacy_firmware/firmware/steval_gps_waves_pcbtraces_2ways_noqwiicswitch/README.md +++ b/legacy_firmware/firmware/steval_gps_waves_pcbtraces_2ways_noqwiicswitch/README.md @@ -1,5 +1,7 @@ # About this branch -This is the version to use for JARE deployments + +This is the version to use for JARE deployments. +This is updated to work without the qwiic switch. Instead of using the qwiic switch to power the IMU on and off, we use a digital pin with 12mA sourcing strength that we turn on and off. Note that the "qwiic" name still appears in the code (for example, turn_qwiic_switch_on), but this is only for historical reasons: the corresponding code just turns the pin HIGH and LOW. # Getting the code to compile and upload @@ -60,9 +62,7 @@ Switched to a new branch 'fix/SPI_with_Artemis' - Artemis Global Tracker - Iridium and GNSS passive antenna - SMA extension cable -- Qwiic switch - Adafruit 9-dof (Adafruit ISM330DHCX + LIS3MDL FeatherWing - High Precision 9-DoF IMU, PRODUCT ID: 4569) -- 2 Qwiic cables - LSH20 cells, 3 in parallel - pololu 3.3V step up step down regulator @@ -74,9 +74,9 @@ Switched to a new branch 'fix/SPI_with_Artemis' ## Assembly - connect AGT - SMA extender - antenna -- connect AGT Qwiic - Qwiic switch in - Qwiic switch out - Adafruit 9 dof +- connect IMUPwr pin (see definition in the code) to the 3.3V Vin of the IMU, and SCL / SDA from the IMU to the corresponding pins for the I2C port chosen on the AGT - solder battery - 3.3V regulator - 3.3V pin -- cut the LED enable traces on the AGT (```PWR_LED```) and Qwiich switch (```LED_IN``` and ```LED_OUT```) +- cut the LED enable traces on the AGT (```PWR_LED```) # Operating notes diff --git a/legacy_firmware/firmware/steval_gps_waves_pcbtraces_2ways_noqwiicswitch/TODOs.txt b/legacy_firmware/firmware/steval_gps_waves_pcbtraces_2ways_noqwiicswitch/TODOs.txt deleted file mode 100644 index 50f7a45..0000000 --- a/legacy_firmware/firmware/steval_gps_waves_pcbtraces_2ways_noqwiicswitch/TODOs.txt +++ /dev/null @@ -1,6 +0,0 @@ - -- for now, take a thermistor measurement each time a GNSS measurement is performed; could be changed if needed: use a "time to thermistor" test function and call then - -- abtract the logics of writing messages to the iridium tx buffer -- abstract the logics of transmitting at least a given number of packets - diff --git a/legacy_firmware/firmware/steval_gps_waves_pcbtraces_2ways_noqwiicswitch/board_control.cpp b/legacy_firmware/firmware/steval_gps_waves_pcbtraces_2ways_noqwiicswitch/board_control.cpp index f6056f8..85d4406 100644 --- a/legacy_firmware/firmware/steval_gps_waves_pcbtraces_2ways_noqwiicswitch/board_control.cpp +++ b/legacy_firmware/firmware/steval_gps_waves_pcbtraces_2ways_noqwiicswitch/board_control.cpp @@ -1,7 +1,6 @@ #include "board_control.h" TwoWire ArtemisWire(i2c_port_number); -QWIIC_POWER qwiic_switch; void blink_LED_n_times(unsigned int number_of_blinks, float frequency_hz){ wdt.restart(); // we choose to restart at the start and end, but not in loop as a way to make sure not so much blinking that we freeze. @@ -23,6 +22,9 @@ void blink_LED_n_times(unsigned int number_of_blinks, float frequency_hz){ void setup_pins(void){ pinMode(LED, OUTPUT); // Make the LED pin an output + // make the IMUPwr pin an output + pinMode(IMUPwr, g_AM_HAL_GPIO_OUTPUT_12); // enable 12mA output + turn_gnss_off(); // Disable power for the GNSS pinMode(geofencePin, INPUT); // Configure the geofence pin as an input @@ -80,19 +82,17 @@ void turn_iridium_off(void){ void turn_qwiic_switch_off(void){ Serial.println(F("turn qwiic switch off")); - qwiic_switch.pinMode(1, INPUT); - qwiic_switch.pinMode(2, INPUT); - delay(50); - qwiic_switch.powerOff(); + pinMode(IMUPwr, g_AM_HAL_GPIO_OUTPUT_12); // enable 12mA output + digitalWrite(IMUPwr, LOW); + // NOTE: maybe we also need to put the I2C SCL SDA to INPUT to avoid crosstalks and power wasting? delay(100); } void turn_qwiic_switch_on(void){ Serial.println(F("turn qwiic switch on")); - qwiic_switch.powerOn(); + pinMode(IMUPwr, g_AM_HAL_GPIO_OUTPUT_12); // enable 12mA output + digitalWrite(IMUPwr, HIGH); delay(50); - qwiic_switch.pinMode(1, INPUT); - qwiic_switch.pinMode(2, INPUT); } void turn_thermistors_on(void){ diff --git a/legacy_firmware/firmware/steval_gps_waves_pcbtraces_2ways_noqwiicswitch/board_control.h b/legacy_firmware/firmware/steval_gps_waves_pcbtraces_2ways_noqwiicswitch/board_control.h index 21dcf91..a682eae 100644 --- a/legacy_firmware/firmware/steval_gps_waves_pcbtraces_2ways_noqwiicswitch/board_control.h +++ b/legacy_firmware/firmware/steval_gps_waves_pcbtraces_2ways_noqwiicswitch/board_control.h @@ -6,9 +6,9 @@ #include "params.h" #include "watchdog_manager.h" #include "sleep_manager.h" +#include "params.h" #include "Wire.h" -#include //-------------------------------------------------------------------------------- // Artemis Tracker pin definitions @@ -57,6 +57,7 @@ void blink_LED_n_times(unsigned int number_of_blinks, float frequency_hz=1.0); //-------------------------------------------------------------------------------- // functions to save power on the Qwiic switch +// we do not rename these, but in practice this is now using the pinmode, not qwiic void turn_qwiic_switch_on(void); @@ -73,6 +74,5 @@ void turn_thermistors_off(void); //making the ArtemisWire Qwiic port and Qwiic switch available to all extern TwoWire ArtemisWire; -extern QWIIC_POWER qwiic_switch; #endif diff --git a/legacy_firmware/firmware/steval_gps_waves_pcbtraces_2ways_noqwiicswitch/imu_manager.cpp b/legacy_firmware/firmware/steval_gps_waves_pcbtraces_2ways_noqwiicswitch/imu_manager.cpp index 9fea391..3c2ef4b 100644 --- a/legacy_firmware/firmware/steval_gps_waves_pcbtraces_2ways_noqwiicswitch/imu_manager.cpp +++ b/legacy_firmware/firmware/steval_gps_waves_pcbtraces_2ways_noqwiicswitch/imu_manager.cpp @@ -22,11 +22,6 @@ bool IMU_Manager::start_IMU(){ wdt.restart(); Serial.println(F("started ArtemisWire")); - Serial.println(F("start qwiic switch")); - if (qwiic_switch.begin(ArtemisWire) == false){ - Serial.println(F("Qwiic Power Switch not detected at default I2C address. Please check wiring. Freezing.")); - while (true){;} - } turn_qwiic_switch_off(); delay(500); wdt.restart(); @@ -34,12 +29,6 @@ bool IMU_Manager::start_IMU(){ // TODO: instead of hang, return false... turn_qwiic_switch_on(); - // configure the power switch - turn_qwiic_switch_on(); - qwiic_switch.isolationOff(); - delay(500); - wdt.restart(); - Serial.println("Adafruit ISM330DHCX start!"); while (true){ if (!ism330dhcx.begin_I2C(LSM6DS_I2CADDR_DEFAULT, diff --git a/legacy_firmware/firmware/steval_gps_waves_pcbtraces_2ways_noqwiicswitch/imu_manager.h b/legacy_firmware/firmware/steval_gps_waves_pcbtraces_2ways_noqwiicswitch/imu_manager.h index 1fe42ff..a18e77d 100644 --- a/legacy_firmware/firmware/steval_gps_waves_pcbtraces_2ways_noqwiicswitch/imu_manager.h +++ b/legacy_firmware/firmware/steval_gps_waves_pcbtraces_2ways_noqwiicswitch/imu_manager.h @@ -118,7 +118,6 @@ class IMU_Manager{ int counter_nbr_cycles_LED_off {0}; }; -extern QWIIC_POWER mySwitch; extern Adafruit_ISM330DHCX ism330dhcx; //extern Adafruit_LIS3MDL lis3mdl; extern Adafruit_NXPSensorFusion Kalman_filter; diff --git a/legacy_firmware/firmware/steval_gps_waves_pcbtraces_2ways_noqwiicswitch/params.cpp b/legacy_firmware/firmware/steval_gps_waves_pcbtraces_2ways_noqwiicswitch/params.cpp index ac7e068..d1990ad 100644 --- a/legacy_firmware/firmware/steval_gps_waves_pcbtraces_2ways_noqwiicswitch/params.cpp +++ b/legacy_firmware/firmware/steval_gps_waves_pcbtraces_2ways_noqwiicswitch/params.cpp @@ -3,6 +3,7 @@ void print_params(void){ Serial.print(F("baudrate_debug_serial : ")); Serial.println(baudrate_debug_serial ); Serial.print(F("i2c_port_number: ")); Serial.println(i2c_port_number ); + Serial.print(F("IMU power pin: ")); Serial.println(IMUPwr); Serial.println(F("----- TEST_MODE -----")); Serial.print(F("DEPLOYMENT_MODE: ")); Serial.println(DEPLOYMENT_MODE); diff --git a/legacy_firmware/firmware/steval_gps_waves_pcbtraces_2ways_noqwiicswitch/params.h b/legacy_firmware/firmware/steval_gps_waves_pcbtraces_2ways_noqwiicswitch/params.h index 3ecbcf4..a1febeb 100644 --- a/legacy_firmware/firmware/steval_gps_waves_pcbtraces_2ways_noqwiicswitch/params.h +++ b/legacy_firmware/firmware/steval_gps_waves_pcbtraces_2ways_noqwiicswitch/params.h @@ -14,6 +14,8 @@ constexpr int i2c_port_number {1}; // for using the I2C port corresponding to the Qwiic connector // constexpr int i2c_port_number {4}; +#define IMUPwr 42 + // TODO: use some form of constexpr if instead // first declare the variables and document // then use if constexpr to set the values