README.rst
1.. zephyr:code-sample:: lsmd6dso_i2c_on_i3c
2 :name: LSM6DSO IMU sensor (I2C on I3C bus)
3 :relevant-api: sensor_interface
4
5 Get accelerometer and gyroscope data from an LSM6DSO sensor using I2C on I3C
6 bus (polling & trigger mode).
7
8Overview
9********
10This sample sets the date rate of LSM6DSO accelerometer and gyroscope to
1112.5Hz and enables a trigger on data ready. It displays on the console
12the values for accelerometer and gyroscope.
13
14Requirements
15************
16
17This sample uses the LSM6DSO sensor controlled using the I2C interface
18exposed by the I3C controller. It has been tested using the LSM6DSO on
19the evaluation board STEVAL-MKI196V1 connected to the I3C header
20on :zephyr:board:`mimxrt685_evk`.
21
22References
23**********
24
25- LSM6DSO https://www.st.com/en/mems-and-sensors/lsm6dso.html
26
27Building and Running
28********************
29
30This project outputs sensor data to the console. It requires an LSM6DSO
31sensor (for example, the one on evaluation board STEVAL-MKI196V1).
32
33Building on mimxrt685_evk board
34====================================
35
36.. zephyr-app-commands::
37 :zephyr-app: samples/sensor/lsm6dso_i2c_on_i3c
38 :host-os: unix
39 :board: mimxrt685_evk/mimxrt685s/cm33
40 :goals: build
41 :compact:
42
43Board Preparations
44==================
45
46mimxrt685_evk
47------------------
48
49On the board :zephyr:board:`mimxrt685_evk`, the I3C pins are exposed on the J18
50header, where:
51
52 * SCL is on pin 1
53 * SDA is on pin 2
54 * Internal pull-up is on pin 3 (which is connected to pin 2 already)
55 * Ground is on pin4
56
57LSM6DSO
58^^^^^^^
59
60A LSM6DSO sensor needs to be connected to this header. For example,
61the evaluation board STEVAL-MKI196V1 can be used. This needs to be
62prepared so that the LSM6DSO sensor has address 0x6B (i.e. 0xD6,
63left-shifed).
64
65Sample Output
66=============
67
68.. code-block:: console
69
70 Testing LSM6DSO sensor in trigger mode.
71
72 accel x:-0.650847 ms/2 y:-5.300102 ms/2 z:-8.163114 ms/2
73 gyro x:-0.167835 dps y:-0.063377 dps z:0.002367 dps
74 trig_cnt:1
75
76 accel x:0.341575 ms/2 y:5.209773 ms/2 z:-7.938787 ms/2
77 gyro x:-0.034284 dps y:-0.004428 dps z:-0.003512 dps
78 trig_cnt:2
79
80 <repeats endlessly>
81