README.rst
1.. zephyr:code-sample:: i2c-rtio-loopback
2 :name: I2C RTIO loopback
3 :relevant-api: rtio i2c_interface
4
5 Perform I2C transfers between I2C controller and custom I2C target using RTIO.
6
7Overview
8********
9
10This sample demonstrates how to perform I2C transfers, synchronously and async
11using RTIO. It uses up to two I2C controllers, acting as I2C controller and
12target.
13
14Requirements
15************
16
17This sample requires either:
18
19* Two I2C controllers, one supporting the I2C controller role, one supporting the
20 I2C peripheral role, both connected to the same I2C bus.
21* An I2C controller supporting both I2C controller and peripheral role
22 simultaneously.
23
24.. note::
25
26 Remember to set up the I2C bus, connecting SCL and SDA pull-up resistors, and
27 connecting the relevant I2C controllers to the bus physically.
28
29Board support
30*************
31
32Any board which meets the requirements must use an overlay to specify which
33I2C controller will act as the controller, and which as the peripheral, note
34that this could be the same controller. This is done using the devicetree
35aliases ``i2c-controller`` and ``i2c-controller-target`` respectively:
36
37.. code-block:: devicetree
38
39 / {
40 aliases {
41 i2c-controller = &i2c1;
42 i2c-controller-target = &i2c2;
43 };
44 };
45
46If necessary, add any board specific configs to the board specific overlay:
47
48.. code-block:: cfg
49
50 CONFIG_I2C_TARGET_BUFFER_MODE=y
51