How to write a own I2C(slave) driver? #i2s #slave #driver

Stefan Jaritz


I am currently checking the documentation for a "How to do an I2C slave driver" and I did not find some tutorial.

Hopefully some guys can quickly tell me how to do it.

My hardware setup: custom stm32f412 board + IC connected via I2C_1 (Pin B9 & B8)

I created an out of tree board and added at the dts file:

&i2c1 {
    status = "ok";
    clock-frequency = <I2C_BITRATE_FAST>;

I setup the pins in the pinmux.c with these two lines:

#ifdef CONFIG_I2C_1

Think form this side the I2C should be rightfully configured.

Now I like to access the IC connected via I2C_1. How to do that?

How I link my code to the I2C_1 device, write the protocoll functions and build an API around that?

Any ideas examples are welcome!


Join to automatically receive all group messages.