Beaglebone Black yocto (kirkstone) i2c-slave-eeprom problem


I’m pretty new to use Yocto and Embedded Linux. I’m trying to connect two Beaglebone Black using I2C bus and implement a communication protocol over I2C but I’m having some issues that I can’t solve by researching.

I’m compiling my own applications etc. using yocto and currently using both poky and oe kirkstone branch. I configured kernel using ‘bitbake -c menuconfig virtual/kernel’ and activated CONFIG_I2C_SLAVE and CONFIG_I2C_SLAVE_EEPROM, added i2ctools to try something.

I checked my configuration from beaglebone (/proc/config.gz) and my configuration was succseed.

Then I run ‘echo slave-24c02 0x1060 > /sys/bus/i2c/…/i2c-2/new_device’ and looked at the kernel logs. There was an issue about the adapter.

i2c-slave-eeprom 2-1060: i2c_slave_register: not supported by adapter
i2c-slave-eeprom: probe of 2-1060 failed with error -95
i2c i2c-2: new_device: Instantiated device slave slave-24c02 at 0x60

and as you can guess there is no such device at 0x60 slave address when I check it using i2cdetect from this device or another device connected to the i2c-2 bus…

Should I do something about the devicetree to open this bus using slave mode or Beaglebone Black just doesn’t support such thing?

By the way I know just a few thing about devicetree etc.

I found a patch to add slave support to i2c driver and used it to patch kernel (GitHub - enndubyu/omap_i2c_slave: Slave support for i2c-omap linux driver.).

The error is gone but still I’m not seeing any slave device when I look at the bus using i2cdetect -y -r 2

Is there anything I’m missing?

1 Like

You’re trying to use the i2c peripheral to send messages to itself as a slave, which doesn’t make sense. The i2c controller can act as the bus master or the slave during a transaction, but not both simultaneously. If you have another BBB or something like a Bus Pirate, then you can use it detect the slave-eeprom on the first BBB. Alternatively, you can connect i2c-1 and i2c-2 together and then use i2c-detect on i2c-1 to detect the slave-eeprom on i2c-2. i2c-1 isn’t exposed on the header by default, but there should be a way to configure the pinmux such that both i2c busses are accessible via the header.

1 Like

I didn’t face the problem you mentioned. I wasn’t expecting to write or read from the slave that is on the same device, but I expected to see it when I run the i2cdetect command.

For example:

0x60: UU -- -- -- -- ...

However, I found the mistake: my kernel configuration was missing, so the kernel didn’t have CONFIG_I2C_SLAVE enabled. After configuring the kernel correctly and applying the patch I mentioned earlier, I was able to detect the slave.

After that, I tried writing to and reading from this slave using another BeagleBone Black connected to the i2c-2 bus, and it was successful.

Thank you for your answer. The issue has been resolved.

1 Like