I am having trouble reading and writing to the registers of the INA226 current/power monitor in linux.
http://www.ti.com/product/ina226
I'm running with CentOS 6.5
[root@PCIE7207 ~]# i2cdetect -l
i2c-0 i2c i915 gmbus ssc I2C adapter
i2c-1 i2c i915 gmbus vga I2C adapter
i2c-2 i2c i915 gmbus panel I2C adapter
i2c-3 i2c i915 gmbus dpc I2C adapter
i2c-4 i2c i915 gmbus dpb I2C adapter
i2c-5 i2c i915 gmbus dpd I2C adapter
i2c-6 i2c DPDDC-B I2C adapter
i2c-7 smbus SMBus I801 adapter at 3040 SMBus adapter
[root@PCIE7207 ~]# i2cdetect 7
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-7.
I will probe address range 0x03-0x77.
Continue? [Y/n] y
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- 08 -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- 18 -- 1a -- -- 1d -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: 30 -- 32 -- -- 35 -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- 44 -- -- -- -- -- -- -- -- -- -- --
50: 50 -- 52 -- -- 55 -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
[root@PCIE7207 ~]#
The ina266 device is 0x44
Cannot write to 2nd byte
[root@PCIE7207 ~]# i2cset -y 7 0x44 0x00 0x4127 w
[root@PCIE7207 ~]# i2cdump -y 7 0x44 w
0,8 1,9 2,a 3,b 4,c 5,d 6,e 7,f
00: 4100 b700 1800 0000 0000 0000 0800 0000
Cannot write 55 to the 2nd byte
[root@PCIE7207 ~]# i2cset -y 7 0x44 0x00 0x5555 w
[root@PCIE7207 ~]# i2cdump -y 7 0x44 w
0,8 1,9 2,a 3,b 4,c 5,d 6,e 7,f
00: 5500 b400 1800 0000 0000 0000 0800 0000
Writing to the calibration register 0x5 has the same result
[root@PCIE7207 ~]# i2cset -y 7 0x44 0x05 0x2323 w
[root@PCIE7207 ~]# i2cdump -y7 0x44 w
0,8 1,9 2,a 3,b 4,c 5,d 6,e 7,f
00: 5500 b700 1800 8700 1200 2300 0800 0000
Not only can I not write to 2nd byte, the 2nd byte is also not displayed in the example above of power register, current register, etc.
Dumping with byte mode doesn't look correct
[root@PCIE7207 ~]# i2cdump -y 7 0x44 b
0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
00: 00 00 00 00 00 00 00 00 00 38 00 00 06 04 00 00 .........8..??..
Is i2cget i2cset and i2cdump not working correctly?