Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 27 additions & 0 deletions boards/arm/nucleo_f401re/nucleo_f401re.dts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,33 @@
led0 = &green_led_2;
sw0 = &user_button;
};

arduino_header: connector {
compatible = "arduino-header-r3";
#gpio-cells = <2>;
gpio-map = <0 0 &gpioa 0 0>, /* A0 */
<1 0 &gpioa 1 0>, /* A1 */
<2 0 &gpioa 4 0>, /* A2 */
<3 0 &gpiob 0 0>, /* A3 */
<4 0 &gpioc 1 0>, /* A4 */
<5 0 &gpioc 0 0>, /* A5 */
<6 0 &gpioa 3 0>, /* D0 */
<7 0 &gpioa 2 0>, /* D1 */
<8 0 &gpioa 10 0>, /* D2 */
<9 0 &gpiob 3 0>, /* D3 */
<10 0 &gpiob 5 0>, /* D4 */
<11 0 &gpiob 4 0>, /* D5 */
<12 0 &gpiob 10 0>, /* D6 */
<13 0 &gpioa 8 0>, /* D7 */
<14 0 &gpioa 9 0>, /* D8 */
<15 0 &gpioc 7 0>, /* D9 */
<16 0 &gpiob 6 0>, /* D10 */
<17 0 &gpioa 7 0>, /* D11 */
<18 0 &gpioa 6 0>, /* D12 */
<19 0 &gpioa 5 0>, /* D13 */
<20 0 &gpiob 9 0>, /* D14 */
<21 0 &gpiob 8 0>; /* D15 */
};
};

&usart1 {
Expand Down
27 changes: 27 additions & 0 deletions boards/arm/nucleo_f411re/nucleo_f411re.dts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,33 @@
led0 = &green_led_2;
sw0 = &user_button;
};

arduino_header: connector {
compatible = "arduino-header-r3";
#gpio-cells = <2>;
gpio-map = <0 0 &gpioa 0 0>, /* A0 */
<1 0 &gpioa 1 0>, /* A1 */
<2 0 &gpioa 4 0>, /* A2 */
<3 0 &gpiob 0 0>, /* A3 */
<4 0 &gpioc 1 0>, /* A4 */
<5 0 &gpioc 0 0>, /* A5 */
<6 0 &gpioa 3 0>, /* D0 */
<7 0 &gpioa 2 0>, /* D1 */
<8 0 &gpioa 10 0>, /* D2 */
<9 0 &gpiob 3 0>, /* D3 */
<10 0 &gpiob 5 0>, /* D4 */
<11 0 &gpiob 4 0>, /* D5 */
<12 0 &gpiob 10 0>, /* D6 */
<13 0 &gpioa 8 0>, /* D7 */
<14 0 &gpioa 9 0>, /* D8 */
<15 0 &gpioc 7 0>, /* D9 */
<16 0 &gpiob 6 0>, /* D10 */
<17 0 &gpioa 7 0>, /* D11 */
<18 0 &gpioa 6 0>, /* D12 */
<19 0 &gpioa 5 0>, /* D13 */
<20 0 &gpiob 9 0>, /* D14 */
<21 0 &gpiob 8 0>; /* D15 */
};
};

&usart1 {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
103 changes: 103 additions & 0 deletions boards/shields/x_nucleo_iks01a3/doc/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
.. _x-nucleo-iks01a3:

X-NUCLEO-IKS01A3: MEMS Inertial and Environmental Multi sensor shield
#####################################################################

Overview
********
The X-NUCLEO-IKS01A3 is a motion MEMS and environmental sensor expansion board
for the STM32 Nucleo. It is equipped with Arduino UNO R3 connector layout, and
is designed around the LSM6DSO 3D accelerometer and 3D gyroscope, the LIS2MDL
3-axis magnetometer, the LIS2DW12 3-axis accelerometer, the HTS221 humidity and
temperature sensor, the LPS22HH pressure sensor, and the STTS751 temperature sensor.

The X-NUCLEO-IKS01A3 interfaces with the STM32 microcontroller via the I2C pin,
and it is possible to change the default I2C port.

.. image:: img/x-nucleo-iks01a3.jpg
:width: 786px
:height: 543px
:align: center
:alt: X-NUCLEO-IKS01A3

More information about the board can be found at the
`X-NUCLEO-IKS01A3 website`_.

Hardware Description
********************

X-NUCLEO-IKS01A3 provides the following key features:

- LSM6DO MEMS 3D accelerometer (±2/±4/±8/±16 g) and
3D gyroscope (±125/±250/±500/±1000/±2000 dps)
- LIS2MDL MEMS 3D magnetometer (±50 gauss)
- LIS2DW12 MEMS 3D accelerometer (±2/±4/±8/±16 g)
- LPS22HH MEMS pressure sensor, 260-1260 hPa absolute digital output barometer
- HTS221 capacitive digital relative humidity and temperature
- STTS751 Temperature sensor (-40 °C to +125 °C)
- DIL24 socket for additional MEMS adapters and other sensors (configurable in I2C or SPI)
- I2C sensor hub features on LSM6DSO available
- Compatible with STM32 Nucleo boards
- Equipped with Arduino UNO R3 connector
- RoHS compliant
- WEEE compliant

Hardware Configuration
**********************

X-NUCLEO-IKS01A3 board connects the various devices on two separate I2C bus:

- LIS2DW12 and LSM6DO are on I2C2
- LIS2MDL, LPS22HH, HTS221 are STTS751 are on I2C1

X-NUCLEO-IKS01A3 board can be configured in two different ways: Mode 1 and Mode 2


Mode 1: Standard Mode
=====================

In standard I2C mode the two buses are connected together. As a consequence, all devices on the shield
reside on the same I2C bus and are accessible from the main board thru I2C bus.

The jumper configuration to activate this mode is:

- JP7 => 1-2, 3-4 (I2C1 = I2C2, I2Cx=GND)
- JP8 => 1-2, 3-4 (I2C1 = I2C2, I2Cx=GND)


Mode 2: SensorHub Mode
======================

In SensorHub mode LSM6DSO and LIS2DW12 are connected to I2C2 and are accessible from the main board.
All the other devices are connected to LSM6DSO master thru I2C1.

The jumper configuration to activate this mode is:

- JP7 => 2-3 (I2C1 = I2Cx)
- JP8 => 2-3 (I2C1 = I2Cx)

More information about X-NUCLEO-IKS01A3 configuration modes can be found in the
`X-NUCLEO-IKS01A3 user manual`_

Programming
***********

Two samples are provided as examples for ``x-nucleo-iks01a3`` shield:

- :ref:`x-nucleo-iks01a3-std-sample` application, to be used when the shield is configured
in Standard Mode
- :ref:`x-nucleo-iks01a3-shub-sample` application, to be used when the shield is configured
in SensorHub Mode

See also :ref:`shields` for more details.

References
**********

.. target-notes::

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

.. _X-NUCLEO-IKS01A3 user manual:
https://www.st.com/resource/en/user_manual/dm00601501.pdf
41 changes: 41 additions & 0 deletions boards/shields/x_nucleo_iks01a3/x_nucleo_iks01a3.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright (c) 2019 STMicroelectronics
*
* SPDX-License-Identifier: Apache-2.0
*/

&arduino_i2c {

hts221@5f {
compatible = "st,hts221";
reg = <0x5f>;
label = "HTS221";
};

lps22hh@5d {
compatible = "st,lps22hh";
reg = <0x5d>;
drdy-gpios = <&arduino_header 12 0>; /* D6 */
label = "LPS22HH";
};

lis2mdl@1e {
compatible = "st,lis2mdl-magn";
reg = <0x1e>;
label = "LIS2MDL";
};

lis2dw12@19 {
compatible = "st,lis2dw12";
reg = <0x19>;
irq-gpios = <&arduino_header 3 0>; /* A3 */
label = "LIS2DW12";
};

lsm6dso@6b {
compatible = "st,lsm6dso";
reg = <0x6b>;
irq-gpios = <&arduino_header 10 0>; /* D4 */
label = "LSM6DSO";
};
};
22 changes: 22 additions & 0 deletions boards/shields/x_nucleo_iks01a3/x_nucleo_iks01a3_shub.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright (c) 2019 STMicroelectronics
*
* SPDX-License-Identifier: Apache-2.0
*/

&arduino_i2c {

lis2dw12@19 {
compatible = "st,lis2dw12";
reg = <0x19>;
irq-gpios = <&arduino_header 3 0>; /* A3 */
label = "LIS2DW12";
};

lsm6dso@6b {
compatible = "st,lsm6dso";
reg = <0x6b>;
irq-gpios = <&arduino_header 10 0>; /* D4 */
label = "LSM6DSO";
};
};
17 changes: 17 additions & 0 deletions samples/shields/x_nucleo_iks01a3/sensorhub/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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})
80 changes: 80 additions & 0 deletions samples/shields/x_nucleo_iks01a3/sensorhub/README.rst
Original file line number Diff line number Diff line change
@@ -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>
9 changes: 9 additions & 0 deletions samples/shields/x_nucleo_iks01a3/sensorhub/sample.yaml
Original file line number Diff line number Diff line change
@@ -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
16 changes: 16 additions & 0 deletions samples/shields/x_nucleo_iks01a3/sensorhub/shub.conf
Original file line number Diff line number Diff line change
@@ -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
Loading