
AN4594
Application note
Getting started with the STM32 Nucleo and the sensor expansion
board X-NUCLEO-IKS01A1
Introduction
This document describes how to develop a sensor-based application using the STM32
Nucleo platform and the X-NUCLEO-IKS01A1 sensor expansion board, in the STM32Cube
software environment. The sensor expansion board is a multi-sensor board with
temperature, humidity, pressure and motion MEMS measuring sensors.
November 2014 DocID026958 Rev 1 1/16
www.st.com
16

Contents AN4594
Contents
1 Acronyms and abbreviations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2 Getting started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.1 Hardware description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.1.1 STM32F401RE Nucleo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.1.2 Sensor expansion board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.2 Software description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.2.1 STM32Cube . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2.2 Firmware for STM32 Nucleo with X-NUCLEO-IKS01A1 expansion
board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.3 Hardware and software setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.3.1 Hardware setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.3.2 Software setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.3.3 System setup guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3 Software overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.1 Software architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.2 STM32Cube HAL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.3 Board support package (BSP) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4 Guide for writing applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
4.1 Relevant APIs for sensor applications . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
4.1.1 Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
4.2 Application description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .11
5 Using the Sensors_Datalog application . . . . . . . . . . . . . . . . . . . . . . . . 12
6 Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2/16 DocID026958 Rev 1

AN4594 Acronyms and abbreviations
1 Acronyms and abbreviations
Table 1. Acronyms and abbreviations
Acronym Description
BSP Board support package
GUI Graphical user interface
HAL Hardware abstraction layer
2
I
C Inter integrated circuit
IDE Integrated development environment
LED Light emitting diode
DocID026958 Rev 1 3/16
16

Getting started AN4594
2 Getting started
2.1 Hardware description
This section describes the individual hardware components required for developing a
sensor-based application.
2.1.1 STM32F401RE Nucleo
STM32F401RE Nucleo board belongs to the STM32F401xD/xE range which is based on
the high-performance ARM®Cortex™-M4 32-bit RISC core operating at a frequency of up
to 84 MHz. Its Cortex-M4 core features a single-precision Floating Point Unit (FPU) which
supports all ARM single-precision data-processing instructions and data types. It also
implements a full set of DSP instructions and a memory protection unit (MPU) which
enhances application security. It provides an affordable and flexible way for users to try new
ideas and build prototypes with any STM32 microcontroller lines. The Arduino™
connectivity support and ST Morpho headers make it easy to expand the functionality of the
Nucleo open development platform with a wide range of specialized expansion boards to
choose from. The STM32 Nucleo board does not require any separate probes as it
integrates the ST-LINK/V2-1 debugger/programmer. The STM32 Nucleo board comes with
the comprehensive STM32 HAL software library, together with various packaged software
examples.
The STM32F401RE Nucleo firmware and related documentation are available on st.com at
http://www.st.com/web/en/catalog/mmc/FM141/SC1169/SS1577/LN1810/PF258797
Figure 1. STM32-F4 nucleo board
2.1.2 Sensor expansion board
The X-NUCLEO-IKS01A1 is a sensor expansion board usable with the STM32 Nucleo
system. It is also compatible with the Arduino UNO R3 connector layout, and is designed
around the STMicroelectronics Humidity (HTS221), Pressure (LPS25H) and Motion sensors
(LIS3MDL and LSM6DS0). The X-NUCLEO-IKS01A1 interfaces with the STM32 MCU via
2
the I
C pin, but the user can change the default I2C port and the device IRQ by changing
one resistor on the expansion board.
4/16 DocID026958 Rev 1

AN4594 Getting started
Figure 2. X-NUCLEO-IKS01A1 sensor expansion board
Figure 3. Sensor expansion board connected to STM32 Nucleo board
The X-CUBE-MEMS1 firmware and related documentation is available on st.com at
http://www.st.com/x-nucleo.
2.2 Software description
The following software components are required to set up a suitable development
environment for creating applications based on the sensor expansion board:
• STM32Cube environment and related firmware for the STM32Nucleo and sensor
expansion board
• Development tool chain and compiler: IAR embedded workbench IDE is the
development environment used for the applications described in this document.
DocID026958 Rev 1 5/16
16