title: BMP280 ServiceSpecificException: I/O error (code 5)
body: <p>I try to use AndroidThings to measure temperature with Raspberry Pi 3 and BMP280.</p>
  
  <p><a href="https://i.stack.imgur.com/ns1rC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ns1rC.png" alt="enter image description here"></a></p>
  
  <p>3,3V i have choosed because of <a href="https://learn.adafruit.com/adafruit-bmp280-barometric-pressure-plus-temperature-sensor-breakout/pinouts" rel="nofollow noreferrer">specification of BMP280</a>:</p>
  
  <blockquote>
    <p>To power the board, give it the same power as the logic level of your microcontroller</p>
  </blockquote>
  
  <p>Then i want to initialize sensor</p>
  
  <pre><code>mTemperatureSensorDriver = new Bmx280SensorDriver("I2C1");
  </code></pre>
  
  <p>And by execution i receive following exeption</p>
  
  <pre><code>Error configuring sensor
      com.google.android.things.pio.PioException: android.os.ServiceSpecificException: I/O error (code 5)
      at com.google.android.things.pio.I2cDeviceImpl.readRegByte(I2cDeviceImpl.java:81)
      at com.google.android.things.contrib.driver.bmx280.Bmx280.connect(Bmx280.java:215)
      at com.google.android.things.contrib.driver.bmx280.Bmx280.&lt;init&gt;(Bmx280.java:193)
      at com.google.android.things.contrib.driver.bmx280.Bmx280.&lt;init&gt;(Bmx280.java:180)
      at com.google.android.things.contrib.driver.bmx280.Bmx280SensorDriver.&lt;init&gt;(Bmx280SensorDriver.java:55)
  </code></pre>
  
  <p>Also by 5V Power i receive the same exception.</p>
  
  <p>I have found <a href="https://github.com/androidthings/drivers-samples/issues/6" rel="nofollow noreferrer">this</a>. But i have no idea how to check, if the BMP280 is realy connected to Raspberry with adb.</p>
  
  <p>By <a href="http://zenandroid.io/writing-a-driver-for-android-things-bme280-humidity-sensor/" rel="nofollow noreferrer">own testing</a> the connectivity i receive by <code>device.readRegByte(0xD0)</code> the same exeption.</p>
  
  <p>Does it mean, that BMP280 is not correctly connected?
  If yes, how to correctly connect BMP280 with Raspberry?</p>
  
  <p>Is some resistor needed by connection?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>solved by soldering BMP280 with header strip.</p>
  
  <p>Also to work with sensor is permission requiered that could be granded only in command line. <a href="https://stackoverflow.com/questions/47596612/android-things-doesnt-grant-permissions-on-boot-what-gives?rq=1">ref</a></p>
  
  <p><code>adb shell pm grant app.package com.google.android.things.permission.MANAGE_SENSOR_DRIVERS</code></p>