Skip to content

Commit d222b95

Browse files
committed
Merge branch 'master' into release_candidate
2 parents a33c849 + eef0ebb commit d222b95

File tree

3 files changed

+302
-3
lines changed

3 files changed

+302
-3
lines changed

CHANGELOG.md

Lines changed: 71 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,80 @@
11
Change Log
22
======================
33

4+
v1.6
5+
---------
6+
7+
* The sensor readings can now be streamed to the serial TX pin (in addition to being displayed in the terminal and logged to SD card)
8+
* You can enable this feature using Menu 4 (Configure Serial Logging) Option 2
9+
* The baud rate is set using Menu 4 Option 4 (the serial pin and the terminal have separate baud rates)
10+
* When serial output is enabled, analog logging on pin 12 is disabled
11+
* This resolves issue [#32](https://github.com/sparkfun/OpenLog_Artemis/issues/32)
12+
* A new SD Card File Transfer menu has been added
13+
* You can access this by selecting Menu s from the Main Menu
14+
* You can now:
15+
* List the files on the SD card using ls or dir
16+
* Delete a single file using del filename or rm filename
17+
* Type the contents of a single file to the terminal using type filename or cat filename
18+
* Copy or transfer a single file to the serial TX pin using ss filename
19+
* Transfer a single file or all files to the terminal using the ZMODEM protocol
20+
* Tera Term supports ZMODEM. Select File\Transfer\ZMODEM\Receive from the pull-down menus
21+
* To transfer a single file: sz filename
22+
* To transfer all files: sz *
23+
* The ZMODEM start delay can be changed using Menu 4 Option 3
24+
* The code is based on ecm-bitflipper's Arduino_ZModem
25+
* This resolves issue [#33](https://github.com/sparkfun/OpenLog_Artemis/issues/33)
26+
* The serial and data log files are now timestamped with create and access timestamps
27+
* By default, the access timestamp is only set when the file is closed
28+
* You can enable frequent file access timestamps using Menu 1 Option 11
29+
* Frequent timestamping requires additional SD card writes and may cause problems when logging data at high rates
30+
* An additional delay allows the IMU to start cleanly after being powered down during sleep
31+
* This resolves issue [#18](https://github.com/sparkfun/OpenLog_Artemis/issues/18)
32+
* The measurement count no longer resets when the menus are opened
33+
* This resolves issue [#31](https://github.com/sparkfun/OpenLog_Artemis/issues/31)
34+
* Low battery detection is now supported on the v10 (red) version of the OLA
35+
* Automatic powerDown on low battery can be enabled using Menu 7 Option 4
36+
* The low battery threshold voltage can be set using Menu 7 Option 5
37+
* The code now defines a power-on delay for each sensor type
38+
* When waking from sleep, the code will now wait until attempting to begin 'slow' sensors like the SCD30 or a u-blox module
39+
* You can extend/override the power-on delay by selecting Menu 6, then Configure Qwiic Settings , then Option 3
40+
* You can extend the delay to a maximum of 60 seconds, which is more than enough time to allow a u-blox module to establish a fix before the data is read
41+
* This resolves issue [#5](https://github.com/sparkfun/OpenLog_Artemis/issues/5)
42+
* Instead of logging data at regular time intervals, data logging can now also be triggered via Pin 11
43+
* This new feature is enabled via Menu 1 Option 12
44+
* Data logging can be triggered on falling or rising edges (Menu 1 Option 13)
45+
* When triggering is enabled, the normal log rate settings are ignored
46+
* Pin 11 generates an interrupt rather than being polled, allowing fast events to trigger logging
47+
* This resolves issue [#36](https://github.com/sparkfun/OpenLog_Artemis/issues/36)
48+
* The IMU temperature reading has been corrected
49+
* This resolves issue [#28](https://github.com/sparkfun/OpenLog_Artemis/issues/28)
50+
51+
v1.5
52+
---------
53+
54+
* Added the CIPO pull-up
55+
* Improved mux scanning
56+
* Added productionTest
57+
* Reduced the maximum serial logging baud rate to 500000
58+
* Reduced RAM footprint - most Serial.prints now use flash helper text
59+
* Qwiic power-up delay improvements
60+
* Released for V10 production
61+
62+
v1.4
63+
---------
64+
65+
* Added support for the ADS122C04
66+
* Investigated the RTC-reset issue [#13](https://github.com/sparkfun/OpenLog_Artemis/issues/13)
67+
* Added the _stop logging_ feature on Pin 32
68+
* Allow the user to select the Qwiic pull-up resistance
69+
* Qwiic pull-ups are disabled when communicating with a u-blox module
70+
* Regressed to SdFat (FAT32) - we found that SdFat-Beta caused very occasional logging problems
71+
* Added the VIN correction factor
72+
473
v1.3
574
---------
675

776
* Add 100ms startup time to Qwiic auto-detection. Lack of SD card was causing some sensors to be pinged before they had enough time to power on and ack.
8-
* Add 2000ms startup time to SCD30. This sensor requires significant time to boot. See issue #4.
77+
* Add 2000ms startup time to SCD30. This sensor requires significant time to boot. See issue [#4](https://github.com/sparkfun/OpenLog_Artemis/issues/4).
978

1079
v1.2
1180
---------
@@ -24,4 +93,4 @@ v1.1
2493

2594
v1.0
2695
---------
27-
Initial release.
96+
Initial release.

CONTRIBUTING.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
Thank you so *much* for offering to help out. We truly appreciate it.
44

5-
If you'd like to contribute, start by searching through the [issues](https://github.com/sparkfun/OpenLog_Artemis/issues) and [pull requests](https://github.com/sparkfun/OpenLog_Artemis/pulls) to see whether someone else has raised a similar idea or question.
5+
If you'd like to contribute, start by searching through the [issues](https://github.com/sparkfun/OpenLog_Artemis/issues) and [pull requests](https://github.com/sparkfun/OpenLog_Artemis/pulls) to see whether someone else has raised a similar idea or question. Please check the [closed issues](https://github.com/sparkfun/OpenLog_Artemis/issues?q=is%3Aissue+is%3Aclosed)
6+
and [closed pull requests](https://github.com/sparkfun/OpenLog_Artemis/pulls?q=is%3Apr+is%3Aclosed) too - you may find that your issue or feature has already been discussed.
67

78
If you decide to add a feature or support for a new sensor to OpenLog Artemis, please create a PR and follow these best practices:
89

Lines changed: 229 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,229 @@
1+
/****************************************************************
2+
* Testing basic functionality of the ICM 20948 on the OpenLog Artemis.
3+
* Select "SparkFun Apollo3" \ SparkFun RedBoard Artemis ATP" as the board.
4+
*
5+
* Based on:
6+
*
7+
* Example1_Basics.ino
8+
* ICM 20948 Arduino Library Demo
9+
* Use the default configuration to stream 9-axis IMU data
10+
* Owen Lyke @ SparkFun Electronics
11+
* Original Creation Date: April 17 2019
12+
*
13+
* This code is beerware; if you see me (or any other SparkFun employee) at the
14+
* local, and you've found our code helpful, please buy us a round!
15+
*
16+
* Distributed as-is; no warranty is given.
17+
***************************************************************/
18+
19+
// OLA Specifics:
20+
const byte PIN_IMU_POWER = 27; // The Red SparkFun version of the OLA (V10) uses pin 27
21+
//const byte PIN_IMU_POWER = 22; // The Black SparkX version of the OLA (X04) uses pin 22
22+
const byte PIN_IMU_INT = 37;
23+
const byte PIN_IMU_CHIP_SELECT = 44;
24+
25+
26+
#include "ICM_20948.h" // Click here to get the library: http://librarymanager/All#SparkFun_ICM_20948_IMU
27+
28+
#define USE_SPI // Uncomment this to use SPI
29+
30+
#define SERIAL_PORT Serial
31+
32+
#define SPI_PORT SPI // Your desired SPI port. Used only when "USE_SPI" is defined
33+
#define CS_PIN PIN_IMU_CHIP_SELECT // Which pin you connect CS to. Used only when "USE_SPI" is defined. OLA uses pin 44.
34+
35+
#define WIRE_PORT Wire // Your desired Wire port. Used when "USE_SPI" is not defined
36+
#define AD0_VAL 1 // The value of the last bit of the I2C address.
37+
// On the SparkFun 9DoF IMU breakout the default is 1, and when
38+
// the ADR jumper is closed the value becomes 0
39+
40+
#ifdef USE_SPI
41+
ICM_20948_SPI myICM; // If using SPI create an ICM_20948_SPI object
42+
#else
43+
ICM_20948_I2C myICM; // Otherwise create an ICM_20948_I2C object
44+
#endif
45+
46+
47+
void setup() {
48+
49+
#ifdef USE_SPI
50+
SPI_PORT.begin();
51+
#else
52+
WIRE_PORT.begin();
53+
WIRE_PORT.setClock(400000);
54+
#endif
55+
56+
enableCIPOpullUp(); // Enable CIPO pull-up on the OLA
57+
58+
pinMode(PIN_IMU_CHIP_SELECT, OUTPUT);
59+
digitalWrite(PIN_IMU_CHIP_SELECT, HIGH); //Be sure IMU is deselected
60+
61+
//Reset ICM by power cycling it
62+
imuPowerOff();
63+
64+
delay(10);
65+
66+
imuPowerOn(); // Enable power for the OLA IMU
67+
68+
delay(100); // Wait for the IMU to power up
69+
70+
SERIAL_PORT.begin(115200);
71+
while(!SERIAL_PORT){};
72+
73+
bool initialized = false;
74+
while( !initialized ){
75+
76+
#ifdef USE_SPI
77+
myICM.begin( CS_PIN, SPI_PORT );
78+
#else
79+
myICM.begin( WIRE_PORT, AD0_VAL );
80+
#endif
81+
82+
SERIAL_PORT.print( F("Initialization of the sensor returned: ") );
83+
SERIAL_PORT.println( myICM.statusString() );
84+
if( myICM.status != ICM_20948_Stat_Ok ){
85+
SERIAL_PORT.println( "Trying again..." );
86+
delay(500);
87+
}else{
88+
initialized = true;
89+
}
90+
}
91+
}
92+
93+
void loop() {
94+
95+
if( myICM.dataReady() ){
96+
myICM.getAGMT(); // The values are only updated when you call 'getAGMT'
97+
// printRawAGMT( myICM.agmt ); // Uncomment this to see the raw values, taken directly from the agmt structure
98+
printScaledAGMT( myICM.agmt); // This function takes into account the sclae settings from when the measurement was made to calculate the values with units
99+
delay(30);
100+
}else{
101+
Serial.println("Waiting for data");
102+
delay(500);
103+
}
104+
105+
}
106+
107+
108+
// Below here are some helper functions to print the data nicely!
109+
110+
void printPaddedInt16b( int16_t val ){
111+
if(val > 0){
112+
SERIAL_PORT.print(" ");
113+
if(val < 10000){ SERIAL_PORT.print("0"); }
114+
if(val < 1000 ){ SERIAL_PORT.print("0"); }
115+
if(val < 100 ){ SERIAL_PORT.print("0"); }
116+
if(val < 10 ){ SERIAL_PORT.print("0"); }
117+
}else{
118+
SERIAL_PORT.print("-");
119+
if(abs(val) < 10000){ SERIAL_PORT.print("0"); }
120+
if(abs(val) < 1000 ){ SERIAL_PORT.print("0"); }
121+
if(abs(val) < 100 ){ SERIAL_PORT.print("0"); }
122+
if(abs(val) < 10 ){ SERIAL_PORT.print("0"); }
123+
}
124+
SERIAL_PORT.print(abs(val));
125+
}
126+
127+
void printRawAGMT( ICM_20948_AGMT_t agmt){
128+
SERIAL_PORT.print("RAW. Acc [ ");
129+
printPaddedInt16b( agmt.acc.axes.x );
130+
SERIAL_PORT.print(", ");
131+
printPaddedInt16b( agmt.acc.axes.y );
132+
SERIAL_PORT.print(", ");
133+
printPaddedInt16b( agmt.acc.axes.z );
134+
SERIAL_PORT.print(" ], Gyr [ ");
135+
printPaddedInt16b( agmt.gyr.axes.x );
136+
SERIAL_PORT.print(", ");
137+
printPaddedInt16b( agmt.gyr.axes.y );
138+
SERIAL_PORT.print(", ");
139+
printPaddedInt16b( agmt.gyr.axes.z );
140+
SERIAL_PORT.print(" ], Mag [ ");
141+
printPaddedInt16b( agmt.mag.axes.x );
142+
SERIAL_PORT.print(", ");
143+
printPaddedInt16b( agmt.mag.axes.y );
144+
SERIAL_PORT.print(", ");
145+
printPaddedInt16b( agmt.mag.axes.z );
146+
SERIAL_PORT.print(" ], Tmp [ ");
147+
printPaddedInt16b( agmt.tmp.val );
148+
SERIAL_PORT.print(" ]");
149+
SERIAL_PORT.println();
150+
}
151+
152+
153+
void printFormattedFloat(float val, uint8_t leading, uint8_t decimals){
154+
float aval = abs(val);
155+
if(val < 0){
156+
SERIAL_PORT.print("-");
157+
}else{
158+
SERIAL_PORT.print(" ");
159+
}
160+
for( uint8_t indi = 0; indi < leading; indi++ ){
161+
uint32_t tenpow = 0;
162+
if( indi < (leading-1) ){
163+
tenpow = 1;
164+
}
165+
for(uint8_t c = 0; c < (leading-1-indi); c++){
166+
tenpow *= 10;
167+
}
168+
if( aval < tenpow){
169+
SERIAL_PORT.print("0");
170+
}else{
171+
break;
172+
}
173+
}
174+
if(val < 0){
175+
SERIAL_PORT.print(-val, decimals);
176+
}else{
177+
SERIAL_PORT.print(val, decimals);
178+
}
179+
}
180+
181+
void printScaledAGMT( ICM_20948_AGMT_t agmt){
182+
SERIAL_PORT.print("Scaled. Acc (mg) [ ");
183+
printFormattedFloat( myICM.accX(), 5, 2 );
184+
SERIAL_PORT.print(", ");
185+
printFormattedFloat( myICM.accY(), 5, 2 );
186+
SERIAL_PORT.print(", ");
187+
printFormattedFloat( myICM.accZ(), 5, 2 );
188+
SERIAL_PORT.print(" ], Gyr (DPS) [ ");
189+
printFormattedFloat( myICM.gyrX(), 5, 2 );
190+
SERIAL_PORT.print(", ");
191+
printFormattedFloat( myICM.gyrY(), 5, 2 );
192+
SERIAL_PORT.print(", ");
193+
printFormattedFloat( myICM.gyrZ(), 5, 2 );
194+
SERIAL_PORT.print(" ], Mag (uT) [ ");
195+
printFormattedFloat( myICM.magX(), 5, 2 );
196+
SERIAL_PORT.print(", ");
197+
printFormattedFloat( myICM.magY(), 5, 2 );
198+
SERIAL_PORT.print(", ");
199+
printFormattedFloat( myICM.magZ(), 5, 2 );
200+
SERIAL_PORT.print(" ], Tmp (C) [ ");
201+
printFormattedFloat( myICM.temp(), 5, 2 );
202+
SERIAL_PORT.print(" ]");
203+
SERIAL_PORT.println();
204+
}
205+
206+
void imuPowerOn()
207+
{
208+
pinMode(PIN_IMU_POWER, OUTPUT);
209+
digitalWrite(PIN_IMU_POWER, HIGH);
210+
}
211+
void imuPowerOff()
212+
{
213+
pinMode(PIN_IMU_POWER, OUTPUT);
214+
digitalWrite(PIN_IMU_POWER, LOW);
215+
}
216+
217+
bool enableCIPOpullUp()
218+
{
219+
//Add CIPO pull-up
220+
ap3_err_t retval = AP3_OK;
221+
am_hal_gpio_pincfg_t cipoPinCfg = AP3_GPIO_DEFAULT_PINCFG;
222+
cipoPinCfg.uFuncSel = AM_HAL_PIN_6_M0MISO;
223+
cipoPinCfg.eDriveStrength = AM_HAL_GPIO_PIN_DRIVESTRENGTH_12MA;
224+
cipoPinCfg.eGPOutcfg = AM_HAL_GPIO_PIN_OUTCFG_PUSHPULL;
225+
cipoPinCfg.uIOMnum = AP3_SPI_IOM;
226+
cipoPinCfg.ePullup = AM_HAL_GPIO_PIN_PULLUP_1_5K;
227+
padMode(MISO, cipoPinCfg, &retval);
228+
return (retval == AP3_OK);
229+
}

0 commit comments

Comments
 (0)