I2C Slave on Linux

Hi all!

I need to interface with a device via I2C. The problem I have is that such device only can work as master.

These days I was searching info about I2C in slave mode in Linux. I would like to make a program which is running, when the master (the external device) sends a certain command, then the salve (the DB) sends a certain data.

I found documentation talking about I2C in salve mode in kernel.org in the i2c page, also I found these document from Qualcomm, but I think I haven’t understood very well the documents because my program isn’t working. I previously created user-space driver to work with I2C in master mode and I was more easy to me. In particular I don’t know how to work with the I2C events described in the first link

Which documentation should I read to create the program I need? It’s correct to say that I need to create a user space driver to work with I2C in slave mode? Any example, documentation, page, examples,… would be so helpful!

Thank you so much guys!

Before you get started have you confirmed that the hardware has I2C slave support. I don’t think the DB410C supports running in slave mode (or at least the kernel drivers don’t appear have any code to support this mode).

If I’m right about that then you’ll need a micro-controller to mediate so your I2C slave code will end up on that micro-controller anyway.

Hi @andribiotic

@danielt is correct, I2C Slave mode is not supported by the processor on the 410c DragonBoard. Please look at the Device Specification Page 83, it clearly states that slave mode is not supported.

Full Disclosure: I am an employee of Qualcomm Canada, any opinions I may have expressed in this or any other post may reflect the opinions of my employer.

Since Dragonboard410c is out of option for implementing i2c slave mode, you can also take a look at Hikey/Hikey960 boards. Both uses designware i2c IP which supports Slave mode and the driver has been updated recently for the same.

Thanks,
Mani

Thank you for your responses! I have to use this device with the DB, so I will use the UART port, it’s supported by both devices I need to use.