06-09-2020 08:09 PM
I have made my own custom Arduino compatible boards, and I have tested them using drivers from Adafruit.
Unfortunately, the Adafruit drivers does not detect the BME280 drivers, but drivers from Seeed can see it.
Can anybody tell me why the Adafruit drivers won't work, but the Grove driver does?
Thanks!
Solved! Go to Solution.
06-10-2020 05:12 AM
Because I have only STM32 platform and only use C API code. I didn't verify these reference codes you offered, and only offer some simple sugguestions based on our sensor configuration and offical API code of C.
From the Adafruit drivers,it uses force mode, but it doesn't setup some parametes.
void Adafruit_BME280::setSampling(sensor_mode mode,
sensor_sampling tempSampling,
sensor_sampling pressSampling,
sensor_sampling humSampling,
sensor_filter filter,
standby_duration duration) {
_measReg.mode = mode;
_measReg.osrs_t = tempSampling;
_measReg.osrs_p = pressSampling;
_humReg.osrs_h = humSampling;
_configReg.filter = filter;
_configReg.t_sb = duration;
// making sure sensor is in sleep mode before setting configuration
// as it otherwise may be ignored
write8(BME280_REGISTER_CONTROL, MODE_SLEEP);
// you must make sure to also set REGISTER_CONTROL after setting the
// CONTROLHUMID register, otherwise the values won't be applied (see
// DS 5.4.3)
write8(BME280_REGISTER_CONTROLHUMID, _humReg.get());
write8(BME280_REGISTER_CONFIG, _configReg.get());
write8(BME280_REGISTER_CONTROL, _measReg.get());
}
This function need setup parameters , but in this drivers, only call this function without parametes.
setSampling(); // use defaults call this function
From the Grove driver, it setups parameters directly, ans use normal mode.
writeRegister(BME280_REG_CONTROLHUMID, 0x05); //Choose 16X oversampling
writeRegister(BME280_REG_CONTROL, 0xB7); //Choose 16X oversampling
Expect your verification and answer.
06-11-2020 04:46 PM
Hi,
Thanks for your inquiry.
If the issue is resolved, please click "Accept as Solution" button.
Thanks.
11-13-2020 06:05 AM
I know it's been 5 months since I posted this question.
I tried commenting off the setSampling function on the Adafruit drivers, but they still won't detect my device.
Anyway, I gave up and used the Grove drivers instead.
Thanks!