Skip to content

Commit 1afaa12

Browse files
committed
Adding a fix to make sure the MS8607 is detected correctly.
1 parent a602ac6 commit 1afaa12

File tree

3 files changed

+58
-2
lines changed

3 files changed

+58
-2
lines changed

Firmware/OpenLog_Artemis/OpenLog_Artemis.ino

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
This firmware runs the OpenLog Artemis. A large variety of system settings can be
1212
adjusted by connecting at 115200bps.
1313
14+
The Board should be set to SparkFun Apollo3 \ SparkFun RedBoard Artemis ATP.
15+
1416
v1.0 Power Consumption:
1517
Sleep between reads, RTC fully charged, no Qwiic, SD, no USB, no Power LED: 260uA
1618
10Hz logging IMU, no Qwiic, SD, no USB, no Power LED: 9-27mA
@@ -69,10 +71,11 @@
6971
(done) Add support for the MPRLS0025PA micro pressure sensor
7072
(done) Add support for the SN-GCJA5 particle sensor
7173
(done) Add IMU accelerometer and gyro full scale and digital low pass filter settings to menuIMU
74+
(done) Add a fix to make sure the MS8607 is detected correctly: https://github.com/sparkfun/OpenLog_Artemis/issues/54
7275
*/
7376

7477
const int FIRMWARE_VERSION_MAJOR = 1;
75-
const int FIRMWARE_VERSION_MINOR = 7;
78+
const int FIRMWARE_VERSION_MINOR = 8;
7679

7780
//Define the OLA board identifier:
7881
// This is an int which is unique to this variant of the OLA and which allows us
@@ -82,7 +85,7 @@ const int FIRMWARE_VERSION_MINOR = 7;
8285
// the variant * 0x100 (OLA = 1; GNSS_LOGGER = 2; GEOPHONE_LOGGER = 3)
8386
// the major firmware version * 0x10
8487
// the minor firmware version
85-
#define OLA_IDENTIFIER 0x117 // Stored as 279 decimal in OLA_settings.txt
88+
#define OLA_IDENTIFIER 0x118 // Stored as 280 decimal in OLA_settings.txt
8689

8790
#include "settings.h"
8891

Firmware/OpenLog_Artemis/autoDetect.ino

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,6 +1273,7 @@ deviceType_e testDevice(uint8_t i2cAddress, uint8_t muxAddress, uint8_t portNumb
12731273

12741274
//Given an address, returns the device type if it responds as we would expect
12751275
//This version is dedicated to testing muxes and uses a custom .begin to avoid the slippery mux problem
1276+
//However, we also need to check if an MS8607 is attached (address 0x76) as it can cause the I2C bus to lock up if not detected correctly
12761277
deviceType_e testMuxDevice(uint8_t i2cAddress, uint8_t muxAddress, uint8_t portNumber)
12771278
{
12781279
switch (i2cAddress)
@@ -1283,7 +1284,53 @@ deviceType_e testMuxDevice(uint8_t i2cAddress, uint8_t muxAddress, uint8_t portN
12831284
case 0x73:
12841285
case 0x74:
12851286
case 0x75:
1287+
{
1288+
//Ignore devices we've already recorded. This was causing the mux to get tested, a begin() would happen, and the mux would be reset.
1289+
if (deviceExists(DEVICE_MULTIPLEXER, i2cAddress, muxAddress, portNumber) == true) return (DEVICE_MULTIPLEXER);
1290+
1291+
//Confidence: Medium - Write/Read/Clear to 0x00
1292+
if (multiplexerBegin(i2cAddress, qwiic) == true) //Address, Wire port
1293+
return (DEVICE_MULTIPLEXER);
1294+
}
1295+
break;
12861296
case 0x76:
1297+
{
1298+
//Ignore devices we've already recorded. This was causing the mux to get tested, a begin() would happen, and the mux would be reset.
1299+
if (deviceExists(DEVICE_MULTIPLEXER, i2cAddress, muxAddress, portNumber) == true) return (DEVICE_MULTIPLEXER);
1300+
1301+
// 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.
1302+
// We will use the MS5637 as this will test for itself and the pressure sensor of the MS8607
1303+
// 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.
1304+
// So, we can't use .begin as the test for a MS5637 / MS8607. We need to be more creative!
1305+
// If we write 0xA0 to i2cAddress and then read two bytes:
1306+
// A mux will return 0xA0A0
1307+
// An MS5637 / MS8607 will return the value stored in its eeprom which _hopefully_ is not 0xA0A0!
1308+
1309+
// Let's hope this doesn't cause problems for the BME280...! We should be OK as the default address for the BME280 is 0x77.
1310+
1311+
qwiic.beginTransmission((uint8_t)i2cAddress);
1312+
qwiic.write((uint8_t)0xA0);
1313+
uint8_t i2c_status = qwiic.endTransmission();
1314+
1315+
if (i2c_status == 0) // If the I2C write was successful
1316+
{
1317+
qwiic.requestFrom((uint8_t)i2cAddress, 2U); // Read two bytes
1318+
uint8_t buffer[2];
1319+
for (uint8_t i = 0; i < 2; i++)
1320+
{
1321+
buffer[i] = qwiic.read();
1322+
}
1323+
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
1324+
{
1325+
return (DEVICE_PRESSURE_MS5637);
1326+
}
1327+
}
1328+
1329+
//Confidence: Medium - Write/Read/Clear to 0x00
1330+
if (multiplexerBegin(i2cAddress, qwiic) == true) //Address, Wire port
1331+
return (DEVICE_MULTIPLEXER);
1332+
}
1333+
break;
12871334
case 0x77:
12881335
{
12891336
//Ignore devices we've already recorded. This was causing the mux to get tested, a begin() would happen, and the mux would be reset.

Firmware/OpenLog_Artemis/menuAttachedDevices.ino

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ bool detectQwiicDevices()
5151

5252
//First scan for Muxes. Valid addresses are 0x70 to 0x77 (112 to 119).
5353
//If any are found, they will be begin()'d causing their ports to turn off
54+
//testMuxDevice will check if an MS8607 is attached (address 0x76) as it can cause the I2C bus to lock up if we try to detect it as a mux
5455
uint8_t muxCount = 0;
5556
for (uint8_t address = 0x70 ; address < 0x78 ; address++)
5657
{
@@ -73,6 +74,11 @@ bool detectQwiicDevices()
7374
Serial.printf("detectQwiicDevices: multiplexer found at address 0x%02X\r\n", address);
7475
muxCount++;
7576
}
77+
else if (foundType == DEVICE_PRESSURE_MS5637)
78+
{
79+
if (settings.printDebugMessages == true)
80+
Serial.printf("detectQwiicDevices: MS8607/MS5637 found at address 0x%02X. Ignoring it for now...\r\n", address);
81+
}
7682
}
7783
}
7884

0 commit comments

Comments
 (0)