I2C tools libi2c-dev, i2c-tools view the peripherals on the IIC bus line

The name of I2C actually needs to be corrected. This is a common and widespread misnomer. The correct name is I squared C (I²C) , but everyone has agreed, so I2C is called that.

IIC (Inter-Integrated Circuit) is actually the abbreviation of IICBus, so it should be called integrated circuit bus in Chinese. It is a serial communication bus that uses a multi-master-slave architecture. Developed for connecting low-speed peripheral devices.

The I2C serial bus generally has two signal lines, one is the bidirectional data line SDA, and the other is the clock line SCL . All the serial data SDA connected to the I2C bus device are connected to the SDA of the bus, and the clock line SCL of each device is connected to the SCL of the bus. Among them, SDA is for transmitting data, and SCL is for synchronous sending and receiving.

View peripherals

First obtain the permission of the peripheral

sudo usermod -a -G i2c jetson #jetson 为用户名

Then install the viewing tool

sudo apt-get install libi2c-dev i2c-tools

There may be mistakes here, generally it is a problem of mirroring, use domestic ones, the mirrors of Ali and Tsinghua are listed below (I can use Tsinghua mirrors)

backup first

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

Ali Mirror:

deb http://mirrors.aliyun.com/ubuntu/deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

Tsinghua Mirror:

deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic main multiverse restricted universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-security main multiverse restricted universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-updates main multiverse restricted universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-backports main multiverse restricted universe
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic main multiverse restricted universe
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-security main multiverse restricted universe
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-updates main multiverse restricted universe
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-backports main multiverse restricted univers

edit:

cat vim /etc/apt/sources.list

Delete the mirror source inside, copy and paste the mirror source above, enter " :wq Enter " to save and exit

If there is a problem with the image, we can delete the image content file, and then change the name of the backup back, or try another image source:

sudo rm /etc/apt/sources.list
sudo mv /etc/apt/sources.list.bak /etc/apt/sources.list

Use i2cdetect to detect several sets of i2c buses on the system:

i2cdetect -l
i2c-3i2c 7000c700.i2c I2C adapter
i2c-1i2c 7000c400.i2c I2C adapter
i2c-8i2c i2c-6-mux (chan_id 1) I2C adapter
i2c-6i2c Tegra I2C adapter I2C adapter
i2c-4i2c 7000d000.i2c I2C adapter
i2c-2i2c 7000c500.i2c I2C adapter
i2c-0i2c 7000c000.i2c I2C adapter
i2c-7i2c i2c-6-mux (chan_id 0) I2C adapter
i2c-5i2c 7000d100.i2c I2C adapter

Use i2cdetect to detect devices mounted on the i2c-1 bus:

i2cdetect -r -y 1

Supongo que te gusta

Origin blog.csdn.net/weixin_41896770/article/details/129613443
Recomendado
Clasificación