When attempting to run the simpletest for an Adafruit BMP390 and Adafruit BMP388 at the same time, the pressure reported back on one device will always be wrong. This was tested on one I2C bus with a BMP390 at 0x77 and a BMP388 at 0x76.
The same issue occurs when attempting to run this across two different I2C buses as well. The bug appears to affect whichever sensor is started second, which becomes the erroneous pressure sensor. If either pressure sensor is run by itself, the correct pressure is always reported.
These were the Serial results are from a Teensy 4.1 compiled in Arduino 1.8.13, however it should replicate on any Arduino.
Example Output:
BMP388 Sensor #1 using &Wire 0x76
Temperature = 26.56 *C
Pressure = 1012.74 hPa
Approx. Altitude = 3.88 m
BMP390 Sensor #2 using &Wire1 0x77
Temperature = 27.25 *C
Pressure = 958.15 hPa <===========[WRONG PRESSURE REPORTED]
Approx. Altitude = 468.74 m
Example Output if starting of sensors order is reversed:
BMP388 Sensor #1 &Wire 0x76
Temperature = 25.97 *C
Pressure = 1109.57 hPa <===========[WRONG PRESSURE REPORTED]
Approx. Altitude = -772.71 m
BMP390 Sensor #2 using &Wire1 0x77
Temperature = 26.65 *C
Pressure = 1012.26 hPa
Approx. Altitude = 8.30 m
/* Written by Limor Fried & Kevin Townsend for Adafruit Industries.
BSD license, all text above must be included in any redistribution
modified to attempt collection from a BMP388 and BMP390 at the same time
***************************************************************************/
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include "Adafruit_BMP3XX.h"
#define SEALEVELPRESSURE_HPA (1013.25)
Adafruit_BMP3XX bmp;
Adafruit_BMP3XX bmp2;
void setup() {
Wire.setSCL(19);
Wire.setSDA(18);
Wire.begin();
Wire1.setSCL(16);
Wire1.setSDA(17);
Wire1.begin();
Serial.begin(115200);
while (!Serial);
Serial.println("Adafruit BMP388 / BMP390 test");
if (!bmp.begin_I2C(0x76, &Wire)) { // hardware I2C mode, can pass in address & alt Wire
Serial.println("Could not find a valid BMP3 sensor, check wiring!");
while (1);
}
if (!bmp2.begin_I2C(0x77, &Wire1)) { // hardware I2C mode, can pass in address & alt Wire
Serial.println("Could not find a valid BMP3 sensor, check wiring!");
while (1);
}
// Set up oversampling and filter initialization
bmp.setTemperatureOversampling(BMP3_OVERSAMPLING_8X);
bmp.setPressureOversampling(BMP3_OVERSAMPLING_4X);
bmp.setIIRFilterCoeff(BMP3_IIR_FILTER_COEFF_3);
bmp.setOutputDataRate(BMP3_ODR_50_HZ);
// Set up oversampling and filter initialization
bmp2.setTemperatureOversampling(BMP3_OVERSAMPLING_8X);
bmp2.setPressureOversampling(BMP3_OVERSAMPLING_4X);
bmp2.setIIRFilterCoeff(BMP3_IIR_FILTER_COEFF_3);
bmp2.setOutputDataRate(BMP3_ODR_50_HZ);
}
void loop() {
if (! bmp.performReading()) {
Serial.println("Failed to perform reading :(");
return;
}
Serial.println("BMP388 Sensor #1 using &Wire 0x76");
Serial.print("Temperature = ");
Serial.print(bmp.temperature);
Serial.println(" *C");
Serial.print("Pressure = ");
Serial.print(bmp.pressure / 100.0);
Serial.println(" hPa");
Serial.print("Approx. Altitude = ");
Serial.print(bmp.readAltitude(SEALEVELPRESSURE_HPA));
Serial.println(" m");
Serial.println();
if (! bmp2.performReading()) {
Serial.println("Failed to perform reading :(");
return;
}
Serial.println("BMP390 Sensor #2 using &Wire1 0x77 ");
Serial.print("Temperature = ");
Serial.print(bmp2.temperature);
Serial.println(" *C");
Serial.print("Pressure = ");
Serial.print(bmp2.pressure / 100.0);
Serial.println(" hPa");
Serial.print("Approx. Altitude = ");
Serial.print(bmp2.readAltitude(SEALEVELPRESSURE_HPA));
Serial.println(" m");
Serial.println();
delay(2000);
}