Skip to content

Commit 25e5bb7

Browse files
authored
Merge pull request #80 from sparkfun/release_candidate
Firmware version v1.10
2 parents 4d833a7 + 210cb76 commit 25e5bb7

12 files changed

+981
-41
lines changed

Binaries/OpenLog_Artemis-V10-v110.bin

198 KB
Binary file not shown.

Binaries/OpenLog_Artemis-X04-v110.bin

197 KB
Binary file not shown.

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
Change Log
22
======================
33

4+
v1.10
5+
---------
6+
7+
* Improved support for the MS5837
8+
* Adds IMU DMP examples
9+
* Corrects support for the SDP31
10+
* Updates the low-power code as per [78](https://github.com/sparkfun/OpenLog_Artemis/issues/78)
11+
* Corrects wakeFromSleep when using the Tx pin for serial output [79](https://github.com/sparkfun/OpenLog_Artemis/issues/79)
12+
413
v1.9
514
---------
615

Firmware/OpenLog_Artemis/OpenLog_Artemis.ino

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,12 @@
8686
(done) Add support for the SGP40 VOC Index sensor
8787
(done) Add support for the SDP3X Differential Pressure sensor
8888
(done) Add support for the MS5837 - as used in the BlueRobotics BAR02 and BAR30 water pressure sensors
89+
(done) Correct an issue which was causing the OLA to crash when waking from sleep and outputting serial data https://github.com/sparkfun/OpenLog_Artemis/issues/79
90+
(done) Correct low-power code as per https://github.com/sparkfun/OpenLog_Artemis/issues/78
8991
*/
9092

9193
const int FIRMWARE_VERSION_MAJOR = 1;
92-
const int FIRMWARE_VERSION_MINOR = 9;
94+
const int FIRMWARE_VERSION_MINOR = 10;
9395

9496
//Define the OLA board identifier:
9597
// This is an int which is unique to this variant of the OLA and which allows us
@@ -99,7 +101,7 @@ const int FIRMWARE_VERSION_MINOR = 9;
99101
// the variant * 0x100 (OLA = 1; GNSS_LOGGER = 2; GEOPHONE_LOGGER = 3)
100102
// the major firmware version * 0x10
101103
// the minor firmware version
102-
#define OLA_IDENTIFIER 0x119 // Stored as 281 decimal in OLA_settings.txt
104+
#define OLA_IDENTIFIER 0x11A // Stored as 282 decimal in OLA_settings.txt
103105

104106
#include "settings.h"
105107

@@ -853,6 +855,7 @@ void beginIMU()
853855
delay(1);
854856
}
855857

858+
if (settings.printDebugMessages) myICM.enableDebugging();
856859
myICM.begin(PIN_IMU_CHIP_SELECT, SPI, 4000000); //Set IMU SPI rate to 4MHz
857860
if (myICM.status != ICM_20948_Stat_Ok)
858861
{

Firmware/OpenLog_Artemis/Sensors.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -795,8 +795,8 @@ void gatherDeviceValues()
795795
float temperature;
796796
if ((nodeSetting->logPressure) || (nodeSetting->logTemperature))
797797
{
798-
nodeDevice->triggeredMeasurement(nodeSetting->massFlow, nodeSetting->clockStretching);
799-
nodeDevice->readMeasurement(&pressure, &temperature);
798+
// Each triggered measurement takes 45ms to complete so we need to use continuous measurements
799+
nodeDevice->readMeasurement(&pressure, &temperature); // Read the latest measurement
800800
}
801801
if (nodeSetting->logPressure)
802802
{

Firmware/OpenLog_Artemis/autoDetect.ino

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,7 @@ bool beginQwiicDevices()
501501
SDP3X *tempDevice = (SDP3X *)temp->classPtr;
502502
struct_SDP3X *nodeSetting = (struct_SDP3X *)temp->configPtr; //Create a local pointer that points to same spot as node does
503503
if (nodeSetting->powerOnDelayMillis > qwiicPowerOnDelayMillis) qwiicPowerOnDelayMillis = nodeSetting->powerOnDelayMillis; // Increase qwiicPowerOnDelayMillis if required
504+
tempDevice->stopContinuousMeasurement(temp->address, qwiic); //Make sure continuous measurements are stopped or .begin will fail
504505
if (tempDevice->begin(temp->address, qwiic) == true) //Address, Wire port. Returns true on success.
505506
temp->online = true;
506507
}
@@ -768,14 +769,21 @@ void configureDevice(node * temp)
768769
//Nothing to configure
769770
break;
770771
case DEVICE_PRESSURE_SDP3X:
771-
//Nothing to configure
772+
{
773+
SDP3X *sensor = (SDP3X *)temp->classPtr;
774+
struct_SDP3X *sensorSetting = (struct_SDP3X *)temp->configPtr;
775+
776+
// Each triggered measurement takes 45ms to complete so we need to use continuous measurements
777+
sensor->stopContinuousMeasurement(); //Make sure continuous measurements are stopped or startContinuousMeasurement will fail
778+
sensor->startContinuousMeasurement(sensorSetting->massFlow, sensorSetting->averaging); //Request continuous measurements
779+
}
772780
break;
773781
case DEVICE_PRESSURE_MS5837:
774782
{
775783
MS5837 *sensor = (MS5837 *)temp->classPtr;
776784
struct_MS5837 *sensorSetting = (struct_MS5837 *)temp->configPtr;
777785

778-
//sensor->setModel(sensorSetting->model);
786+
//sensor->setModel(sensorSetting->model); // We could override the sensor model, but let's not...
779787
sensorSetting->model = sensor->getModel();
780788
sensor->setFluidDensity(sensorSetting->fluidDensity);
781789
}
@@ -1056,24 +1064,27 @@ deviceType_e testDevice(uint8_t i2cAddress, uint8_t muxAddress, uint8_t portNumb
10561064
break;
10571065
case 0x21:
10581066
{
1059-
//Confidence: Medium - .begin reads the product ID
1067+
//Confidence: High - .begin reads the product ID
10601068
SDP3X sensor;
1069+
sensor.stopContinuousMeasurement(i2cAddress, qwiic); //Make sure continuous measurements are stopped or .begin will fail
10611070
if (sensor.begin(i2cAddress, qwiic) == true) //Address, Wire port
10621071
return (DEVICE_PRESSURE_SDP3X);
10631072
}
10641073
break;
10651074
case 0x22:
10661075
{
1067-
//Confidence: Medium - .begin reads the product ID
1076+
//Confidence: High - .begin reads the product ID
10681077
SDP3X sensor;
1078+
sensor.stopContinuousMeasurement(i2cAddress, qwiic); //Make sure continuous measurements are stopped or .begin will fail
10691079
if (sensor.begin(i2cAddress, qwiic) == true) //Address, Wire port
10701080
return (DEVICE_PRESSURE_SDP3X);
10711081
}
10721082
break;
10731083
case 0x23:
10741084
{
1075-
//Confidence: Medium - .begin reads the product ID
1085+
//Confidence: High - .begin reads the product ID
10761086
SDP3X sensor;
1087+
sensor.stopContinuousMeasurement(i2cAddress, qwiic); //Make sure continuous measurements are stopped or .begin will fail
10771088
if (sensor.begin(i2cAddress, qwiic) == true) //Address, Wire port
10781089
return (DEVICE_PRESSURE_SDP3X);
10791090
}
@@ -1351,7 +1362,10 @@ deviceType_e testDevice(uint8_t i2cAddress, uint8_t muxAddress, uint8_t portNumb
13511362
//Confidence: High - does CRC on internal EEPROM read and checks sensor version
13521363
MS5837 sensor2;
13531364
if (sensor2.begin(qwiic) == true) //Wire port
1354-
return (DEVICE_PRESSURE_MS5837);
1365+
{
1366+
if (sensor2.getModel() <= 1) // Check that getModel returns 0 or 1. It will (hopefully) return 255 if an MS5637 is attached.
1367+
return (DEVICE_PRESSURE_MS5837);
1368+
}
13551369

13561370
//Confidence: High - does CRC on internal EEPROM read - but do this second as a MS5837 will appear as a MS5637
13571371
MS5637 sensor;
@@ -1427,12 +1441,12 @@ deviceType_e testMuxDevice(uint8_t i2cAddress, uint8_t muxAddress, uint8_t portN
14271441
if (deviceExists(DEVICE_MULTIPLEXER, i2cAddress, muxAddress, portNumber) == true) return (DEVICE_MULTIPLEXER);
14281442

14291443
// If an MS8607 is connected, multiplexerBegin causes the MS8607 to 'crash' and lock up the I2C bus... So we need to check if an MS8607 is connected first.
1430-
// We will use the MS5637 as this will test for itself and the pressure sensor of the MS8607
1444+
// We will use the MS5637 as this will test for itself, the MS5837 and the pressure sensor of the MS8607
14311445
// Just to make life even more complicated, a mux with address 0x76 will also appear as an MS5637 due to the way the MS5637 eeprom crc check is calculated.
1432-
// So, we can't use .begin as the test for a MS5637 / MS8607. We need to be more creative!
1446+
// So, we can't use .begin as the test for a MS5637 / MS5837 / MS8607. We need to be more creative!
14331447
// If we write 0xA0 to i2cAddress and then read two bytes:
14341448
// A mux will return 0xA0A0
1435-
// An MS5637 / MS8607 will return the value stored in its eeprom which _hopefully_ is not 0xA0A0!
1449+
// An MS5637 / MS5837 / MS8607 will return the value stored in its eeprom which _hopefully_ is not 0xA0A0!
14361450

14371451
// Let's hope this doesn't cause problems for the BME280...! We should be OK as the default address for the BME280 is 0x77.
14381452

@@ -1448,7 +1462,7 @@ deviceType_e testMuxDevice(uint8_t i2cAddress, uint8_t muxAddress, uint8_t portN
14481462
{
14491463
buffer[i] = qwiic.read();
14501464
}
1451-
if ((buffer[0] != 0xA0) || (buffer[1] != 0xA0)) // If we read back something other than 0xA0A0 then we are probably talking to an MS5637 / MS8607, not a mux
1465+
if ((buffer[0] != 0xA0) || (buffer[1] != 0xA0)) // If we read back something other than 0xA0A0 then we are probably talking to an MS5637 / MS5837 / MS8607, not a mux
14521466
{
14531467
return (DEVICE_PRESSURE_MS5637);
14541468
}

Firmware/OpenLog_Artemis/lowerPower.ino

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,9 @@ void powerDown()
137137
qwiicPowerOff();
138138
#endif
139139

140-
//Power down Flash, SRAM, cache
141-
am_hal_pwrctrl_memory_deepsleep_powerdown(AM_HAL_PWRCTRL_MEM_CACHE); //Turn off CACHE
142-
am_hal_pwrctrl_memory_deepsleep_powerdown(AM_HAL_PWRCTRL_MEM_FLASH_512K); //Turn off everything but lower 512k
143-
am_hal_pwrctrl_memory_deepsleep_powerdown(AM_HAL_PWRCTRL_MEM_SRAM_64K_DTCM); //Turn off everything but lower 64k
144-
//am_hal_pwrctrl_memory_deepsleep_powerdown(AM_HAL_PWRCTRL_MEM_ALL); //Turn off all memory (doesn't recover)
140+
//Power down cache, flash, SRAM
141+
am_hal_pwrctrl_memory_deepsleep_powerdown(AM_HAL_PWRCTRL_MEM_ALL); // Power down all flash and cache
142+
am_hal_pwrctrl_memory_deepsleep_retain(AM_HAL_PWRCTRL_MEM_SRAM_384K); // Retain all SRAM
145143

146144
//Keep the 32kHz clock running for RTC
147145
am_hal_stimer_config(AM_HAL_STIMER_CFG_CLEAR | AM_HAL_STIMER_CFG_FREEZE);
@@ -320,11 +318,9 @@ void goToSleep(uint32_t sysTicksToSleep)
320318
//else
321319
// powerLEDOff();
322320

323-
//Power down Flash, SRAM, cache
324-
am_hal_pwrctrl_memory_deepsleep_powerdown(AM_HAL_PWRCTRL_MEM_CACHE); //Turn off CACHE
325-
am_hal_pwrctrl_memory_deepsleep_powerdown(AM_HAL_PWRCTRL_MEM_FLASH_512K); //Turn off everything but lower 512k
326-
//am_hal_pwrctrl_memory_deepsleep_powerdown(AM_HAL_PWRCTRL_MEM_SRAM_64K_DTCM); //Turn off everything but lower 64k (Leaving 64K powered up probably isn't enough - "Global variables use 70496 bytes of dynamic memory.")
327-
//am_hal_pwrctrl_memory_deepsleep_powerdown(AM_HAL_PWRCTRL_MEM_ALL); //Turn off all memory (doesn't recover)
321+
//Power down cache, flash, SRAM
322+
am_hal_pwrctrl_memory_deepsleep_powerdown(AM_HAL_PWRCTRL_MEM_ALL); // Power down all flash and cache
323+
am_hal_pwrctrl_memory_deepsleep_retain(AM_HAL_PWRCTRL_MEM_SRAM_384K); // Retain all SRAM
328324

329325
//Use the lower power 32kHz clock. Use it to run CT6 as well.
330326
am_hal_stimer_config(AM_HAL_STIMER_CFG_CLEAR | AM_HAL_STIMER_CFG_FREEZE);
@@ -365,9 +361,6 @@ void goToSleep(uint32_t sysTicksToSleep)
365361
//Power everything up gracefully
366362
void wakeFromSleep()
367363
{
368-
//Power up SRAM, turn on entire Flash
369-
am_hal_pwrctrl_memory_deepsleep_powerdown(AM_HAL_PWRCTRL_MEM_MAX);
370-
371364
//Go back to using the main clock
372365
//am_hal_stimer_int_enable(AM_HAL_STIMER_INT_OVERFLOW);
373366
//NVIC_EnableIRQ(STIMER_IRQn);
@@ -450,6 +443,7 @@ void wakeFromSleep()
450443
if (settings.useTxRxPinsForTerminal == false)
451444
{
452445
beginSerialLogging(); //20 - 99ms
446+
beginSerialOutput();
453447
}
454448

455449
beginIMU(); //61ms

Firmware/OpenLog_Artemis/menuAttachedDevices.ino

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ bool detectQwiicDevices()
8282
{
8383
if (settings.printDebugMessages == true)
8484
{
85-
SerialPrintf2("detectQwiicDevices: MS8607/MS5637 found at address 0x%02X. Ignoring it for now...\r\n", address);
85+
SerialPrintf2("detectQwiicDevices: MS8607/MS5637/MS5837 found at address 0x%02X. Ignoring it for now...\r\n", address);
8686
}
8787
}
8888
}
@@ -103,7 +103,7 @@ bool detectQwiicDevices()
103103

104104
//Before going into mux sub branches, scan the main branch for all remaining devices
105105
SerialPrintln(F("Identifying Qwiic Devices..."));
106-
bool foundMS8607 = false; // The MS8607 appears as two devices (MS8607 and MS5637). We need to skip the MS5637 if we have found a MS8607.
106+
bool foundMS8607 = false; // The MS8607 appears as two devices (MS8607 and MS5637). We need to skip the MS5637/MS5837 if we have found a MS8607.
107107
for (uint8_t address = 1 ; address < 127 ; address++)
108108
{
109109
qwiic.beginTransmission(address);
@@ -117,9 +117,9 @@ bool detectQwiicDevices()
117117
deviceType_e foundType = testDevice(address, 0, 0); //No mux or port numbers for this test
118118
if (foundType != DEVICE_UNKNOWN_DEVICE)
119119
{
120-
if ((foundType == DEVICE_PRESSURE_MS5637) && (foundMS8607 == true))
120+
if ((foundMS8607 == true) && ((foundType == DEVICE_PRESSURE_MS5637) || (foundType == DEVICE_PRESSURE_MS5837)))
121121
{
122-
; // Skip MS5637 as we have already found an MS8607
122+
; // Skip MS5637/MS5837 as we have already found an MS8607
123123
}
124124
else
125125
{
@@ -2271,9 +2271,9 @@ void menuConfigure_SDP3X(void *configPtr)
22712271
if (sensorSetting->massFlow == true) SerialPrintln(F("Mass Flow"));
22722272
else SerialPrintln(F("Differential Pressure"));
22732273

2274-
SerialPrint(F("5) Use Clock Stretching: "));
2275-
if (sensorSetting->clockStretching == true) SerialPrintln(F("Yes"));
2276-
else SerialPrintln(F("No"));
2274+
SerialPrint(F("5) Measurement Averaging: "));
2275+
if (sensorSetting->averaging == true) SerialPrintln(F("Enabled"));
2276+
else SerialPrintln(F("Disabled"));
22772277
}
22782278
SerialPrintln(F("x) Exit"));
22792279

@@ -2290,7 +2290,7 @@ void menuConfigure_SDP3X(void *configPtr)
22902290
else if (incoming == 4)
22912291
sensorSetting->massFlow ^= 1;
22922292
else if (incoming == 5)
2293-
sensorSetting->clockStretching ^= 1;
2293+
sensorSetting->averaging ^= 1;
22942294
else if (incoming == STATUS_PRESSED_X)
22952295
break;
22962296
else if (incoming == STATUS_GETNUMBER_TIMEOUT)
@@ -2317,7 +2317,7 @@ void menuConfigure_MS5837(void *configPtr)
23172317
SerialPrintln(F("Menu: Configure MS5837 Pressure Sensor"));
23182318

23192319
SerialPrint(F("Sensor Model: "));
2320-
if (sensorSetting->model == true) SerialPrintln(F("MS5837-02BA / BlueRobotics Bar02: 2 Bar Absolute / 10m Depth"));
2320+
if (sensorSetting->model == 1) SerialPrintln(F("MS5837-02BA / BlueRobotics Bar02: 2 Bar Absolute / 10m Depth"));
23212321
else SerialPrintln(F("MS5837-30BA / BlueRobotics Bar30: 30 Bar Absolute / 300m Depth"));
23222322

23232323
SerialPrint(F("1) Sensor Logging: "));

Firmware/OpenLog_Artemis/nvm.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,7 @@ void recordDeviceSettingsToFile()
694694
settingsFile.println((String)base + "logPressure=" + nodeSetting->logPressure);
695695
settingsFile.println((String)base + "logTemperature=" + nodeSetting->logTemperature);
696696
settingsFile.println((String)base + "massFlow=" + nodeSetting->massFlow);
697-
settingsFile.println((String)base + "clockStretching=" + nodeSetting->clockStretching);
697+
settingsFile.println((String)base + "averaging=" + nodeSetting->averaging);
698698
}
699699
break;
700700
case DEVICE_PRESSURE_MS5837:
@@ -1259,8 +1259,8 @@ bool parseDeviceLine(char* str) {
12591259
nodeSetting->logTemperature = d;
12601260
else if (strcmp(deviceSettingName, "massFlow") == 0)
12611261
nodeSetting->massFlow = d;
1262-
else if (strcmp(deviceSettingName, "clockStretching") == 0)
1263-
nodeSetting->clockStretching = d;
1262+
else if (strcmp(deviceSettingName, "averaging") == 0)
1263+
nodeSetting->averaging = d;
12641264
else
12651265
SerialPrintf2("Unknown device setting: %s\r\n", deviceSettingName);
12661266
}

Firmware/OpenLog_Artemis/settings.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ struct struct_SDP3X {
297297
bool logPressure = true;
298298
bool logTemperature = true;
299299
bool massFlow = true;
300-
bool clockStretching = false;
300+
bool averaging = false;
301301
unsigned long powerOnDelayMillis = minimumQwiicPowerOnDelay; // Wait for at least this many millis before communicating with this device. Increase if required!
302302
};
303303

@@ -307,7 +307,7 @@ struct struct_MS5837 {
307307
bool logTemperature = true;
308308
bool logDepth = true;
309309
bool logAltitude = true;
310-
bool model = true; // Valid options are: 0 (MS5837::MS5837_30BA) and 1 (MS5837::MS5837_02BA)
310+
uint8_t model = 1; // Valid options are: 0 (MS5837::MS5837_30BA); 1 (MS5837::MS5837_02BA) and 255 (MS5837::MS5837_UNRECOGNISED)
311311
float fluidDensity = 997;
312312
float conversion = 1.0;
313313
unsigned long powerOnDelayMillis = minimumQwiicPowerOnDelay; // Wait for at least this many millis before communicating with this device. Increase if required!

0 commit comments

Comments
 (0)