Skip to content
Permalink
Browse files

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 <armando.visconti@st.com>
  • Loading branch information...
avisconti authored and MaureenHelm committed Jan 28, 2019
1 parent 1969974 commit 75e1f4ef1ab1a4c2b1b17941d46d971d440facbf
@@ -297,6 +297,7 @@
/samples/sensor/ @MaureenHelm
/samples/net/updatehub/ @chtavares592 @otavio
/samples/sensor/ @bogdan-davidoaia
/samples/shields/ @avisconti
/samples/subsys/logging/ @nordic-krch @jakub-uC
/samples/subsys/shell/ @jakub-uC @nordic-krch
/samples/subsys/usb/ @jfischer-phytec-iot @finikorg
@@ -0,0 +1,17 @@
# Copyright (c) 2019 STMicroelectronics
#
# SPDX-License-Identifier: Apache-2.0
#
cmake_minimum_required(VERSION 3.13.1)

# This sample is specific to x_nucleo_iks01a3 shield. Enforce -DSHIELD option
set(SHIELD x_nucleo_iks01a3_shub)

# IKS01A3 board configured in sensorhub mode
set(CONF_FILE shub.conf)

include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
project(x_nucleo_iks01a3)

FILE(GLOB app_sources src/*.c)
target_sources(app PRIVATE ${app_sources})
@@ -0,0 +1,80 @@
.. _x-nucleo-iks01a3-shub-sample:

X-NUCLEO-IKS01A3: shield (Mode 2) sample
########################################

Overview
********
This sample is provided as an example to test the X-NUCLEO-IKS01A3 shield
configured in Sensor Hub mode (Mode 2).
Please refer to :ref:`x-nucleo-iks01a3` for more info on this configuration.

This sample enables LIS2DW12 and LSM6DSO sensors. Since all other shield
devices are connected to LSM6DSO, the LSM6DSO driver is configured in sensorhub
mode (CONFIG_LSM6DSO_SENSORHUB=y) with a selection of two maximum slaves
among LPS22HH, HTS221 and LIS2MDL (default is LIS2MDL + LPS22HH).

Then sensor data are displayed periodically

- LIS2DW12 3-Axis acceleration
- LSM6DSO 6-Axis acceleration and angular velocity
- LSM6DSO (from LIS2MDL) 3-Axis magnetic field intensity
- LSM6DSO (from LPS22HH) ambient temperature and atmospheric pressure

Optionally HTS221 can substitute one between LIS2MDL and LPS22HH

- LSM6DSO (from HTS221): ambient temperature and relative humidity


Requirements
************

This sample communicates over I2C with the X-NUCLEO-IKS01A3 shield
stacked on a board with an Arduino connector. The board's I2C must be
configured for the I2C Arduino connector (both for pin muxing
and device tree). See for example the :ref:`nucleo_f401re_board` board
source code:

- :file:`$ZEPHYR_BASE/boards/arm/nucleo_f401re/nucleo_f401re.dts`
- :file:`$ZEPHYR_BASE/boards/arm/nucleo_f401re/pinmux.c`

Please note that this sample can't be used with boards already supporting
one of the sensors available on the shield (such as disco_l475_iot1)
as sensors multiple instances are not supported.

References
**********

- X-NUCLEO-IKS01A3: http://www.st.com/en/ecosystems/x-nucleo-iks01a3.html

Building and Running
********************

This sample runs with X-NUCLEO-IKS01A3 stacked on any board with a matching
Arduino connector. For this example, we use a :ref:`nucleo_f401re_board` board.

.. zephyr-app-commands::
:zephyr-app: samples/shields/x_nucleo_iks01a3/sensorhub/
:host-os: unix
:board: nucleo_f401re
:goals: build
:compact:

Sample Output
=============

.. code-block:: console


X-NUCLEO-IKS01A3 sensor dashboard

LIS2DW12: Accel (m.s-2): x: -0.077, y: 0.536, z: 9.648
LSM6DSO: Accel (m.s-2): x: -0.062, y: -0.028, z: 10.035
LSM6DSO: GYro (dps): x: -0.003, y: -0.001, z: 0.000
LSM6DSO: Magn (gauss): x: -0.052, y: -0.222, z: -0.059
LSM6DSO: Temperature: 27.9 C
LSM6DSO: Pressure:100.590 kpa
1:: lsm6dso acc trig 208
1:: lsm6dso gyr trig 208

<updated endlessly every 2 seconds>
@@ -0,0 +1,9 @@
sample:
name: X-NUCLEO-IKS01A3 sensor shield
tests:
test:
platform_exclude: disco_l475_iot1
harness: shield
tags: shield
depends_on: arduino_i2c arduino_header
platform_exclude: disco_l475_iot1
@@ -0,0 +1,16 @@
CONFIG_LOG=y
CONFIG_STDOUT_CONSOLE=y
CONFIG_I2C=y
CONFIG_I2C_STM32_INTERRUPT=y
CONFIG_SENSOR=y
CONFIG_SENSOR_LOG_LEVEL_DBG=y
CONFIG_LIS2DW12=y
CONFIG_LIS2DW12_TRIGGER_NONE=y
CONFIG_LSM6DSO=y
CONFIG_LSM6DSO_ENABLE_TEMP=n
CONFIG_LSM6DSO_INT_PIN_1=y
CONFIG_LSM6DSO_TRIGGER_OWN_THREAD=y
CONFIG_LSM6DSO_SENSORHUB=y
CONFIG_LSM6DSO_EXT_LIS2MDL=y
CONFIG_LSM6DSO_EXT_LPS22HH=y
CONFIG_LSM6DSO_EXT_HTS221=n

0 comments on commit 75e1f4e

Please sign in to comment.
You can’t perform that action at this time.