Get Registers Of I2C Device; Get Temperature Of Lm75 - SMART Embedded Computing COMX-P2020 BSP User Manual

Hide thumbs Also See for COMX-P2020 BSP:
Table of Contents

Advertisement

Linux Deployment
7.4

Get Registers of I2C Device

The application "i2cget" can be used to get registers of i2c device:
[root@COMX-P2020 /]# ./usr/sbin/i2cget --help
Error: Unsupported option "--help"!
Usage: i2cget [-f] [-y] I2CBUS CHIP-ADDRESS [DATA-ADDRESS
[MODE]]
[root@COMX-P2020 /]#
To Read the first byte of AT24C02, run the command:
[root@COMX-P2020 /]# ./usr/sbin/i2cget 0 0x50 0
WARNING! This program can confuse your I2C bus, cause data
loss and worse!
I will read from device file /dev/i2c-0, chip address 0x50,
data address
0x00, using read byte data.
Continue? [Y/n] y
0x4e
[root@COMX-P2020 /]#
7.5

Get Temperature of LM75

[root@P2020RDB lib]# /usr/sbin/i2cget 1 0x48 0
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will read from device file /dev/i2c-1, chip address 0x48, data address
0x00, using read byte data.
Continue? [Y/n] y
0x2d
[root@P2020RDB lib]#
The 0x2d means that current temperature is 45 degree Celsius.
96
I2CBUS is an integer or an I2C bus name
ADDRESS is an integer (0x03 - 0x77)
MODE is one of:
b (read byte data, default)
w (read word data)
c (write byte/read byte)
Append p for SMBus PEC
COMX-P2020 BSP User Guide (6806800L84C)
Linux Deployment

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the COMX-P2020 BSP and is the answer not in the manual?

Table of Contents