I am using a zed board with a Zynq 7000 on it. The end goal is to have the I2c-0 controller in the physical PS of the Zynq7000 to act as an I2c slave device.

I am using yocto/bitbake to generate linux images for my device. So far, I have been able to map my I2c-0 device SDA and SCK lines to physical pins on the zed board. I have overwritten the zynq-7000.dtsi with my own device tree to enable the i2c0 device.

From the linux shell of my board, I can see the i2c device with "i2cdetect -l" which gives the following output:

root@zed-board:~# i2cdetect -l
i2c-0   i2c             Cadence I2C at e0004000                 I2C adapter

From a simple hello.c program I can use

#include <sys/ioctl.h>
#include <linux/i2c.h>
#include <linux/i2c-dev.h>

to write data with the i2c master and I can see the data coming out of my pins.

However, I have no idea how to configure this device as a slave. I can see from the cadence i2c driver code https://github.com/torvalds/linux/blob/master/drivers/i2c/busses/i2c-cadence.c that slave mode is supported. I used the kernel configuration menu from yocto to enabled i2c slave support then added that config to my image so it should be enabled.

I just don't know what i need to do so that from a user space application I can put the device into slave mode and register the callbacks for slave events.

Any help is much appreciated.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.