I2C

Make sure that I2C is enabled, if not do it using sudo raspi-config. Install the i2c tools sudo apt-get install i2c-tools

If enabled i2cdetect -l shows the raspberries I2C host interfaces. A Raspberry Zero has two of them:

i2c-1 i2c bcm2835 (i2c@7e804000) I2C adapter

i2c-2 i2c bcm2835 (i2c@7e805000) I2C adapter

sudo i2cdetect 1 will show what is attached on i2c-1 (as example a LM75 chip)

sudo i2cdump -y 1 0x4f will read the LM75 chip

sudo i2cget -y 1 0x4f 0x00 will read 8 bit from its register 0

sudo i2cget -y 1 0x4f 0x00 w will read 16bit from its register 0

The i2c clock frequency can be modified in /boot/firmware/config.txt

dtparam=i2c_arm=on,i2c_arm_baudrate=10000

to have 10kHz and the do sudo reboot


Linurs startpage