Skip to content

Commit 75e1f4e

Browse files
aviscontiMaureenHelm
authored andcommitted
sample/shield: add support to x-nucleo-iks01a3 shield
Provide two basic example samples to test the x-nucleo-iks01a3 shield: - Standard (Mode 1) - SensorHub (Mode 2) Signed-off-by: Armando Visconti <[email protected]>
1 parent 1969974 commit 75e1f4e

File tree

11 files changed

+863
-0
lines changed

11 files changed

+863
-0
lines changed

CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@
297297
/samples/sensor/ @MaureenHelm
298298
/samples/net/updatehub/ @chtavares592 @otavio
299299
/samples/sensor/ @bogdan-davidoaia
300+
/samples/shields/ @avisconti
300301
/samples/subsys/logging/ @nordic-krch @jakub-uC
301302
/samples/subsys/shell/ @jakub-uC @nordic-krch
302303
/samples/subsys/usb/ @jfischer-phytec-iot @finikorg
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright (c) 2019 STMicroelectronics
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
#
5+
cmake_minimum_required(VERSION 3.13.1)
6+
7+
# This sample is specific to x_nucleo_iks01a3 shield. Enforce -DSHIELD option
8+
set(SHIELD x_nucleo_iks01a3_shub)
9+
10+
# IKS01A3 board configured in sensorhub mode
11+
set(CONF_FILE shub.conf)
12+
13+
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
14+
project(x_nucleo_iks01a3)
15+
16+
FILE(GLOB app_sources src/*.c)
17+
target_sources(app PRIVATE ${app_sources})
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
.. _x-nucleo-iks01a3-shub-sample:
2+
3+
X-NUCLEO-IKS01A3: shield (Mode 2) sample
4+
########################################
5+
6+
Overview
7+
********
8+
This sample is provided as an example to test the X-NUCLEO-IKS01A3 shield
9+
configured in Sensor Hub mode (Mode 2).
10+
Please refer to :ref:`x-nucleo-iks01a3` for more info on this configuration.
11+
12+
This sample enables LIS2DW12 and LSM6DSO sensors. Since all other shield
13+
devices are connected to LSM6DSO, the LSM6DSO driver is configured in sensorhub
14+
mode (CONFIG_LSM6DSO_SENSORHUB=y) with a selection of two maximum slaves
15+
among LPS22HH, HTS221 and LIS2MDL (default is LIS2MDL + LPS22HH).
16+
17+
Then sensor data are displayed periodically
18+
19+
- LIS2DW12 3-Axis acceleration
20+
- LSM6DSO 6-Axis acceleration and angular velocity
21+
- LSM6DSO (from LIS2MDL) 3-Axis magnetic field intensity
22+
- LSM6DSO (from LPS22HH) ambient temperature and atmospheric pressure
23+
24+
Optionally HTS221 can substitute one between LIS2MDL and LPS22HH
25+
26+
- LSM6DSO (from HTS221): ambient temperature and relative humidity
27+
28+
29+
Requirements
30+
************
31+
32+
This sample communicates over I2C with the X-NUCLEO-IKS01A3 shield
33+
stacked on a board with an Arduino connector. The board's I2C must be
34+
configured for the I2C Arduino connector (both for pin muxing
35+
and device tree). See for example the :ref:`nucleo_f401re_board` board
36+
source code:
37+
38+
- :file:`$ZEPHYR_BASE/boards/arm/nucleo_f401re/nucleo_f401re.dts`
39+
- :file:`$ZEPHYR_BASE/boards/arm/nucleo_f401re/pinmux.c`
40+
41+
Please note that this sample can't be used with boards already supporting
42+
one of the sensors available on the shield (such as disco_l475_iot1)
43+
as sensors multiple instances are not supported.
44+
45+
References
46+
**********
47+
48+
- X-NUCLEO-IKS01A3: http://www.st.com/en/ecosystems/x-nucleo-iks01a3.html
49+
50+
Building and Running
51+
********************
52+
53+
This sample runs with X-NUCLEO-IKS01A3 stacked on any board with a matching
54+
Arduino connector. For this example, we use a :ref:`nucleo_f401re_board` board.
55+
56+
.. zephyr-app-commands::
57+
:zephyr-app: samples/shields/x_nucleo_iks01a3/sensorhub/
58+
:host-os: unix
59+
:board: nucleo_f401re
60+
:goals: build
61+
:compact:
62+
63+
Sample Output
64+
=============
65+
66+
.. code-block:: console
67+
68+
69+
X-NUCLEO-IKS01A3 sensor dashboard
70+
71+
LIS2DW12: Accel (m.s-2): x: -0.077, y: 0.536, z: 9.648
72+
LSM6DSO: Accel (m.s-2): x: -0.062, y: -0.028, z: 10.035
73+
LSM6DSO: GYro (dps): x: -0.003, y: -0.001, z: 0.000
74+
LSM6DSO: Magn (gauss): x: -0.052, y: -0.222, z: -0.059
75+
LSM6DSO: Temperature: 27.9 C
76+
LSM6DSO: Pressure:100.590 kpa
77+
1:: lsm6dso acc trig 208
78+
1:: lsm6dso gyr trig 208
79+
80+
<updated endlessly every 2 seconds>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
sample:
2+
name: X-NUCLEO-IKS01A3 sensor shield
3+
tests:
4+
test:
5+
platform_exclude: disco_l475_iot1
6+
harness: shield
7+
tags: shield
8+
depends_on: arduino_i2c arduino_header
9+
platform_exclude: disco_l475_iot1
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
CONFIG_LOG=y
2+
CONFIG_STDOUT_CONSOLE=y
3+
CONFIG_I2C=y
4+
CONFIG_I2C_STM32_INTERRUPT=y
5+
CONFIG_SENSOR=y
6+
CONFIG_SENSOR_LOG_LEVEL_DBG=y
7+
CONFIG_LIS2DW12=y
8+
CONFIG_LIS2DW12_TRIGGER_NONE=y
9+
CONFIG_LSM6DSO=y
10+
CONFIG_LSM6DSO_ENABLE_TEMP=n
11+
CONFIG_LSM6DSO_INT_PIN_1=y
12+
CONFIG_LSM6DSO_TRIGGER_OWN_THREAD=y
13+
CONFIG_LSM6DSO_SENSORHUB=y
14+
CONFIG_LSM6DSO_EXT_LIS2MDL=y
15+
CONFIG_LSM6DSO_EXT_LPS22HH=y
16+
CONFIG_LSM6DSO_EXT_HTS221=n

0 commit comments

Comments
 (0)