0

BME280 via DTOverlay Fails, But using 100% python query works! Enable DTOverLay for BME280 in /boot/config.txt...**

dtparam=i2c_arm=on
dtoverlay=i2c-sensor,bme280,addr=0x77
# i2cdetect -y 1
     0  1  2  3  4  5  6  7  8
00: -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- 57 --
60: -- -- -- -- -- -- -- -- 68
70: -- -- -- -- -- -- -- UU --

And thus...

/sys/bus/i2c/devices/i2c-1/1-0077/iio:device0

Doing above, I get something weird...

# dmesg | grep bmp
[ 40.014592] bmp280 1-0077: supply vddd not found, using dummy regulator
[ 40.016315] bmp280 1-0077: supply vdda not found, using dummy regulator
[ 366.730552] bmp280 1-0077: reading temperature skipped

But something is working given i2cdetect reports UU for address 0x77. And...

# ls -l /sys/bus/i2c/devices/i2c-1/1-0077/iio:device0
total 0
-r--r--r-- 1 root root 4096 Feb 17 17:06 dev
-rw-r--r-- 1 root root 4096 Feb 17 17:06 in_humidityrelative_input
-rw-r--r-- 1 root root 4096 Feb 17 17:06 in_humidityrelative_oversampling_ratio
-rw-r--r-- 1 root root 4096 Feb 17 17:06 in_pressure_input
-rw-r--r-- 1 root root 4096 Feb 17 17:06 in_pressure_oversampling_ratio
-rw-r--r-- 1 root root 4096 Feb 17 17:06 in_temp_input
-rw-r--r-- 1 root root 4096 Feb 17 17:06 in_temp_oversampling_ratio
-r--r--r-- 1 root root 4096 Feb 17 17:06 name
lrwxrwxrwx 1 root root 0 Feb 17 17:06 of_node -> ../../../../../../../firmware/devicetree/base/soc/i2c@7e804000/bme280@77
drwxr-xr-x 2 root root 0 Feb 17 17:06 power
lrwxrwxrwx 1 root root 0 Feb 17 17:06 subsystem -> ../../../../../../../bus/iio
-rw-r--r-- 1 root root 4096 Feb 17 17:06 uevent

And... I seem to be able to read the sensor for temperature and pressure...

# cat /sys/bus/i2c/devices/i2c-1/1-0077/iio:device0/in_pressure_input
102.316898437
# cat /sys/bus/i2c/devices/i2c-1/1-0077/iio:device0/in_temp_input
26380

But I can't read humidity?

# cat /sys/bus/i2c/devices/i2c-1/1-0077/iio:device0/in_humidityrelative_input
cat: '/sys/bus/i2c/devices/i2c-1/1-0077/iio:device0/in_humidityrelative_input': Input/output error

If I remove the overlay, and use say python to read the sensor, everything works! For example my python script output...

Sensor BME280 (BMX@77), Method BMX, Index 07, Device 0x77, Temperature 25.2490234375 C, Humidity 22.80308219212777 %, Pressure 1023.1955739321498 hPA
1
  • what is your question?
    – jsotola
    Feb 21, 2022 at 19:28

1 Answer 1

0

Did not actually solve this. But after a trace dump of the overlay driver, after a reboot, the issue resolved. SD card was good, image was good. Hardware was good. Appears, that the I2C bus was just doing something odd. Typically when the I2C bus has issues you get a 121 error where communication with the given I2C device fails completely. This appears to have been the exception to the rule... it was a specific command/sequence/register on the sensor that was failing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.