I2C tools usage

Source: Internet
Author: User

1. Get the source code of I2C tools

Reference: http://lm-sensors.org/wiki/I2CTools

$ Wget http://dl.lm-sensors.org/i2c-tools/releases/i2c-tools-3.1.0.tar.bz2

2. Compile the source code

$ Tar-jxvf i2c-tools-3.1.0.tar.bz2

$ I2c-tools-3.1.0 CD

$ Cc = arm-None-Linux-gnueabi-GCC make (if not for embedded system, so without cc = arm-None-Linux-gnueabi-GCC)

Then you will get i2cdetct,
I2cget, i2cset,
I2cdump under tools directory.

3. Copy these tools to embedded system and use them

3.1 i2cdetect -- detect I2C Devices

$./I2cdetect-R 0

3.2 i2cdump -- dump I2C device information (EEPROM as an example)

$./I2cdump-F-Y 0 0x50 (0 is I2C bus number, 0x50 is the eeprom I2C address)

3.3 i2cset -- write some where (device 0x50, offset 0x3, value 0x5)

$. /I2cset-F-Y 0 0x50 0x3 0x5 (write address 0x3 with value 0x5 on I2C bus 0, the I2C device address is 0x50)

3.4 i2cget -- read some where (device 0x50, offset 0x3)

$./I2cget-F-Y 0 0x50 0x3 (read address 0x3 on I2C bus 0, the I2C device address is 0x50)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.