Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

i2cdump works but not i2cget

I am trying to use a BMP180 over i2c on a Raspberry Pi.

I detect the chip. I can take a i2cdump, but I cannot read out a single byte.

Any idea what I am doing wrong?

Print out:

$ sudo 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: -- -- -- -- -- -- -- 77

$ sudo i2cdump -y 1 0x77
No size specified (using byte-data access)
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
00: XX XX XX XX XX 00 XX 00 XX XX XX 00 XX XX 00 XX    XXXXX.X.XXX.XX.X
10: 00 XX XX 00 XX XX 00 XX 00 XX 00 XX 00 XX 00 XX    .XX.XX.X.X.X.X.X
20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
80: a5 94 48 09 2a 27 78 7b 8a 7e 1f 05 fb b0 c7 c2    ??H?*'x{?~??????
90: 82 18 63 d2 4c b8 19 73 00 28 80 00 d1 f6 09 b2    ??c?L??s.(?.????
a0: a5 94 48 09 2a 27 78 7b 8a 7e 1f 05 fb b0 c7 c2    ??H?*'x{?~??????
b0: 82 18 63 d2 4c b8 19 73 00 28 80 00 d1 f6 09 b2    ??c?L??s.(?.????
c0: 00 00 bc 33 00 00 00 00 00 00 00 10 00 00 00 03    ..?3.......?...?
d0: 55 02 06 00 00 00 00 00 00 00 00 00 00 00 00 00    U??.............
e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
f0: 00 00 00 00 00 00 80 00 00 00 00 00 00 00 00 00    ......?.........

$ sudo i2cget -y 1 0x77 0xd0
Error: Read failed
like image 589
user3769000 Avatar asked Feb 26 '15 19:02

user3769000


1 Answers

You first have to set-up the control registers. For a BME280 (I suppose it is the same for the BME180), one has to write:

$ i2cset -y 1 0x76 0xF2 0x01
$ i2cset -y 1 0x76 0xF4 0x25
$ i2cdump -y -r 0xF7-0xFE 1 0x76 c
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
f0:                      6d 72 00 86 68 00 59 bb              mr.?h.Y? 

The first 2 writes set oversampling x1 to all channels. The second additionally starts a single conversion.

like image 87
F Corthay Avatar answered Oct 01 '22 00:10

F Corthay