@@ -114,7 +114,8 @@ uint8_t BME280::begin()
114114
115115 // Check communication with IC before anything else
116116 uint8_t chipID = readRegister (BME280_CHIP_ID_REG); // Should return 0x60
117- if (chipID != 0x60 ) return (chipID); // Failed!
117+ if (chipID != 0x58 ) // This is not BMP
118+ if (chipID != 0x60 ) // This is not BME
118119
119120 // Reading all compensation data, range 0x88:A1, 0xE1:E7
120121 calibration.dig_T1 = ((uint16_t )((readRegister (BME280_DIG_T1_MSB_REG) << 8 ) + readRegister (BME280_DIG_T1_LSB_REG)));
@@ -156,8 +157,9 @@ bool BME280::beginSPI(uint8_t csPin)
156157{
157158 settings.chipSelectPin = csPin;
158159 settings.commInterface = SPI_MODE;
159-
160- if (begin () == 0x60 ) return (true ); // Begin normal init with these settings. Should return chip ID of 0x60
160+
161+ if (begin () == 0x58 ) return (true ); // Begin normal init with these settings. Should return chip ID of 0x58 for BMP
162+ if (begin () == 0x60 ) return (true ); // Begin normal init with these settings. Should return chip ID of 0x60 for BME
161163 return (false );
162164}
163165
@@ -168,9 +170,10 @@ bool BME280::beginI2C(TwoWire &wirePort)
168170 _wireType = HARD_WIRE;
169171
170172 settings.commInterface = I2C_MODE;
173+
171174 // settings.I2CAddress = 0x77; //We assume user has set the I2C address using setI2CAddress()
172-
173- if (begin () == 0x60 ) return (true ); // Begin normal init with these settings. Should return chip ID of 0x60
175+ if ( begin () == 0x58 ) return ( true ); // Begin normal init with these settings. Should return chip ID of 0x58 for BMP
176+ if (begin () == 0x60 ) return (true ); // Begin normal init with these settings. Should return chip ID of 0x60 for BME
174177 return (false );
175178}
176179
@@ -184,7 +187,8 @@ bool BME280::beginI2C(SoftwareWire& wirePort)
184187 settings.commInterface = I2C_MODE;
185188 // settings.I2CAddress = 0x77; //We assume user has set the I2C address using setI2CAddress()
186189
187- if (begin () == 0x60 ) return (true ); // Begin normal init with these settings. Should return chip ID of 0x60
190+ if (begin () == 0x58 ) return (true ); // Begin normal init with these settings. Should return chip ID of 0x58 for BMP
191+ if (begin () == 0x60 ) return (true ); // Begin normal init with these settings. Should return chip ID of 0x60 for BME
188192 return (false );
189193}
190194#endif
0 commit comments