marcelbuesing/bme680

Error when trying to run the example

caemor opened this issue · 3 comments

Hi,

i always get the following error when i try to run your example on my rpi2:

Error: I2CWrite(Io(Os { code: 121, kind: Other, message: "Remote I/O error" }))

What device are you using? Or do i need to do anything before running the example?

Greetings

Hi,

I'm currently using a RPI 1 Model B and and BME680 Pimoroni Breakout.

Could you send me a stack trace (run with RUST_BACKTRACE=1) ?

No nothing specific besides enabling the I2C bus as described in the RPI documentation.

pi@raspberrypi:~ RUST_LOG=debug RUST_BACKTRACE=1 ./reading_temperature
DEBUG 2018-05-26T18:16:33Z: bme680: Reading chip id
DEBUG 2018-05-26T18:16:33Z: bme680: Chip id: 97
DEBUG 2018-05-26T18:16:33Z: bme680: Reading calib data
DEBUG 2018-05-26T18:16:33Z: bme680: Calib data CalibData { par_h1: 712, par_h2: 1022, par_h3: 0, par_h4: 45, par_h5: 20, par_h6: 120, par_h7: -100, par_gh1: -29, par_gh2: -7963, par_gh3: 18, par_t1: 26401, par_t2: 26683, par_t3: 3, par_p1: 34802, par_p2: -10297, par_p3: 88, par_p4: 6614, par_p5: -79, par_p6: 30, par_p7: 18, par_p8: 227, par_p9: -3774, par_p10: 30, res_heat_range: 1, res_heat_val: 49, range_sw_err: 0 }
 INFO 2018-05-26T18:16:33Z: bme680: Finished device init
 INFO 2018-05-26T18:16:33Z: reading_temperature: Duration Duration { secs: 1, nanos: 533000000 }
 INFO 2018-05-26T18:16:33Z: reading_temperature: Setting sensor settings
DEBUG 2018-05-26T18:16:33Z: bme680: GAS_MEAS_SEL: true
DEBUG 2018-05-26T18:16:33Z: bme680: Setting register reg: 90 tmp_buf: [90, 115]
DEBUG 2018-05-26T18:16:33Z: bme680: Setting register reg: 100 tmp_buf: [100, 215]
DEBUG 2018-05-26T18:16:33Z: bme680: Current power mode: SleepMode
DEBUG 2018-05-26T18:16:33Z: bme680: Already in sleep Target power mode: 1
DEBUG 2018-05-26T18:16:33Z: bme680: Setting register reg: 116 tmp_buf: [116, 1]
DEBUG 2018-05-26T18:16:33Z: bme680: OST_SEL: true
DEBUG 2018-05-26T18:16:33Z: bme680: OSP_SEL: true
DEBUG 2018-05-26T18:16:33Z: bme680: OSH_SEL: true
DEBUG 2018-05-26T18:16:33Z: bme680: RUN_GAS_SEL: true
DEBUG 2018-05-26T18:16:33Z: bme680: NBCONV_SEL: true
DEBUG 2018-05-26T18:16:33Z: bme680: Setting register reg: 116 tmp_buf: [116, 144]
DEBUG 2018-05-26T18:16:33Z: bme680: Setting register reg: 114 tmp_buf: [114, 2]
DEBUG 2018-05-26T18:16:33Z: bme680: Setting register reg: 113 tmp_buf: [113, 16]
 INFO 2018-05-26T18:16:33Z: reading_temperature: Setting forced power modes
DEBUG 2018-05-26T18:16:33Z: bme680: Current power mode: SleepMode
DEBUG 2018-05-26T18:16:33Z: bme680: Already in sleep Target power mode: 145
DEBUG 2018-05-26T18:16:33Z: bme680: Setting register reg: 116 tmp_buf: [116, 145]
 INFO 2018-05-26T18:16:33Z: reading_temperature: Sensor settings: Ok(SensorSettings { gas_sett: GasSett { nb_conv: 0, heatr_ctrl: None, run_gas: Some(1), heatr_temp: Some(115), heatr_dur: Some(Duration { secs: 0, nanos: 215000000 }) }, tph_sett: TphSett { os_hum: Some(OS2x), os_temp: Some(OS8x), os_pres: Some(OS8x), filter: None } })
 INFO 2018-05-26T18:16:38Z: reading_temperature: Sensor power mode: Ok(SleepMode)
 INFO 2018-05-26T18:16:38Z: reading_temperature: Setting forced power modes
DEBUG 2018-05-26T18:16:38Z: bme680: Current power mode: SleepMode
DEBUG 2018-05-26T18:16:38Z: bme680: Already in sleep Target power mode: 145
DEBUG 2018-05-26T18:16:38Z: bme680: Setting register reg: 116 tmp_buf: [116, 145]
 INFO 2018-05-26T18:16:38Z: reading_temperature: Retrieving sensor data
DEBUG 2018-05-26T18:16:38Z: bme680: Buf [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], len: 15
DEBUG 2018-05-26T18:16:38Z: bme680: Field data read [160, 0, 97, 32, 64, 122, 99, 32, 83, 121, 128, 0, 0, 180, 245], len: 15
DEBUG 2018-05-26T18:16:38Z: bme680: adc_temp: 501298 adc_pres: 397828 adc_hum: 21369 adc_gas_res: 723, t_fine: 128481
 INFO 2018-05-26T18:16:38Z: reading_temperature: Sensor Data FieldData { status: 176, gas_index: 0, meas_index: 0, temperature: 2509, pressure: 97809, humidity: 52868, gas_resistance: 214194 }
 INFO 2018-05-26T18:16:38Z: reading_temperature: Temperature 25.09°C
 INFO 2018-05-26T18:16:38Z: reading_temperature: Pressure 978.09hPa
 INFO 2018-05-26T18:16:38Z: reading_temperature: Humidity 52.868%

My output for i2cdetect

pi@raspberrypi:~ $ i2cdetect -y -l
i2c-1	i2c       	bcm2835 I2C adapter             	I2C adapter

Maybe your device path is different to mine(/dev/i2c-1)?

pi@raspberrypi:~ $ i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- 76 --   

Yes the last part helped. I forgot to check if my i2c id is different -.-

The Watterott manual says:
TWI/I2C Interface (address 0x76 when SDO=0 or 0x77 when SDO=1, CS=1 for I2C)

Although i didn't connect anything to SDO it seems to get pulled up, so i needed to use 77 or connect it to ground.

Thank you very much :-)

Glad to hear that. Maybe I'll also turn the i2c address u8 into a proper documented enum. Sorry for the barely existing documentation, I'll fix that in the next release.