Skip to content

Commit cdda1b4

Browse files
committed
sample/board: add SensorTile.box sample for testing
Add sample to test SensorTile.box board. Signed-off-by: Armando Visconti <[email protected]>
1 parent d197b5c commit cdda1b4

File tree

5 files changed

+520
-0
lines changed

5 files changed

+520
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Copyright (c) 2019 STMicroelectronics
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
#
5+
cmake_minimum_required(VERSION 3.13.1)
6+
7+
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
8+
project(sensortile_box)
9+
10+
target_sources(app PRIVATE src/main.c)
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
.. _sensortile_box sensors:
2+
3+
ST SensorTile.box
4+
#################
5+
6+
Overview
7+
********
8+
This sample provides an example of how to read sensors data
9+
from the SensorTile.box board.
10+
11+
This sample enables all sensors of SensorTile.box board, and then
12+
periodically reads and displays data on the console from the following
13+
sensors:
14+
15+
- HTS221: ambient temperature and relative humidity
16+
- LPS22HH: ambient temperature and atmospheric pressure
17+
- LIS2DW12: 3-Axis acceleration
18+
- LSM6DSOX: 6-Axis acceleration and angular velocity
19+
- STTS751: temperature sensor
20+
21+
Requirements
22+
************
23+
24+
The application requires a SensorTile.box board connected to the PC
25+
through USB. The board declares itself as a USB CDC class device.
26+
27+
References
28+
**********
29+
30+
- :ref:`sensortile_box`
31+
32+
Building and Running
33+
********************
34+
35+
Build and flash the sample in the following way:
36+
37+
.. zephyr-app-commands::
38+
:zephyr-app: samples/boards/sensortile_box
39+
:board: sensortile_box
40+
:goals: build flash
41+
42+
Please note that flashing the board requires a few preliminary steps described
43+
in :ref:`sensortile_box`.
44+
45+
Then, power cycle the board by disconnecting and reconnecting the USB cable.
46+
Run your favorite terminal program to listen for output.
47+
48+
.. code-block:: console
49+
50+
$ minicom -D <tty_device> -b 115200
51+
52+
Replace :code:`<tty_device>` with the port where the SensorTile.box board
53+
can be found. For example, under Linux, :code:`/dev/ttyUSB0`.
54+
The ``-b`` option sets baud rate ignoring the value from config.
55+
56+
Sample Output
57+
=============
58+
59+
The sample code outputs sensors data on the SensorTile.box console.
60+
61+
.. code-block:: console
62+
63+
SensorTile.box dashboard
64+
65+
HTS221: Temperature: 26.4 C
66+
HTS221: Relative Humidity: 60.5%
67+
LPS22HH: Temperature: 28.4 C
68+
LPS22HH: Pressure:99.694 kpa
69+
LIS2DW12: Accel (m.s-2): x: 0.306, y: -0.459, z: 10.031
70+
LSM6DSOX: Accel (m.s-2): x: -0.158, y: 0.158, z: 9.811
71+
LSM6DSOX: GYro (dps): x: 0.003, y: 0.000, z: -0.005
72+
STTS751: Temperature: 27.0 C
73+
1:: lps22hh trig 206
74+
1:: lis2dw12 trig 410
75+
1:: lsm6dsox acc trig 836
76+
1:: lsm6dsox gyr trig 836
77+
78+
<repeats endlessly every 2s>
79+
80+
If you move the board around or put your finger on the temperature
81+
sensor, you will see the accelerometer, gyro, and temperature values change.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
CONFIG_LOG=y
2+
CONFIG_PRINTK=y
3+
CONFIG_SPI=y
4+
CONFIG_I2C=y
5+
CONFIG_GPIO=y
6+
7+
# config sensors
8+
CONFIG_SENSOR=y
9+
CONFIG_SENSOR_LOG_LEVEL_DBG=y
10+
CONFIG_HTS221=y
11+
CONFIG_LPS22HH=y
12+
CONFIG_LPS22HH_TRIGGER_OWN_THREAD=y
13+
CONFIG_LIS2DW12=y
14+
CONFIG_LIS2DW12_TRIGGER_OWN_THREAD=y
15+
CONFIG_LSM6DSO=y
16+
CONFIG_LSM6DSO_TRIGGER_OWN_THREAD=y
17+
CONFIG_STTS751=y
18+
CONFIG_STTS751_TRIGGER_NONE=y
19+
20+
# config USB and USB console
21+
CONFIG_USB=y
22+
CONFIG_USB_DEVICE_VID=0x0483
23+
CONFIG_USB_DEVICE_PID=0x1234
24+
CONFIG_USB_DEVICE_STACK=y
25+
CONFIG_USB_DEVICE_PRODUCT="Zephyr CDC SensorTile.box"
26+
27+
CONFIG_USB_UART_CONSOLE=y
28+
CONFIG_UART_INTERRUPT_DRIVEN=y
29+
CONFIG_UART_LINE_CTRL=y
30+
CONFIG_UART_CONSOLE_ON_DEV_NAME="CDC_ACM_0"
31+
CONFIG_USB_UART_DTR_WAIT=y
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
sample:
2+
description: SensorTile.box board testing
3+
name: SensorTile.box test
4+
tests:
5+
sample.board.sensortile_box.sensors:
6+
harness: sensor
7+
platform_whitelist: sensortile_box
8+
tags: sensors
9+
depends_on: i2c spi gpio

0 commit comments

Comments
 (0)