How to test i2c slave mode driver function in linux?

1. Hardware Requirements

  1.1 requires two machines, one as i2c master (referred to as M), and the other as i2c slave (referred to as S)

  1.2 i2c signal line Dupont line connecting the two machines

2. Enable kernel options CONFIG_I2C_SLAVE and CONFIG_I2C_SLAVE_EEPROM

  As can be compiled into the kernel module, chosen at random

3. Switch on the machine to the slave mode S, such as:

  echo slave-24c02 0x64 > /sys/bus/i2c/devices/i2c-0/new_device

4. The transmission data S to the machine on the machine M

  i2cset -f -y 0 0x64 1 0x3

The machine-readable data on the S as the machine M

  i2cget -f -y 0 0x64 1

6. Check the data received on the S machine

  hexdump -C /sys/bus/i2c/devices/0-0064/slave-eeprom

 

Guess you like

Origin www.cnblogs.com/dakewei/p/11310971.html