UM2041 User manual How to use the STEVAL-WESU1 Introduction The STEVAL-WESU1 system reference design represents a highly efficient and effective solution for precise motion sensing in wearable applications. The system embeds a low power ARM Cortex-M3 microcontroller unit (STM32L151VE), an iNEMO inertial module (LSM6DS3), a high performance magnetometer (LIS3MDL), a barometric pressure sensor (LPS25HB), a Bluetooth® low energy wireless network processor (BLUENRG-MS) and power management circuitry that allows fast charging and precise energy estimation (STNS01 and STC3115). The connectivity, granted by the best in class BLUENRG-MS and supported by the integrated balun (BALF-NRG-01D3), combines maximum RF performance with low area occupancy and design effort. The system has passed the RF Test for FCC certification (FCC ID: S9NWESU1) and IC certification (IC ID: 8976C-WESU1). STEVAL-WESU1 FW provides a complete framework to build wearable applications, using inertial and environmental sensor drivers, battery profile measurements, and Bluetooth low energy for data communication. It is built on the STM32Cube™ framework, which facilitates customization and the integration of further middleware algorithms. An application layer based on the BlueST protocol (see Section 5: "BlueST Protocol SDK") streams data from different devices (inertial and environmental sensors plus battery devices and RSSI) and algorithms, while a serial console over BLE allows control over the configuration parameters of the connected boards. An ST-WESU™ app based on the the BlueST protocol logs all sensor data and provides demos for algorithms, battery detection and RSSI levels. It includes a command line interface through a debug console, allowing further control via internal permanent and session setting registers. Figure 1: STEVAL-WESU1 package May 2016 DocID029122 Rev 2 1/81 www.st.com Contents UM2041 Contents 1 2 3 Getting started ................................................................................. 7 1.1 System setup guide ........................................................................... 9 1.2 ST WeSU app setup ......................................................................... 9 1.3 System requirements ...................................................................... 10 STEVAL-WESU1 hardware description........................................ 11 2.1 STEVAL-WESU1 board connections .............................................. 12 2.2 ST-LINK connections ...................................................................... 12 2.3 Exposed pad connectors ................................................................. 13 2.4 Hardware architecture ..................................................................... 14 2.4.2 Sensors ............................................................................................ 18 2.4.3 Bluetooth low energy connectivity .................................................... 19 2.4.4 Battery and power management ...................................................... 20 3.1 Overview ......................................................................................... 22 3.2 Architecture ..................................................................................... 22 3.3 Folder structure ............................................................................... 23 3.3.1 Documentation ................................................................................. 24 3.3.2 Drivers .............................................................................................. 24 3.3.3 Middleware ....................................................................................... 25 3.3.4 Projects folder ................................................................................... 25 3.3.5 Demonstration firmware overview .................................................... 26 3.3.6 Example firmware overview ............................................................. 31 3.4 Utilities ............................................................................................ 32 3.5 Device firmware upgrade ................................................................ 33 3.5.1 DFU using USB ................................................................................ 33 3.5.2 DFU using OTA ................................................................................ 36 Toolchains ....................................................................................... 38 ST WeSU app ................................................................................. 40 4.1 2/81 Microcontroller .................................................................................. 15 STEVAL-WESU1 Firmware............................................................ 22 3.6 4 2.4.1 Demo overview ............................................................................... 44 4.1.1 Mems sensor fusion demo ............................................................... 45 4.1.2 Environmental demo......................................................................... 48 4.1.3 Plot data demo ................................................................................. 49 DocID029122 Rev 2 UM2041 Contents 4.1.4 4.2 5 Action list overview .......................................................................... 54 4.2.1 Start/stop logging .............................................................................. 54 4.2.2 Settings ............................................................................................. 54 4.2.3 Debug console .................................................................................. 55 4.2.4 Serial console ................................................................................... 57 4.2.5 BLE standby ..................................................................................... 57 4.2.6 Reboot .............................................................................................. 57 BlueST Protocol SDK .................................................................... 58 5.1 5.2 5.3 6 Algorithm demos............................................................................... 51 Advertising format ........................................................................... 58 5.1.1 Bluetooth low energy AD structure (max. 31 bytes) ......................... 58 5.1.2 AD structures .................................................................................... 58 Services/characteristics .................................................................. 59 5.2.1 HW single feature packet ................................................................. 60 5.2.2 Aggregate feature packet ................................................................. 61 5.2.3 SW single feature packet 1/2 ........................................................... 62 5.2.4 Configuration settings ....................................................................... 64 5.2.5 Debug ............................................................................................... 64 Registers ......................................................................................... 64 5.3.1 Register types ................................................................................... 65 5.3.2 Errors ................................................................................................ 65 Board schematic and bill of material ........................................... 66 6.1 Bill of material.................................................................................. 66 6.2 Schematic diagrams........................................................................ 70 7 Formal notices required by the U.S. Federal Communications Commission ("FCC") ............................................................................. 77 8 Formal notices required by the Industry Canada ("IC") ............. 78 9 10 Acronyms and abbreviations ....................................................... 79 Revision history ............................................................................ 80 DocID029122 Rev 2 3/81 List of tables UM2041 List of tables Table 1: Expansion connector GPIO description ...................................................................................... 16 Table 2: Memory mapping ........................................................................................................................ 30 Table 3: Permanent register location ........................................................................................................ 31 Table 4: Session register location ............................................................................................................. 31 Table 5: Package file list ........................................................................................................................... 34 Table 6: BLE advertising structure ............................................................................................................ 58 Table 7: BLE TX power level advertising field .......................................................................................... 58 Table 8: BLE advertising manuf.-specific advertising field ....................................................................... 58 Table 9: Group A features map ................................................................................................................ 59 Table 10: Group B features map .............................................................................................................. 59 Table 11: Device ID enumeration ............................................................................................................. 59 Table 12: Services/characteristics allocation map .................................................................................... 59 Table 13: Generic packet format .............................................................................................................. 60 Table 14: Motion sensors packet format................................................................................................... 61 Table 15: Battery packet format ................................................................................................................ 61 Table 16: Pressure packet format............................................................................................................. 61 Table 17: Temperature packet format ...................................................................................................... 61 Table 18: Motion packet format ................................................................................................................ 62 Table 19: Generic packet format .............................................................................................................. 62 Table 20: Sensor fusion packet format ..................................................................................................... 62 Table 21: Free fall packet format .............................................................................................................. 63 Table 22: Activity recognition packet format ............................................................................................. 63 Table 23: Valid activity types .................................................................................................................... 63 Table 24: Carry position packet format ..................................................................................................... 63 Table 25: Carry position type .................................................................................................................... 63 Table 26: Register access packet format ................................................................................................. 64 Table 27: Control field ............................................................................................................................... 64 Table 28: Error code mapping .................................................................................................................. 65 Table 29: Bill of material ........................................................................................................................... 66 Table 30: List of acronyms ........................................................................................................................ 79 Table 31: Document revision history ........................................................................................................ 80 4/81 DocID029122 Rev 2 UM2041 List of figures List of figures Figure 1: STEVAL-WESU1 package .......................................................................................................... 1 Figure 2: Inside the STEVAL-WESU1 package ......................................................................................... 7 Figure 3: STEVAL-WESU1 board ............................................................................................................... 7 Figure 4: LiPO battery ................................................................................................................................. 8 Figure 5: STEVAL-WESU1 SWD adapter .................................................................................................. 8 Figure 6: STEVAL-WESU1 silicone wristband ........................................................................................... 8 Figure 7: Plastic case housing the STEVAL-WESU1 board....................................................................... 9 Figure 8: ST WeSU Android iOS start page ............................................................................................. 10 Figure 9: STEVAL-WESU1 top side components .................................................................................... 11 Figure 10: STEVAL-WESU1 bottom side components ............................................................................ 12 Figure 11: STEVAL-WESU1 top and bottom side board connections ..................................................... 12 Figure 12: ST-Link connection using the adapter ..................................................................................... 13 Figure 13: STEVAL-WESU1 exposed pad connections for battery charging........................................... 13 Figure 14: USB plug with external USB connector for DFU update ......................................................... 14 Figure 15: USB connection with external plug after cutting ...................................................................... 14 Figure 16: STEVAL-WESU1 functional block diagram ............................................................................. 15 Figure 17: Microcontroller subsystem ....................................................................................................... 15 Figure 18: SWD connector and external peripheral connections ............................................................. 16 Figure 19: Programming adapter description ........................................................................................... 17 Figure 20: Sensor array ............................................................................................................................ 18 Figure 21: BLE connectivity subsystem .................................................................................................... 19 Figure 22: Battery and power management subsystem ........................................................................... 20 Figure 23: Battery connector .................................................................................................................... 21 Figure 24: USB connector with ESD protection ........................................................................................ 21 Figure 25: STEVAL-WESU1 firmware architecture .................................................................................. 23 Figure 26: STEVAL-WESU1 firmware package folder structure .............................................................. 23 Figure 27: firmware drivers folder ............................................................................................................. 24 Figure 28: BSP folders .............................................................................................................................. 24 Figure 29: Middleware folder .................................................................................................................... 25 Figure 30: Demonstrations and Examples folders .................................................................................... 26 Figure 31: Demo application folder ........................................................................................................... 27 Figure 32: Main function with internal infinite loop .................................................................................... 29 Figure 33: Example application files package .......................................................................................... 32 Figure 34: DFU driver installation ............................................................................................................. 33 Figure 35: DfuSe Demo ............................................................................................................................ 34 Figure 36: DfuSe Demo upgrade successful ............................................................................................ 35 Figure 37: DfuSe Demo leave DFU mode ................................................................................................ 36 Figure 38: ST BlueDFU start page ........................................................................................................... 37 Figure 39: ST BlueDFU working flow (Android Version) .......................................................................... 38 Figure 40: ST BlueDFU device update ..................................................................................................... 38 Figure 41: ST WeSU app start page (Android and iOS) ........................................................................... 40 Figure 42: ST WeSU app (Android and iOS) device list ........................................................................... 41 Figure 43: Node list (Android and iOS) commands .................................................................................. 41 Figure 44: Node status (Android and iOS) indication ............................................................................... 42 Figure 45: Nodes list (Android and iOS) menu ......................................................................................... 43 Figure 46: Demo index and Action menu (Android) ................................................................................. 43 Figure 47: Demo index and Action menu (iOS) ........................................................................................ 44 Figure 48: ST WeSU app (Android version) motion sensor fusion demo ................................................. 45 Figure 49: Freefall icons ........................................................................................................................... 45 Figure 50: Freefall events list .................................................................................................................... 46 Figure 51: Proximity sensor status (only if available) ............................................................................... 46 Figure 52: ST WeSU (Android) calibration ............................................................................................... 47 Figure 53: ST WeSU (Android) reset position .......................................................................................... 47 DocID029122 Rev 2 5/81 List of figures UM2041 Figure 54: Commands context menu........................................................................................................ 48 Figure 55: ST WeSU app (Android version) environmental demo ........................................................... 48 Figure 56: ST WeSU app (Android version) example plot (magnetometer values) ................................. 49 Figure 57: Plot length time scale selection ............................................................................................... 50 Figure 58: Features data plot selection .................................................................................................... 50 Figure 59: Activity recognition demo......................................................................................................... 51 Figure 60: Carry position demo ................................................................................................................ 52 Figure 61: Pedometer demo ..................................................................................................................... 53 Figure 62: RSSI and battery charging demo ............................................................................................ 54 Figure 63: Log settings ............................................................................................................................. 55 Figure 64: Debug console command list .................................................................................................. 56 Figure 65: Debug set node license dialog ................................................................................................ 57 Figure 66: IEEE 754 single reference ....................................................................................................... 62 Figure 67: Memory register mapping ........................................................................................................ 64 Figure 68: Main system blocks ................................................................................................................. 70 Figure 69: Microcontroller schematics ...................................................................................................... 71 Figure 70: Sensors subsystem schematics .............................................................................................. 72 Figure 71: Connectivity subsystem schematics ........................................................................................ 73 Figure 72: SWD and Reset connection schematics ................................................................................. 74 Figure 73: External connector schematics................................................................................................ 75 Figure 74: Battery and power management subsystem schematics ........................................................ 76 6/81 DocID029122 Rev 2 UM2041 1 Getting started Getting started The STEVAL-WESU1 is a system reference design for users wanting to develop wearable applications, with every element of the system designed to accelerate the development process: from embedded end-customer devices to mobile software development. Inside the STEVAL-WESU1 package, you will find all the main components that you need to experience the demo on our special platform firmware and dedicated mobile app. Figure 2: Inside the STEVAL-WESU1 package The package includes: One STEVAL-WESU1 reference design board (max. 35X30 mm size) Figure 3: STEVAL-WESU1 board DocID029122 Rev 2 7/81 Getting started UM2041 One LiPo 100mAh battery (UN38.3 certified) Figure 4: LiPO battery ST-LINK adapter and cable Figure 5: STEVAL-WESU1 SWD adapter Silicone wristband with fastening clip Figure 6: STEVAL-WESU1 silicone wristband 8/81 DocID029122 Rev 2 UM2041 Getting started Moulded plastic board and battery case Figure 7: Plastic case housing the STEVAL-WESU1 board 1.1 System setup guide Follow these steps to assemble the kit: 1. 2. 3. 4. 5. 6. 1.2 Take the board and carefully remove the disclaimer tab (save it, as it contains the FCC and IC certification numbers). Plug the battery to the connector on the back of the board. Open the plastic case and carefully place the board with the battery inside it, taking care to align the user button with the external button hole. Put one of the two buttons on this hole and then snap the case shut. Connect the USB cable to turn the board on for the first time, and verify that the red battery charging LED is lit. Insert the plastic case inside the silicone wristband shroud and verify button operation by pressing it to shut the board down and once more to turn the board on again. Fasten the wristband clip and enjoy the experience. ST WeSU app setup To visualize the information sent via Bluetooth low energy connectivity, install one of the following apps available for smartphones and tablets: ST WESU Android app available at Google Play™ store; ST WESU iOS app available at Apple Store™. To install this app, you need a smartphone or tablet which supports BLE technology (4.0 or higher) (i.e., iPhone 4S/Android OS 4.3 and above). DocID029122 Rev 2 9/81 Getting started UM2041 Figure 8: ST WeSU Android iOS start page Both versions of the app are based on a specific BlueST protocol SDK (see Section 5: "BlueST Protocol SDK"), which allows: 1.3 Plotting and logging of the data from all of the sensors (supporting multiple connections) Sensor and algorithm demos (also with multiple connections) Battery/RSSI information Debug console for command line interface Configurable run time settings System requirements The STEVAL-WESU1 reference board requires: 10/81 A Windows™ (version 7, 8, 8.1 or 10) PC running an IAR, KEIL or System Workbench for STM32 firmware development environment One USB type A to micro B male cable to connect the STEVAL-WESU1 to the PC or wall adapter for power supply "ST-LINK/V2" (or equivalent) in-circuit debugger/programmer "ST-LINK utility" for binary firmware download (find the latest embedded software version on www.st.com). An Android (4.3 or higher) or iOS (8.0 or higher) smartphone or tablet with BLE technology (4.0 or higher). DocID029122 Rev 2 UM2041 2 STEVAL-WESU1 hardware description STEVAL-WESU1 hardware description The STEVAL-WESU1 has the following main components mounted on the top side: STM32L151VEY6, ultra-low-power ARM Cortex-M3 MCU with 512 Kbytes FLASH, 48kBytes of RAM in WLCSP100 package BLUENRG-MS, Bluetooth low energy (BLE) single-mode network processor, compliant with Bluetooth specification core 4.1 BALF-NRG-01D3, 50 Ω balun for BLUENRG-MS transceiver with integrated harmonic filter LSM6DS3, iNEMO inertial module 3D accelerometer (±2/4/8/16g) + 3D gyroscope (±125/245/500/1000/2000dps) LIS3MDL, MEMS 3D magnetometer (±4/8/12/16 gauss) LPS25HB, MEMS pressure sensor, 260-1260 mBar absolute digital output barometer USBULC6-2M6 ultra large bandwidth ESD protection External oscillator LSE (32kHz) and HSE (24MHz) for the STM32L151VEY6 User button, white user LED and red charging LED USB, SWD and uFL connector (not mounted) chip antenna Figure 9: STEVAL-WESU1 top side components On the bottom side, the following main components are mounted: STC3115, gas gauge IC with alarm output STNS01, Li-Ion linear battery charger Battery connector External oscillator low speed (32 kHz) and high speed (32 MHz) for BlueNRG-MS. DocID029122 Rev 2 11/81 STEVAL-WESU1 hardware description UM2041 Figure 10: STEVAL-WESU1 bottom side components 2.1 STEVAL-WESU1 board connections The STEVAL-WESU1 includes several hardware connectors described below: micro-USB female plug, plus the same pins exposed in bottom pads. SWD connector (1.27 mm pitch) Battery connector Figure 11: STEVAL-WESU1 top and bottom side board connections 2.2 ST-LINK connections The ST-LINK V2 programmer is required to update the firmware. Plug the cable (with adapter, bundled with the package) to the board and then connect the laptop as shown below. 12/81 DocID029122 Rev 2 UM2041 STEVAL-WESU1 hardware description Figure 12: ST-Link connection using the adapter 2.3 Exposed pad connectors The STEVAL-WESU1 form factor can be reduced by cutting off the PCB tab hosting the USB and expansion connectors; the exposed pads on the bottom can be wired to the charger, as shown in the figure below: Figure 13: STEVAL-WESU1 exposed pad connections for battery charging The exposed external pads can also be used to upgrade the firmware via USB using the DFU strategies with the simple four-wire connection shown below. DocID029122 Rev 2 13/81 STEVAL-WESU1 hardware description UM2041 Figure 14: USB plug with external USB connector for DFU update The USB feature is accessible via the exposed pads on the bottom of the PCB using the cable connection shown below: Figure 15: USB connection with external plug after cutting 2.4 Hardware architecture The whole system can be described in four separate functional subsystems: 14/81 Microcontroller Sensors Connectivity Battery management DocID029122 Rev 2 UM2041 STEVAL-WESU1 hardware description The sensors and the BLUENRG-MS devices are connected to the microcontroller through two separate SPI peripherals, while the power management is driven via an I²C peripheral and GPIOs. Figure 16: STEVAL-WESU1 functional block diagram 2.4.1 Microcontroller STM32L151VEY6 is an ultra-low-power microcontroller unit based on the ARM® Cortex®M3. It features a wide range of low power modes and voltage scaling for excellent power saving capabilities. Figure 17: Microcontroller subsystem 2.4.1.1 SWD Connector and external peripheral connections The STEVAL-WESU1 is equipped with a custom 10 pin connector (1.27 mm pitch), which can be used: DocID029122 Rev 2 15/81 STEVAL-WESU1 hardware description UM2041 To program the microcontroller via a dedicated adapter connected to the programming tool (like ST-Link) As an expansion connector to allow user access to other board features, as described in the following table Figure 18: SWD connector and external peripheral connections GSPG2403161120SG SWD TP501 TP502 1 1 D_VDD SWD_SWDIO J500 1 3 5 7 9 LED_User PWR_I2C_SCL PWR_I2C_SDA 2 4 6 8 10 SWD/JTAG SWD_SWDIO SWD_SWCLK SWD_SWCLK RX232_ConJ500 Button_PowerOn 1 nRESET 2 R506 0 SMR0201 nRESET TP512 1 GND PWR_I2C_SCL PWR_I2C_SDA EXT_ConJ500 PWR_I2C_SCL PWR_I2C_SDA EXT_ConJ500 Table 1: Expansion connector GPIO description 16/81 Exp. Pin J500 Port/Pin Default Func. 3 B0 User LED 5 B8 PWR_I2C_SCL 6 A3 - 7 B9 PWR_I2C_SDA 8 A2 Push Button I²C USART PWM ADC TIM3CH3 ADC_CH8 USART2_RX TIM2CH4 ADC_CH3 USART2_TX TIM2CH3 ADC_CH2 I2C1_SCL I2C1_SDA DocID029122 Rev 2 UM2041 2.4.1.2 STEVAL-WESU1 hardware description Programming adapter Figure 19: Programming adapter description The programming adapter can be used as an in-circuit debugger/programmer connection through J9 or as an expansion connector through J5. It is equipped with the following jumpers: J1 and J2 for the UART: J1 and J2 must be set to the 2-3 position in order to use the J5 connector for signal monitoring on an oscilloscope or external connections through J5. Position 1-2 is reserved. DocID029122 Rev 2 17/81 STEVAL-WESU1 hardware description 2.4.2 UM2041 J10 (single position) for reset pin connection: J10 must be fitted to enable the programmer tool to reset the microcontroller; this also enables the S1 reset button.if you connect the adapter to WeSU board with J10 fitted, a reset command is issued. Sensors The integrated sensors are perfect for motion algorithms in wearable motion tracking, featuring extremely low power capabilities and advanced performance in terms of accuracy and embedded digital features. Figure 20: Sensor array 2.4.2.1 LSM6DS3 The LSM6DS3 is a system-in-package featuring a 3D digital accelerometer and a 3D digital gyroscope performing at 1.25 mA (up to 1.6 kHz ODR) in high performance mode and enabling always-on low-power features for an optimal motion experience for the consumer. Up to 8 Kbyte of FIFO with dynamic allocation of significant data (i.e., external sensors, timestamp, etc.) allows overall system power saving. ST’s family of MEMS sensor modules leverages the robust and mature manufacturing processes already used for the production of micromachined accelerometers and gyroscopes. The various sensing elements are manufactured using specialized micromachining processes, while the IC interfaces are developed using CMOS technology that allows the design of a dedicated circuit which is trimmed to better match the characteristics of the sensing element. The LSM6DS3 has a full-scale acceleration range of ±2/±4/±8/±16 g and an angular rate range of ±125/±245/±500/±1000/±2000 dps. High robustness to mechanical shock makes the LSM6DS3 the preferred choice of system designers for the creation and manufacturing of reliable products. The LSM6DS3 is available in a plastic land grid array (LGA) package. 2.4.2.2 LIS3MDL The LIS3MDL is an ultra-low-power high performance three-axis magnetic sensor. The LIS3MDL has user-selectable full scales of ±4/ ±8/ ±12/±16 gauss. The device may be configured to generate interrupt signals for magnetic field detection. The LIS3MDL includes an I²C serial bus interface that supports standard and fast mode (100 kHz and 400 kHz) and SPI serial standard interface. 18/81 DocID029122 Rev 2 UM2041 STEVAL-WESU1 hardware description The LIS3MDL is available in a small thin plastic land grid array package (LGA) and is guaranteed to operate over an extended temperature range of -40 °C to +85 °C. 2.4.2.3 LPS25HB The LPS25HB is an ultra-compact absolute piezo-resistive pressure sensor with an absolute range from 260 to 1260 hPa. It includes a monolithic sensing element and an IC interface able to take the information from the sensing element and to provide a digital signal to the external world. Thanks to its high accuracy (1 Pa RMS, 24-bit ADC resolution), its bandwidth (1 – 25 Hz) and its very low power consumption (4 µA low power mode, 25 µA high performance mode), the integration of this sensor is suitable for height estimation (e.g., VRU vertical reference unit) and to enhance standard IMU performance with a high frequency altitude reference. 2.4.3 Bluetooth low energy connectivity Figure 21: BLE connectivity subsystem 2.4.3.1 BLUENRG-MS and BALF-NRG-01D3 The BLUENRG-MS is a very low power Bluetooth low energy (BLE) single-mode network processor, compliant with Bluetooth specification v4.1. The BLUENRG-MS can act as master or slave. The entire Bluetooth low energy stack runs on the embedded Cortex M0 core. The non-volatile Flash memory allows on-field stack upgrading. The BLUENRG-MS allows applications to meet the tight advisable peak current requirements imposed with the use of standard coin cell batteries. The maximum peak current is only 8.2 mA at 0 dBm of output power. Ultra low-power sleep modes and very short transition times between operating modes allow very low average current consumption, resulting in longer battery life. The BLUENRG-MS offers the option of interfacing with external microcontrollers using the SPI transport layer. BALF-NRG-01D3 is a 50Ω conjugate match to BLUENRG-MS (QFN32 package) that integrates balun transformer and harmonics filtering. It features high RF performance with a very small footprint and RF BOM reduction. It has been chosen as the best trade-off between cost, size and high radio performance. The layout is optimized to suit a 4-layer design and a chip antenna. DocID029122 Rev 2 19/81 STEVAL-WESU1 hardware description 2.4.3.2 UM2041 uFL connector The uFL connector U201 (not mounted) is connected to the BLUENRG-MS RF path through C206 (not mounted). By soldering a 51 pF capacitor and desoldering L204, the uFL connector RF path can be activated; this is useful for debugging. 2.4.4 Battery and power management The power management system allows USB battery charging with the STNS01 USB battery charger; battery level information is provided by the STC3115 device. Figure 22: Battery and power management subsystem 2.4.4.1 STNS01 The STNS01 is a linear charger for single-cell Li-Ion batteries. In the STEVAL-WESU1 system, it is configured as a battery charger and also functions as a power path switch between the USB power source and the battery power source. The STNS01 battery charger is designed to charge single cell Li-Ion batteries up to 4.2 V using a CC-CV charging algorithm (see the STNS01 datasheet for more details). When a valid input voltage is detected, the STNS01 starts the charge cycle and the CHG pin switches from high impedance to low level. The CHG pin is connected to LED2 to monitor the charger. The charging status LED (LED 2) can be: steady ON: the USB plug is correctly connected and the board is charging steady OFF: the board is not charging; reconnect the USB cable to force a re-start) flashing: charging failure (e.g., overtemperature, three-wire battery not connected), or battery not present. The SYS pin is the voltage output of the STNS01 selected power path. This pin is connected to the linear voltage regulator providing VDD to all other devices. The STM32L151VE is also connected to its SHDN pin to disconnect the power delivery to most of the devices and enable the shipment mode. 2.4.4.2 STC3115 The STC3115 includes the hardware functions required to implement a low-cost gas gauge for battery monitoring. The STC3115 uses current sensing, Coulomb counting and accurate measurements of the battery voltage to estimate the state-of-charge (SOC) of the battery. An internal temperature sensor simplifies implementation of temperature compensation. 20/81 DocID029122 Rev 2 UM2041 STEVAL-WESU1 hardware description An alarm output signals a low SOC condition and can also indicate low battery voltage. The alarm threshold levels are programmable. The STC3115 offers advanced features to ensure high performance gas gauging in all application conditions. 2.4.4.3 Battery connector Battery connector is placed as shown in Figure 11: "STEVAL-WESU1 top and bottom side board connections", and the hardware connection is as shown in the figure below. Resistor R505 is placed as close as possible to this connector in order to sense the battery current more accurately, the value of which is then monitored by the STC3115 device. Figure 23: Battery connector BATTERY CONNECTOR VBAT BATT + SMT 3W 1.2 mm pitch Molex 78171-0003 RS: 700-0824P 2.4.4.4 2 2 J501 R505 PWR_NTC BATT- 1 3 2 1 C501 47µ F 10V SMD 080 5 1 GND 0.05 SMD 0402 GND GSPG2403161345SG USB connector The USB connector accepts a micro USB type B and it is used to charge the battery and to power the board even if battery is not present. The USBULC6-2M6 ESD protection just after the USB connector, avoids any voltage spike damages, due to the plug operations, towards all the devices powered. Figure 24: USB connector with ESD protection DocID029122 Rev 2 21/81 STEVAL-WESU1 Firmware UM2041 3 STEVAL-WESU1 Firmware 3.1 Overview This firmware package expands the functionality of the STM32Cube platform adding the following features to build a wearable application: 3.2 Complete mid-level driver set necessary to build applications using pressure and temperature sensor (LPS25HB) and motion sensors (LIS3MDL and LSM6DS3) Data logger sample application about inertial and environmental sensors measurements, battery profile measurements, and algorithm demos. The data acquisition from different sensors is provided via SPI, and battery charging profile via I2C. Complete middleware to easily communicate with a BLE client application using a proprietary protocol (BlueST Protocol SDK). Low power setting configurable by app. Command line interface (CLI) using a debug console by app. Configuration interface: using EEPROM (permanent) and RAM (session) settings. OTA/USB-DFU: Firmware upgrade over the air through BLE connectivity (using BlueST APP) or USB IF. Node locked license terms for open.MEMS algorithms. Architecture The firmware is based on the STM32Cube™ framework technology developed to build applications with the STM32 microcontroller. The package provides a board support package (BSP) for the sensors and the middleware components for Bluetooth low energy communication with any external mobile device. The firmware driver layers to access and use the hardware components are: 22/81 STM32Cube HAL layer: simple, generic, multi-instance APIs (Application Programming Interfaces) which interact with the upper layer applications, libraries and stacks. These APIs are based on the common STM32Cube framework so other layers like the middleware layer can function without requiring specific hardware information for a given microcontroller unit (MCU). This structure improves library code reusability and guarantees easy portability across other devices. Board support package (BSP) layer: provides firmware support for the STM32 Nucleo board (excluding MCU) peripherals. These specific APIs provide a programming interface for certain board specific components like LEDs, user buttons, etc., but can also be used to fetch board serial and version information, and support initializing, configuring and reading data from sensors. The BSP provides the drivers for the STEVAL-WESU1 board peripherals, adding the connections to the microcontroller peripherals. DocID029122 Rev 2 UM2041 STEVAL-WESU1 Firmware Figure 25: STEVAL-WESU1 firmware architecture These specific APIs provide a programming interface for the on-board peripherals, but they can also be used to provide user support for initializing, configuring and reading data from communication buses, specific to STEVAL-WESU1. This helps the user build the firmware using specific APIs for the following hardware subsystems: 3.3 BNRG: to control connectivity Platform: to control and configure all the devices in the battery and power subsystem plus button, LEDs and GPIOs Sensors: to link, configure and control all the sensors Folder structure Figure 26: STEVAL-WESU1 firmware package folder structure Embedded firmware library version information is included in “Release_Notes.html”. DocID029122 Rev 2 23/81 STEVAL-WESU1 Firmware 3.3.1 UM2041 Documentation Contains a compiled HTML file generated from the source code and documentation that describes the firmware framework, drivers for the on-board components and APIs to manage all the different functions. See the “STEVAL-WESU1_FW.chm” manual for further details. 3.3.2 Drivers All firmware packages adhering to the STM32CUBE framework contain the following main groups: BSP: the board specific drivers for whole the HW components CMSIS: vendor-independent hardware abstraction layer for ARM Cortex-M series. STM32L1xx_HAL_Drivers: microcontroller HAL libraries Figure 27: firmware drivers folder Components: platform independent device drivers for LPS25HB, LIS3MDL, LSM6DS3, and STC3115. STEVAL-WESU1: mid-level drivers for each hardware subsystem, giving the developer application-level control of the BlueNRG communication, platform, and sensors subsystems. Figure 28: BSP folders 24/81 DocID029122 Rev 2 UM2041 3.3.3 STEVAL-WESU1 Firmware Middleware Libraries and protocols for BlueNRG Bluetooth low energy, and other algorithm libraries, including sensor fusion, real time activity recognition and carry position recognition libraries. Further integration of ulterior algorithm is facilitated by the common STM32Cube framework. Figure 29: Middleware folder 3.3.4 Projects folder This directory contains a “Demonstrations” folder with a project that directly supports the ST WeSU app and an “Examples” folder with a project providing reference firmware. With the ST WeSU app on an Android or iOS device, it is easy to display sensor and algorithm data in customized plots or demos. The demonstration firmware aims to provide the functions available in the ST WeSU app, according to the BlueST protocol (see Section 5: "BlueST Protocol SDK"). DocID029122 Rev 2 25/81 STEVAL-WESU1 Firmware UM2041 Figure 30: Demonstrations and Examples folders To set up a suitable development environment for creating applications for the STEVALWESU1, the projects are available for the following environments: 3.3.5 IAR Embedded Workbench for ARM® (EWARM) KEIL RealView Microcontroller Development Kit (MDK-ARM) System Workbench for STM32 (SW4STM32) Demonstration firmware overview Typical demonstration firmware developed from the STM32Cube framework is found in an application folder containing the files groups described below: 26/81 Demo user application files Standard STM32Cube application files DocID029122 Rev 2 UM2041 STEVAL-WESU1 Firmware Figure 31: Demo application folder The demo application files include all the functions to support the ST WeSU mobile app: algorithms.c: APIs to perform configuration, initialization, run, and processing for the algorithms included in the middleware. BlueST_Protocol.c: APIs to support the BlueST SDK protocol (see Section 5: "BlueST Protocol SDK") in terms of service, characteristics, and data transmission/reception with BLE. console.c: APIs to provide the CLI commands for the debug console. low_power.c: APIs to configure the low power modes for the system main.c: The main demonstration routine including the top-level APIs wesu_config.c: APIs to configure, initialize, and check system-level functions and to control the permanent and session registers. The standard STM32Cube application files have the same configuration as any standard example using the STM32 HAL libraries, with the simple addition of the peripherals used for the demo purposes in the following files: 3.3.5.1 clock.c main.c stm32l1xx_hal_msp.c stm32l1xx_hal_it.c Demo main The main file includes the following functions: HAL_Init: configures the FLASH prefetch, time base source, NVIC and HAL lowlevel driver APIs Error_Handler: executed in case of error HAL_Delay: commonly used in any standard HAL example to provide an accurate delay (in milliseconds) based on the SysTick timer as time base source; in this case, it is a user file implementation using the _WFI instruction RTC_Config: configures RTC prescaler and data registers DocID029122 Rev 2 27/81 STEVAL-WESU1 Firmware 28/81 UM2041 RTC_TimeStampConfigDefault: configures the default time and date SystemClock_Config_APP_STARTUP: configures the main system clock; suitable for application using one of the following clock configuration functions: SystemClock_Config_HSI_32MHz SystemClock_Config_RTC_HSE32MHz SystemClock_Config_HSI_12MHz SystemClock_Config_HSE_18MHz SystemClock_Config_MSI_2MHz DebugConfiguration: configures debug facilities User_Init: initializes all the firmware sub-blocks used by the User_Process function; specifically, it: Initializes register management configures LED GPIO, button GPIO and EXTI Line configures the RTC initializes all the devices in the PWR Subsystem initializes the BlueNRG subsystem management initializes the sensor subsystem management initializes all the algorithms User_Process: controls the process which is continuously executed in the main loop; specifically, it executes the following actions: get data time to use RTC as calendar backup and save the system parameters switch the system in run mode manage the LED in order to give different feedback for each step executed get all the sensors data execute the algorithms control the BLE connection manage the debug console control the low power transitions using the user button or the app Read_Sensors: checks whether the sensor is enabled in the configuration registers. If enabled, get the data and save the value directly in the corresponding session registers ManageBleConnection check BLE connection update the connection parameters update the sensors and other data to be sent through BLE, according to the corresponding configuration HCI_Process: BlueNRG HCI provides a standard interface for accessing the capabilities of the Bluetooth controller and BlueNRG LE stack. Main: uses the predefined APIs to execute the principal process and perform the demo application. This procedure allows the user to execute the most important User_Process function, the interval in ms is adjusted using the “nTimerFrequency” value. The functions executed include: HAL_Init(); SystemClock_Config_APP_STARTUP(); DebugConfiguration(); User_Init(); DBG_PRINTF(Firmware version); APP_BSP_LED_Off(LED); DocID029122 Rev 2 UM2041 STEVAL-WESU1 Firmware Infinite loop: HCI_Process(); check if the timestamp has increased by the value “nTimerPeriod”; User_Process(); HAL_Delay (1 ms) Figure 32: Main function with internal infinite loop GSPG0504161400SG Start HAL_Init SystemClock_Config_APP_STARTUP Init & Configurations for all the HW drivers Configure all the Session and Permanent Registers Configure all the HW Subsystems for User_Process DebugConfiguration User_Init HCI_Process No HAL_Delay nTimer Period is elapsed Yes User_Process 3.3.5.2 BLE services This firmware uses three Bluetooth services: HW_Features_Service: transmits hardware characteristics, including: Temperature Pressure Battery voltage, battery current, battery SOC, battery status 3D gyroscope, 3D magnetometer, 3D accelerometer Sensor fusion data (AHRS values) Algorithm1 data (activity recognition) Algorithm2 data (carry position) Algorithm3 data (Pedometer provided by HW using LSM6DS3) Algorithm4 data (FreeFall provided by HW using LSM6DS3) Configuration_Service: for configuration management according to the BlueST protocol: Register management characteristics Console_Service: to transmit two main characteristics: Terminal Stderr This package is compatible with the ST WeSU Android/iOS application (Version 1.0 and above) available at Google Play/Apple Store, respectively. DocID029122 Rev 2 29/81 STEVAL-WESU1 Firmware UM2041 This application can be used to display information sent with the BlueST SDK Protocol (Section 5: "BlueST Protocol SDK"). 3.3.5.3 Memory mapping The demo application firmware is developed in order to provide all the functions necessary to support mobile app data streaming, remote configuration settings, and firmware upgrade using DFU or OTA. To provide these features, specific firmware memory mapping has been implemented as in the following tables. Table 2: Memory mapping Memory type INTERNAL FLASH (512K) Section Start address End address Size (bytes) Definition USB DFU(1) 0x08000000 0x08002FFF 12 K DFU using USB connection Reset Manager 0x08003000 0x080037FF 2K Application OTA management Service manager(2) 0x08003800 0x08007FFF 18 K OTA (over the air) firmware upgrade BlueNRG GUI 0x08008000 0x0801FFFF 96 K BlueNRG GUI USB-BlueNRG bridge 384K Application Used for application firmware code: Demo application or Sensor example Application 0x08020000 0x0807FFFF Notes: (1)Activation through the APP, using settings page or at startup/reboot, pressing the button for at least 3 seconds (2)Activation through the APP, using settings page or at startup/reboot, without USB cable connection, pressing the button during the first led blink Internal EEPROM and RAM are used for the application; specific areas are dedicated for register implementation. The following features are directly adjustable with the mobile app (marked with a double asterix (**) in the following tables): configure and control the on-board functions related to the microcontroller, sensors, connectivity and power management.. store the data from the sensors, battery charging devices and other on-board devices, including system status information. allow remote control via the mobile app using settings menu or debug console in the ST WeSU app. Some information (e. g., the accelerometer full scale or output data rate settings) is stored in the permanent registers only, while other data (e. g., sensor output data) is stored in the session registers; some information (e. g., the timer setting) is stored in both locations for temporary and permanent modifications. A detailed description of permanent and session registers is available in the STEVALWESU1.chm. 30/81 DocID029122 Rev 2 UM2041 STEVAL-WESU1 Firmware Table 3: Permanent register location Memory type INTERNAL EEPROM (16K) Section Start address End address Size (bytes) USER EEPROM AREA 0x08080000 0x08080FEF 4080 NEW_APP_MEM_INFO 0x08080FF0 0x08080FF7 8 USB_DFU_MEM_INFO 0x08080FF8 0x08080FFF 8 **PERMREG_STRUCT START_ADDRESS 0x08081000 0x080813FF 1K PERSISTEN T REGS **PERMREG_STRUCT_ BCK START_ADDRESS 0x08081400 0x080817FF 1K PERSISTEN T BCK REGS NOT USED 0x08081800 0x08082DFF 5632 reserved TEST_ID_EEPROM ADDRESS 0x08082E00 0x08082EDF 224 TEST_DATETIME_EEP ROM ADDRESS 0x08082EE0 0x08082EFF 32 PRODUCTION_DATA START_ADDRESS 0x08082F00 0x08082FFF 256 NOT USED 0x08083000 0x08083FFF 4K reserved Definition Definition Table 4: Session register location Memory type INTERNAL RAM (80K) 3.3.6 Section Start address End address Size (bytes) USER RAM 0x20000000 0x20012FFF 76K **SESSION REGISTERS 0x20013000 0x200133FF 1K RFU (Reserved Future Use) 0x20013400 0x20013FFF 3K SESSION REGS Example firmware overview The sample sensor firmware gives insight into the development of simple applications involving data from a single sensor, use the BLE service and features, and other functions called by the ST WeSU app, in accordance with the BlueST protocol (Section 5: "BlueST Protocol SDK"). Firmware examples developed using the STM32Cube framework require an “Application” folder with the files being either: Example application files Standard STM32Cube application files DocID029122 Rev 2 31/81 STEVAL-WESU1 Firmware UM2041 Figure 33: Example application files package The “Example” application files are the same as those for the “Demonstration” application, with some differences for certain files (identified with “filename_example.c”). You can use the ST WeSU mobile app to evaluate data streaming as shown in the demo. 3.4 Utilities The firmware can be updated using the IDE toolchain projects available in the package; however, this procedure is only really useful to verify the code in debug mode. If this is not required, the user can just download the available binary files to the FLASH memory and proceed to test the application. To use the binary firmware code, there are files dedicated to restoring functionality, including the default settings; however, to update it directly, you must: download and install "STM32 ST-LINK Utility" from www.st.com and run it click on “Target” -> “Settings” and select SWD Connection Click on “File” -> “Open” and select the binary file to be programmed Click on “Target” -> “Program and verify” and then “Start” Wait for the “Verification… OK” message in the log window and disconnect the programming cable The binary files are available in the “Utilities” folder. There are different batch files in the same folder that allow you to work with the ST-LINK programmer, without using the GUI. The readme.txt file inside the folder will help you choose the appropriate batch file for the desired activity. The main ones are: 1. 2. 3. 4. 32/81 STEVAL-WESU1_FACTORY.bat: restore all the memory content to factory conditions. ProgApplication.bat: update the DEMO application code only. ProgApplicationAndOTA.bat: update the DEMO application code plus the OTA manager. ProgExamples.bat: update the EXAMPLE application code only. DocID029122 Rev 2 UM2041 3.5 STEVAL-WESU1 Firmware Device firmware upgrade The STEVAL-WESU1 firmware can be updated via: 3.5.1 a wired connection through the USB plug a wireless connection with BLE Over The Air (OTA) DFU using USB Before connecting the USB cable, download and install the DfuSe demonstration software from www.st.com. Following installation, set the board to DFU mode thus: Plug the USB cable, the board starts in normal mode running the demo application, and the LED should blink every two seconds (at 0.5Hz). Set the board to standby mode by pressing the user button. Wait until the LED goes off. With the USB cable still plugged, press and hold the user button for at least 3 seconds, until the LED turns on. The board then enters DFU Mode and the LED blinks at 2.5 Hz. You can also use the ‘settings’ menu in the ST WeSU app (Settings -> Node Configuration -> Device Firmware Upgrade -> USB DFU). With the USB connection still active, you will see the following message: Figure 34: DFU driver installation Now run the “DfuSe Demonstration” software, see “STM Device in DFU Mode” in the “Available DFU Devices” drop down list. DocID029122 Rev 2 33/81 STEVAL-WESU1 Firmware UM2041 Figure 35: DfuSe Demo The user can upgrade the application firmware directly by choosing the *.dfu file. Click on “Choose” button and select the file to update the desired firmware: Table 5: Package file list 34/81 DFU Files Action WeSU_demo.dfu WeSU_examples.dfu Program Flash DEMO or EXAMPLES APPLICATION (@0x08020000) WeSUandOTA.dfu Program Flash APPLICATION (@0x08020000) + OTA (@0x08003800) WeSU_OTA_ServiceManager_App.dfu Program Flash OTA SERVICE MANAGER (address 0x08003800) SetAppAddress.dfu Set Application address on EEPROM location (@0x08080FF0) WESU_BlueNRG_VCOM_1_8.dfu Program Usb BlueNRG-MS Bridge (@0x08008000) SetBluenrgUsbBridgeAddress.dfu Program EEPROM: BlueNRG Bridge address on EEPROM ResetManager.dfu Program Flash RESET MANAGER (address 0x08003000) ResetRegs.dfu Program EEPROM Delete Registers ResetLics.dfu Program EEPROM: Delete Licenses DocID029122 Rev 2 UM2041 STEVAL-WESU1 Firmware Once the dfu file is selected click on “Upgrade” and wait for the completion confirmation Figure 36: DfuSe Demo upgrade successful DocID029122 Rev 2 35/81 STEVAL-WESU1 Firmware UM2041 When finished, click “Leave DFU mode”; the board restarts and runs the loaded firmware. Figure 37: DfuSe Demo leave DFU mode 3.5.2 DFU using OTA Before performing the OTA update, download and install the dedicated app on the mobile devices used: ST BlueDFU, available on Google Play, (soon to be available on Apple Store). 36/81 DocID029122 Rev 2 UM2041 STEVAL-WESU1 Firmware Figure 38: ST BlueDFU start page Following installation, set the board in DFU mode thus: Push the user button to start the board in normal mode running the demo application; the LED blinks every two seconds (at 0.5 Hz). Set the board in standby mode by pressing the user button. Wait until the LED goes off. Without the USB cable plugged, press and hold the user button for at least for 3 seconds until the LED turns on. The board then enters OTA mode and the LED toggles at 1 Hz. If you want to exit OTA mode without updating the firmware, press the user button three times (each time the LED performs a soft blink); the board will restart in normal mode running the demo application. When the board is in DFU OTA mode, run the ST BlueDFU application on your mobile device and check the device list. The board in OTA is recognizable by the name OTAWeSU. Select your board (the LED toggles faster at 4 Hz); the BLE connection is ready to download the firmware binary file. If there are different boards in OTA, you can check the address or simply ‘try’ the connection and verify which one accelerates the LED toggle frequency Select the *.bin file from a dedicated folder in the mobile device or use the default file already available in the folder with the star. Click the download icon, and double check the address values, filename and size of firmware code. DocID029122 Rev 2 37/81 STEVAL-WESU1 Firmware UM2041 Figure 39: ST BlueDFU working flow (Android Version) Run the update and wait until it finishes after more or less 2.5 minutes; after which, the board automatically restarts with the newly loaded firmware. Figure 40: ST BlueDFU device update It is possible to upgrade more than one device simultaneously with the same binary firmware selected. Ensure you select the same device type (hardware configuration) and download the right firmware to avoid rendering the device unusable. 3.6 Toolchains The STM32Cube expansion framework supports the following development tool-chain and compiler environments so you can build applications with the STEVAL-WESU1: 38/81 IAR Embedded Workbench for ARM® (EWARM) toolchain + ST-LINK: open IAR Embedded Workbench (V7.50 and above) open the IAR project file EWARM\Project.eww rebuild all files and load your image into target memory run the application DocID029122 Rev 2 UM2041 STEVAL-WESU1 Firmware KEIL RealView Microcontroller Development Kit (MDK-ARM) toolchain + ST-LINK: open µVision (V5.14 and above) toolchain open the µVision project file MDK-ARM\Project.uvprojx rebuild all files and load your image into target memory run the application System Workbench for STM32 + ST-LINK: open System Workbench for STM32 (1.8.0 and above) set the default workspace proposed by the IDE (please be sure that there are not placed in the workspace path) select "File" -> "Import" -> "Existing Projects into Workspace"; press "Browse" in "Select root directory" and choose the path where the System Workbench project is located rebuild all files and load your image into target memory run the application When establishing your IDE workspace, ensure that the folder installation path is not too deep to avoid any eventual toolchain errors. Any further firmware development can start using the reference projects included, and the SWD as the mandatory debug interface. DocID029122 Rev 2 39/81 ST WeSU app 4 UM2041 ST WeSU app The STEVAL-WESU1 demo application firmware is designed to work with the ST WeSU App (Android ver. 4.4.0 / iOS Ver. 8.0, or above), available free of charge at Google Play and Apple Store. The ST WeSU app opens with the start page below, from which you can command your mobile device to scan for nearby nodes. Figure 41: ST WeSU app start page (Android and iOS) You can then choose from one of the available boards to start all the demos and other supported functions. 40/81 DocID029122 Rev 2 UM2041 ST WeSU app Figure 42: ST WeSU app (Android and iOS) device list The app is able to support multiple node connections and switch from single to multiple connections from the menu options at the top of the page; alternatively, you can simply activate multiple connections by pressing and holding down an available node item. Figure 43: Node list (Android and iOS) commands The double tick (✔) mark for multiple nodes on the Android page is black when a particular node is connected, and gray when the node is connecting; in iOS, the tick represents a connected node. To start the demos you need to press the Action/Go button shown below. DocID029122 Rev 2 41/81 ST WeSU app UM2041 Figure 44: Node status (Android and iOS) indication From the node list view, you can: 42/81 restart scanning for nearby nodes from the search button or by swiping down the node list; switch from single multiple connection clear list to remove unconnected devices clear device cache (only Android) to clear Bluetooth device memory on specific node data saved at first-time node connection; this command forces the closure of all existing connections add virtual node is primarily for debugging purposes; it adds a virtual node and generates random data DocID029122 Rev 2 UM2041 ST WeSU app Figure 45: Nodes list (Android and iOS) menu In single node connection mode, the AHRS motion demo showing a simple spinning cubes starts as soon upon board selection, providing immediate STEVAL-WESU1 motion information. Other demos are accessible via the demo selector button indicated below, or by scrolling the active page from right to left. The “Action” selector gives access to all available board actions and application settings. Figure 46: Demo index and Action menu (Android) DocID029122 Rev 2 43/81 ST WeSU app UM2041 Figure 47: Demo index and Action menu (iOS) 4.1 Demo overview From the first page, you can access the following: Sensor fusion demo Environmental demo Plot data demo: to set plot length (time scale), and start/stop logging data Algorithms demos: Activity Recognition Carry Position Pedometer RSSI and battery charging: RSSI value TxPower SOC battery in percentage Battery status, voltage and current The following sections relate to both Android and iOS versions, even if only Android screenshots are actually shown. 44/81 DocID029122 Rev 2 UM2041 4.1.1 ST WeSU app Mems sensor fusion demo The Mems sensor fusion demo is automatically launched after board selection. Figure 48: ST WeSU app (Android version) motion sensor fusion demo It directly feeds all the available information associated with the board motion features and actions. Node name indicates which node is running, the start/stop logging command is discussed below, and the reset command aligns the cube position The extra sensor data and action area shows the extra available features and commands: Freefall (if available) shows the freefall status: no freefall currently in freefall Saved freefalls – if shown, it displays the list of the last 10 freefalls when clicked; from here you can choose to either continue adding freefall events or clearing the list entirely. Figure 49: Freefall icons DocID029122 Rev 2 45/81 ST WeSU app UM2041 Figure 50: Freefall events list Proximity sensor (if available) pressing it changes the status proximity available not applied proximity available and applied (the cube size changes with proximity) Figure 51: Proximity sensor status (only if available) 46/81 MEMS sensor fusion calibration (if available). The calibration status of the sensor fusion library is normally gray before calibration. When pushed, a popup window instructs you how to move the board to facilitate calibration; the symbol turns black when calibration has been completed successfully. calibration available (calibration status unknown) node sensor fusion calibrated DocID029122 Rev 2 UM2041 ST WeSU app Figure 52: ST WeSU (Android) calibration The reset action button allows resetting the cube position; when pushed, a popup window explains how to physically move the board to the default position. Reset is useful after calibration. Figure 53: ST WeSU (Android) reset position All demo commands are also available by tapping the demo area with a context menu, as shown below. DocID029122 Rev 2 47/81 ST WeSU app UM2041 Figure 54: Commands context menu 4.1.2 Environmental demo On the next page (scrolling display right to left or use the demo selector button), you can run the environmental demo, with pressure and temperature feeds. Figure 55: ST WeSU app (Android version) environmental demo 48/81 DocID029122 Rev 2 UM2041 4.1.3 ST WeSU app Plot data demo This demo includes the data plot from direct on-board sensor values, or values returned by algorithms run by the firmware. Figure 56: ST WeSU app (Android version) example plot (magnetometer values) You can change the plot settings from the combo selection. From the Plot length menu, you can select the time frame from 1 s to 30 s, as shown below. DocID029122 Rev 2 49/81 ST WeSU app UM2041 Figure 57: Plot length time scale selection When multiple nodes are connected, it is also possible to select the device and feature to plot. Figure 58: Features data plot selection 50/81 DocID029122 Rev 2 UM2041 4.1.4 ST WeSU app Algorithm demos Apart from the sensor fusion demo already discussed, the following motion-related demos are also available. 4.1.4.1 The osxMotionAR suite The osxMotionAR suite features predictive software which recognizes common activities and states, like: stationary walking fast walking jogging biking driving Real-time activity recognition can significantly improve the user experience in advanced motion-based applications for consumer, computer, industrial and medical purposes. The algorithm exclusively manages the data acquired from the accelerometer at a low sampling frequency (16 Hz) to minimize power consumption. Figure 59: Activity recognition demo The osxMotionAR engine is provided as a node-locked library which allows derivative firmware images to run on a specific STM32-based board only. Licensing activation code requests must be forwarded to ST and these codes must then be included in the project prior to usage - failure to do so will prevent proper API execution. The resulting firmware binary image will therefore be node-locked. DocID029122 Rev 2 51/81 ST WeSU app 4.1.4.2 UM2041 The OSX MotionCP suite This predictive software recognizes the carry position of the board using exclusively the data acquired from the accelerometer; carry positions include: on desk in hand near head shirt pocket trouser pocket arm swinging The real-time carry position algorithm can significantly improve motion-based applications in the consumer, computer, industrial and medical fields. The algorithm exclusively manages the data acquired from the accelerometer at a low sampling frequency (50 Hz) to minimize power consumption. Figure 60: Carry position demo The osxMotionCP engine is provided as a node-locked library which allows derivative firmware images to run on a specific STM32-based board only. Licensing activation codes must be requested from ST and included in the project prior to attempting its usage - failure to do so will prevent proper API execution. The resulting firmware binary image will therefore be node-locked. 4.1.4.3 The pedometer suite This is a simple demo to show the available data directly from the hardware, thanks to an algorithm in the LSM6DS3 device which feeds accelerometer data at a very low sampling frequency (1 Hz). 52/81 DocID029122 Rev 2 UM2041 ST WeSU app The Demo is already implemented to also support the Step/min measurement, available in the osxMotionPM embedded software. Figure 61: Pedometer demo 4.1.4.4 RSSI and battery This simple demo shows the data directly from the on-board power management subsystem hardware. For the battery charging profile values, all the data comes directly from the STC3115 and STNS01 devices placed in the battery circuit path. The values shown are: status of charge (SOC) in percentage battery status voltage current DocID029122 Rev 2 53/81 ST WeSU app UM2041 Figure 62: RSSI and battery charging demo 4.2 Action list overview From the action selector button at the top right of the screen, you can access: 4.2.1 Start/stop logging Settings Debug console Serial console BLE standby functions Reboot functions Start/stop logging All the demos views have the start/stop logging command, which saves raw demo data in the .csv format. Data is stored for each connected device in files that contain logs for each feature. For example, logging environmental data results in yyyymmdd_HHmm_Temperature.csv and yyyymmdd_HHmm_Pressure.csv files, where the prefix represents the date and time when the log starts. The file includes: header information with date time of log start, devices connected, the logged feature, data header and units the raw data with the logged host date time stamp (relative to start time), node name and feature timestamp. Stopping the log triggers the prompt to send all available logged data by mail. 4.2.2 Settings This menu provides the following settings groups: 54/81 DocID029122 Rev 2 UM2041 ST WeSU app General Settings: to enable free fall signalling Log Settings: to set your export path and determine how logged data is treated: saved directly in .csv files saved in an sql db and exported to .csv once logging has finished in order to send the data by mail not saved, but sent to the logCat (Android Studio debug view) clear log removes all .csv files logged from your export path Figure 63: Log settings 4.2.3 Device Configuration: is divided into the following subgroups: a. Device general settings control connection parameters b. Session settings configure the firmware session registers to control high level sensor and algorithm features, and low power mode. c. Persistent settings configure the firmware persistent registers to control the same features as the session settings, but with default values. it also contains others low level sensor parameters like full scale (FS), output data rate (ODR) and BLE output power. d. System settings include RTC configuration, device firmware upgrade (DFU) selector and five different Power-OFF modes. Debug console The Debug console can be opened from the actions menu to allow management of several board features and command functions (sensor selection, read frequency, BlueNRG communication subsampling) through a command line interface, and also to read register values. DocID029122 Rev 2 55/81 ST WeSU app UM2041 Figure 64: Debug console command list When the Debug console is open, all the functions implemented in the firmware can be manipulated through a simple command line interface: To get information, status and internal register in reading: ?command_name To set a value, an internal register or other in writing mode: !command_name An important role implemented in the Debug console is the window to set the License for all the algorithms. In the text entry window, simply paste the contents of the email received as a result of the request processed with the license wizard. 56/81 DocID029122 Rev 2 UM2041 ST WeSU app Figure 65: Debug set node license dialog 4.2.4 Serial console This is a terminal window for debugging, where you can read messages from the firmware and control critical conditions. 4.2.5 BLE standby This is a command to force the Bluetooth standby condition, causing demo interruption and forcing the entire STEVAL-WESU1 system into STOP mode. 4.2.6 Reboot Force a system reboot to guarantee control in case of problems with communications or sensor data, or low power modes. DocID029122 Rev 2 57/81 BlueST Protocol SDK 5 UM2041 BlueST Protocol SDK The Bluetooth low energy interface protocol is used by the BlueST app (iOS and Android) with the STEVAL-WESU1 reference design. The sensor board exposes its functions and communicates with the host through structured services and characteristics. Each data characteristic can be signaled with different timings (setting the respective register and therefore subsampling the application timer) and can be read asynchronously. 5.1 Advertising format According to the Bluetooth 4.0 core specification Vol.3 part C, the 0xFF identifies vendorspecific information. 5.1.1 Bluetooth low energy AD structure (max. 31 bytes) Table 6: BLE advertising structure AD Field Name ADType AD Length Record size TX_POWER_LEVEL 0x0A 2 3 COMPLETE_NAME 0x09 Max. 10/16 (*) 11/17 (*) MANUF_SPECIFIC 0xFF 13/7 (*) 14/8 (*) FLAGS 0x01 2 3 (*) If the public device address is not set in the MANUF_SPECIFIC field, then the COMPLETE_NAME can be maximum 16 bytes 5.1.2 5.1.2.1 AD structures TX_POWER_LEVEL advertising item Table 7: BLE TX power level advertising field 5.1.2.2 Octets LSB 0 1 2 Name Len Type -100 a + 20 dBm Value 0x02 0x0A 0xXX MANUF_SPECIFIC advertising item Table 8: BLE advertising manuf.-specific advertising field Octets LSB 0 1 2 3 4 Name Len Type Ver Dev ID Group A Features Group B Features Company assigned Company id (proposal) Value 0x0D 0xFF 0x01 0xXX 0xXXXX 0xXXXX 0xXXXXXX 0x2680E1 5 6 7 8 9 10 11 12 Public device address (48 bits) (optional) 58/81 DocID029122 Rev 2 13 UM2041 BlueST Protocol SDK 3 2 1 0 RFU 4 BATT 5 3 2 1 0 RFU RFU 6 TEMP RFU 7 RFU RFU 8 RFU RFU 9 PRESS Bit 10 MAG 11 GYRO 12 ACC 13 RFU 14 RFU 15 RFU N RFU Table 9: Group A features map 5.1.2.3 4 Pedometer 5 Carry Position RFU 6 Recognition RFU 7 Activity RFU 8 RFU RFU 9 RFU Bit 10 Fusion 11 Sensor 12 RFU 13 Fall 14 Free 15 RFU N RFU Table 10: Group B features map Device ID enum Table 11: Device ID enumeration ID HW 0x00 Generic 0x01 WeSU 0x02 – 0x7F RFU 0x80 – 0xFF Nucleo Map If GPA or GPB bits are set, then the general purpose characteristics have to be defined The msb in the Device ID enum is used to indicate a Nucleo-based system 5.2 Services/characteristics Table 12: Services/characteristics allocation map Groups Service Max Size Char Mode Note 0x0000 0000 0001 Features Data UUID Group A 16 single features n/a r/n 0xXXXX 0000 0001 DocID029122 Rev 2 TS + Value, 0xXXXX only one bit, (e.g. Accelerometer bit 7 => 0x00800001-) 59/81 BlueST Protocol SDK Groups Service UM2041 Char Max Size Mode UUID Note Group B 16 single features n/a r/n 0x0000 XXXX 0001 TS + Value, Only one bit 0x0000 0000 0003 must use the characteristic descriptor to configure the data Unit, Name, Type (Size), Format (Precision) 0xXXXX XXXX 0003 TS + Value[s] General Purpose GP XXXX XXXX n/a r/n 0x0000 0000 000E Debug Term n/a r/w/n 0x0000 0001 000E This characteristic is used for debug purpose as a hyperterminal like connection (Stdio) r/n 0x0000 0002 000E This characteristic is used for debug purpose as an output only terminal in order for the BLE device to send textual info on errors (StdErr) Debug StdErr n/a Control 0x0000 0000 000F 64 Config 0x0000 0001 000F Registers access Feature Command 64 w/n 0x0000 0002 000F Note: 1. 2. 3. 4. 5. 5.2.1 BLUETOOTH SPECIFICATION Version 4.2 [Vol 3, Part B] 2.5.1 UUID Service UUID -11e1-9ab4-0002a5d5c51b Char UUID -11e1-ac36-0002a5d5c51b All data char contains TS [2 bytes] (first field) TS is timestamp (uint16) relative to the board and valid for all features HW single feature packet All packets start with a uint16 timestamp (TS) 5.2.1.1 Generic packet format Table 13: Generic packet format 60/81 Octets LSB 0 1 Name TS Payload: Value[s] Value 0xXXXX 0xXXXXXXXX DocID029122 Rev 2 2 3 … N UM2041 5.2.1.2 BlueST Protocol SDK Motion sensors packet format Accelerometer payload: mg, signed int16 Gyroscope payload: dps, signed int16 Magnetometer payload: mGa, signed int16 Table 14: Motion sensors packet format 5.2.1.3 Octets LSB 0 1 2 3 4 5 Name X Y Z Value 0xXXXX 0xXXXX 0xXXXX Battery packet format Battery payload: Battery level: 0.1%, signed int16 (multiply by 10) Battery Voltage: mV, signed int16 Average current: mA, signed int16 Power mgmt. Status: enum, unsigned int8 Table 15: Battery packet format Octets LSB 0 1 2 3 4 5 6 Name Battery level Battery Voltage Average current Power Mng Status Value 0xXXXX 0xXXXX 0xXXXX 0xXX Table 16: Pressure packet format Octets LSB 0 1 Name Pressure Value Value 0xXXXXXXXX 2 3 Pressure payload: mbar, signed int32, multiply by 100 5.2.1.4 Temperature packet format Temperature payload: Celsius, multiply by 10 Table 17: Temperature packet format 5.2.2 Octets LSB 0 Name Value Value 0xXXXX 1 Aggregate feature packet To optimize the data throughput, you can aggregate multiple features in a single characteristic. The resulting UUID is the OR of the UUID of the single features. The features data must follow the feature mask order. DocID029122 Rev 2 61/81 BlueST Protocol SDK UM2041 Example: Motion packet (0x00700000) = Accelerometer (0x00400000) + Gyroscope (0x00200000) + Magnetometer (0x00100000) Table 18: Motion packet format Octets LSB 0 1 2 3 4 5 6 7 8 9 Accelerometer Name 13 14 15 16 Gyroscope 17 18 19 Magnetometer TS X Value 10 11 12 X X X X X X X 0xXXXX 0xXXXX 0xXXXX 0xXXXX 0xXXXX 0xXXXX 0xXXXX 0xXXXX X 0xXXXX 0xXXXX Accelerometer payload: mg, signed int16 Gyroscope payload: tenth of dps, signed int16 Magnetometer payload: mGa, signed int16 5.2.3 SW single feature packet 1/2 All packets start with a uint16 timestamp (TS) 5.2.3.1 Generic packet format Table 19: Generic packet format 5.2.3.2 1 2 … Octets LSB 0 3 Name TS Payload:Value[s] Value 0xXXXX 0xXXXXXXXX N Sensor fusion payload: 4x float (IEEE 754 single) Table 20: Sensor fusion packet format Octets LSB 0 Name TS qi qj qk qs Value 0xXXXX 0xXXXXXXXX 0xXXXXXXXX 0xXXXXXXXX 0xXXXXXXXX 1 2 3 4 5 6 7 8 9 10 11 12 13 Vector coefficients 14 15 Scalar coefficient (optional) If it only has 3 fields (qi,qj,qk), the vector coefficients are normalized IEEE 754 single (Reference: AN4044 on www.st.com). (Using floating-point unit (FPU) with STM32F405/07xx and STM32F415/417xx microcontrollers) Figure 66: IEEE 754 single reference 62/81 DocID029122 Rev 2 16 17 UM2041 5.2.3.3 BlueST Protocol SDK Free fall payload Free fall payload: 1 byte is needed if used in an aggregated fashion 1 = free fall event 0 = no free fall event Table 21: Free fall packet format 5.2.3.4 Octets LSB 0 Name Value Value 0 or 1 Activity recognition payload Activity recognition payload: 1 byte Table 22: Activity recognition packet format Octets LSB 0 Name Value Value 0 …. 6 Table 23: Valid activity types Activity type 5.2.3.5 0x00 No activity (no enough data for decide) 0x01 Stationary 0x02 Walking 0x03 Fast walking 0x04 jogging 0x05 Biking 0x06 driving Carry position payload Carry position payload: 1 byte Table 24: Carry position packet format Octets LSB 0 Name Value Value 0 …. 6 Table 25: Carry position type Carry position type 0x00 Unknown 0x01 On Desk 0x02 In Hand DocID029122 Rev 2 63/81 BlueST Protocol SDK UM2041 Carry position type 0x03 Near Head 0x04 Shirt Pocket 0x05 Trouser Pocket 0x06 Arm Swing 5.2.4 Configuration settings 5.2.4.1 Register access Table 26: Register access packet format Octets LSB 0 1 2 3 4 Name CTRL ADDR ERR LEN Payload … 5 64 CTRL field Table 27: Control field N 7 6 5 4 3 2 1 0 Mode Pending Mode Type Error Ack RFU RFU RFU 1 Exec op Persistent Write Error Ack required - - - 0 No op Session Read No error No ack - - - 5.2.5 Debug 5.3 ADDR: register address (0x00 – 0xFF) ERR: error code (0x00, no ERROR – 0x01-0xFF specific error code) LEN: register number (len * 2 = payload size in byte) The package doesn’t contain a timestap If the package doesn’t end in ‘\0’, the message finishes in the next package Max package size is 20 bytes Registers The control registers (16 bit) are for hardware configuration and runtime operation. The default configuration is stored in FLASH memory and loaded into RAM and EEPROM during runtime. Figure 67: Memory register mapping Access at this memory area is regulated through write and read operations in the Memory Access characteristic and through notification events. 64/81 DocID029122 Rev 2 UM2041 5.3.1 BlueST Protocol SDK Register types Persistent registers are stored in EEPROM, data is preserved in case of power loss (battery discharge or failure). Session registers are stored in RAM, data is preserved as long as the system is supplied (battery or external power). 5.3.2 Errors Table 28: Error code mapping Name Error code Session NO_ERROR_CODE 0x00 No error ERROR_LENGHT 0x01 Max payload length is 16 (TBC) ERROR_WRONG_FORMAT 0x02 Incorrect payload data format ERROR_NOT_IMPLEMENTED 0x03 Register not implemented (optional) ERROR_ACTION_NOT_ALLOWED 0x04 Action not allowed ERROR_REG_IS_READ_ONLY 0x05 Read only register ERROR_NOT_ALLOWED 0x06 Ctrl field mask is not allowed DocID029122 Rev 2 65/81 Board schematic and bill of material UM2041 6 Board schematic and bill of material 6.1 Bill of material Table 29: Bill of material 66/81 Item Qty Reference Value Description Part Number Manuf. 1 1 ANT1 2.4 GHz Chip Antenna,SMD W3008C Pulse 2 1 CN500 Micro_USB _AB 47590-0001 Molex 3 5 C110,C200, C216,C401, C411 1µF,6.3V, ±10% Ceramic X5R,SMD 0402 GRM155R60J105K E19D Murata 4 23 C111,C112, C113,C114, C115, C116,C201, C219,C222, C225, C228,C302, C304,C305, C306, C307,C308, C309,C406, C407, C412,C504, C505 100nF,16V ±10% Ceramic X5R,SMD 0201 GRM033R61C104K E84D Murata 5 4 C117,C303, C400,C404 10µF,6.3V, ±20% Ceramic X5R,SMD 0402 C1005X5R0J106M0 50BC TDK 6 2 C118,C119 10pF,25V, ±0.5pF Ceramic C0G, NP0,SMD 0201 C0603C0G1E100D 030BA TDK 7 1 C206 51pF not mounted, 50V,±10% Ceramic C0G,SMD 0402 GRM1555C1H510G A01D Murata 8 2 C212,C213 12pF,50V, ±0.1pF CH,SMD 0201 GRM0335C1H120G A01 Murata 9 2 C214,C221 100pF,16V ,±10% Ceramic X7R,SMD 0201 GRM033R71C101K D01D Murata 10 2 C223,C224 not mounted SMD 0402 any any 11 4 C226,C227, C22, C23 15pF,25V, ±0.1pF C0G,SMD 0201 GJM0336C1E150F B01D Murata 12 1 C229 150nF,6.3 V,±10% Ceramic X5R,SMD 0402 GRM155R60J154K E01D Murata 13 2 C402,C403 2.2uF,6.3V ,±20% Ceramic X5R(EIA),SMD 0402 GRM155R60J225M E95D Murata 14 3 C405,C408, C409 10nF,10V, ±10% Ceramic X7R,SMD 0201 GRM033R71A103K A01D Murata DocID029122 Rev 2 UM2041 Board schematic and bill of material Item Qty Reference Value Description Part Number Manuf. 15 1 C410 220nF,16V ,±10% Ceramic X7R,SMD 0402 GRM155R71C224K A12D Murata 16 1 C500 4.7nF,50V, ±10% Ceramic X7R,SMD 0402 GRM155R71H472K A01D Murata 17 1 C501 47µF,10V, ±20% Ceramic X5R,SMD 0805 C2012X5R1A476M 125AC TDK 18 1 D401 RED LED VLMS1500-GS08 VISHAY 19 1 D500 WHITE LED VLMW1500-GS08 VISHAY 20 1 D501 ESDALC6 V1-1U2 ST0201 ESDALC6V1-1U2 ST 21 1 D502 ESDA7P60 -1U1M QFN ESDA&P60-1U1M ST 22 1 J500 SWD/ JTAG THR 1.27 mm 2x5 FTSH-105-01-F-D-K SAMTEC 23 1 J501 CON3 SMT 3W 1.2 mm pitch 78171-0003 Molex 24 1 L203 10µH,20% SMD 0805 LQM21FN100M70L Murata 25 1 L204 0Ω,±0.1% SMD 0402 any any 26 2 L205, L206 3.9nH,±0,3 nH SMD 0402 LQG15HN3N9SO2D Murata 27 3 L401, L402, L403 1.5Ω, 215 mA SMD 0201 BLM03BD471SN1D Murata 28 4 R113,R309, R405,R506 0Ω,±1% SMD 0201 any any 29 10 R116,R117, R119,R120, R121, R122,R123, R200,R201, R501 10kΩ,±1% SMD 0201 any any 30 5 R301,R302, R303,R307, R308 0Ω,±1% SMD 0201 any any 31 5 R114,R118, R304,R305, R306 0Ω,±1%, not mounted SMD 0201 any any 32 1 R400 2kΩ,±1% SMD 0201 any any 33 1 R401 1Ω,±1% SMD 0201 any any 34 1 R402 60Ω 0.05W, ±1% SMD 0201 any any 35 2 R403,R408 1KΩ,±1% SMD 0201 any any R404 10KΩ NTC -not mounted, ±1% SMD 0402 NTCS0402E3103FLT Vishay 36 1 DocID029122 Rev 2 67/81 Board schematic and bill of material Item Qty Reference Value Description Part Number Manuf. 37 1 R412 1MΩ,±1% SMD 0201 any any 38 1 R413 33kΩ,±1% SMD 0201 any any 39 1 R500 1MΩ,±1% SMD 0402 any any 40 2 R502,R503 100kΩ, ±1% SMD 0201 any any 41 1 R504 100Ω,±1% SMD 0201 any any 42 1 R505 0.05Ω,±1% SMD 0402 LRCS04020R05FT5 WELWYN SW500 SW PUSHBUT TONDPST B3U-3000P Omron SMD Coaxial Connector,SMT U.FL-R-SMT-1(10) Hirose 43 68/81 UM2041 1 44 1 U201 uFL connector not mounted, 50Ω - 6 GHz 45 1 U100 STM32L15 1VEY6 WLCSP104 STM32L151VEY6 ST 46 1 U200 BLUENRG -MS VFQPN32 5x5 mm BLUENRG-MSQTR ST 47 1 U202 BALFNRG-01D3 FLIP CHIP 4 ball BALF-NRG-01D3 ST 48 1 U301 LPS25HB HLGA-10L (2.5 x 2.5x 0.76 mm) LPS25HB ST 49 1 U302 LSM6DS3 LGA-14L (2.5x3x0.83mm) LSM6DS3 ST 50 1 U303 LIS3MDL VFLGA-12 (2.0x2.0x1.0mm) LIS3MDL ST 51 1 U400 STNS01 DFN12L (3x3 mm) STNS01 ST 52 1 U401 STC3115 CSP (1.4 x 2.0 mm) STC3115 ST 53 1 U402 Voltage Regulator 3.1V SOT666 STLQ015XG31R ST 54 1 U502 USBULC62M6 uQFN USBULC62M6(uQFN) ST 55 2 Y2, Y201 NX2012SA 32kHz EXS00AMU00389 NDK 56 1 Y101 NX2016SA 24MHZ EXS00ACS05544 NDK DocID029122 Rev 2 UM2041 Board schematic and bill of material Item 57 Qty 1 Reference Value Y202 NX2016SA 32MHz EXS00ACS06644 Description Part Number Manuf. NDK Adapter Board 1 2 J1-J2 Con3 Strip Line Male THR 2,54 mm 1x3 any 2 1 J5 External Connector Strip Line Male THR 2,54 mm 1x8 any 3 1 J9 JTAGConnector THR 2,54 mm 2x10 4 1 J10 Jump_JTD Strip Line Male THR 2,54 mm 1x2 5 1 J12 SWD/TAG THR 1.27 mm 2x5 FTSH-105-01-F-D-K SAMTEC 6 1 C1 100nF, 16V, ±10% Ceramic X5R, SMD 0201 GRM033R61C104K E84D Murata 7 1 R1 10kΩ, ±1% SMD 0201 any any 8 1 S1 SW PUSHBUT TON Adapter KMR221GLFS C&K 9 1 FFSD-05-D-08.0001-N SAMTEC SWD flat cable Cable DocID029122 Rev 2 2-1634688 Tyco Electronics any 69/81 70/81 DocID029122 Rev 2 PWR_I2C_SCL PWR_GAS_CG PWR_I2C_SDA PWR_NTC 5-Connectors PWR_I2C_SDA PWR_I2C_SCL PWR_NTC PWR_GAS_CG Connectors SWD_SWCLK SWD_SWDIO LED_User nRESET USB_Monitor EXT_ConJ500 1-CPU SWD_SWCLK SWD_SWDIO LED_User nRESET USB_Monitor EXT_ConJ500 USB_DM USB_DP Button_PowerOn Button_PowerOn USB_DM USB_DP RX232_ConJ500 BluNRG_SPI_MISO BluNRG_SPI_MOSI BluNRG_SPI_SCK BluNRG_SPI_CS BluNRG_RST BluNRG_IRQ RX232_ConJ500 BluNRG_SPI_MISO BluNRG_SPI_MOSI BluNRG_SPI_SCK BluNRG_SPI_CS BluNRG_RST BluNRG_IRQ CPU PWR_SD 9X_SPI_SCK 9X_SPI_MISO 9X_SPI_MOSI 6X_SPI_CS MAG_SPI_CS Mag_DRDY 6X_INT1 6X_INT2 MAG_INT Press_SPI_CS Press_INT PWR_I2C_SDA PWR_I2C_SCL PWR_CHG PWR_ALM PWR_RSTIO/BATD PWR_CEN 3-Sensor 9X_SPI_SCK 9X_SPI_MISO 9X_SPI_MOSI 6X_SPI_CS MAG_SPI_CS Mag_DRDY 6X_INT1 6X_INT2 MAG_INT Press_SPI_CS Press_INT Sensors 4-Power Managment PWR_I2C_SDA PWR_I2C_SCL PWR_I2C_SCL PWR_I2C_SDA PWR_NTC PWR_GAS_CG PWR_CHG PWR_ALM PWR_RSTIO/BATD PWR_CEN PWR_SD Power Managment PWR_GAS_CG PWR_NTC 6.2 2-BluNRG BluNRG Board schematic and bill of material UM2041 Schematic diagrams Figure 68: Main system blocks GSPG2503161330SG 1 2 smr0201 1 2 1 15pF25V smc0201 2 WKUP U100 STM32L151VEY6 PE0 PE1 PE2 PE3 PE4 PE5 PE6 PE7 PB0 PB1 PB2-BOOT1 PB4-NJTRST PB5 PB6 PB7 PB8 PB9 PB10 PB11 PB12 PB13 PB14 PB15 PA0-WKUP1 PA1 PA2 PA3 PA4 PA5 PA6 PA7 PA8 PA9 PA10 PA11 PA12 PA15-JTDI PH0-OSC_IN PH1-OSC_OUT NRST BOOT0 GND C22 C23 15pF 25V smc0201 NX2012SA 32k EXS00A-MU00389 Y2 OSC32_IN 1 OSC32_OUT 2 smr0201 D_VDD K9 L9 Button_PowerOn J8 RX232_ConJ500 H7 CK232_ConJ500 J7 BluNRG_SPI_SCK M8 R120 10k smr0201 BluNRG_SPI_MISO H6 BluNRG_SPI_MOSI K7 F3 BluNRG_RST F1 F2 USB_DM E1 USB_DP E2 B1 D_VDD LED_User J6 D_VDD K6 M6 BOOT1 9X_SPI_MISO A5 R121 9X_SPI_MOSI A6 R122 10k 6X_SPI_CS C5 10k MAG_SPI_CS B6 PWR_I2C_SCL D5 PWR_I2C_SDA C6 M2 Press_SPI_CS L3 EXT_ConJ500 J4 PWR_RSTIO/BATD J3 D_VDD L1 PWR_ALM K2 R123 B7 10k A8 D6 D7 smr0201 C8 B9 E6 L6 F8 F9 F7 A7 PE15 PE14 PE13 PE12 PE11 PE10 PE9 PE8 PC15-OSC32_OUT PC14-OSC32_IN PC13-TAMPER-WKUP2 PC12 PC11 PC10 PC9 PC8 PC7 PC6 PC5 PC4 PC3 PC2 PC1 PC0 PD15 PD14 PD13 PD12 PD11 PD10 PD9 PD8 PD7 PD6 PD5 PD4 PD3 PD2 PD1 PD0 PH2 K4 L4 K5 M3 L5 J5 M4 M5 D9 D8 C9 B2 C2 E4 F4 G2 G1 H1 M7 L7 G8 G9 H9 F6 G3 J1 H2 H3 G4 K1 J2 H4 A4 B4 B3 A3 C4 C3 D4 A2 D1 E3 D3 B5 GND OSC_IN C119 10pF 25V smc0201 NDK:NX2016SA24MHzEXS00A-CS0554 4 1 GND NX2016SA 24MHZ EXS00A-CS05544 TP102 C118 10pF 25V smc0201 Y101 OSC_OUT 3 TP103 VLCD VDD_A PA13-JTMS-SWDIO PA14-JTCK-SWCLK PB3-JTDO-TRACESWO STM32L151VEY6 cercareCapacità GND 1 OSC_IN OSC_OUT nRESET BOOT0 VSS_1 VSS_2 VSS_3 VSS_4 VSS_5 VSS_6 VSS_7 1 H8 VREF2 4 1 2 K3 VDD_1 C1 VDD_2 B8 VDD_3 A9 M9 VDD_4 L8 E9 VDD_1 VDD_2 VDD_3 VDD_3A VDD_4A VDD_4 VDD_5 G7 G6 E7 VREF+ VDDA VLCD VSSA J9 VDD_4 GND C114 16V 100nF SMD 0201 GND C116 16V 100nF SMD 0201 R117 10k SMR0201 2 6X_INT1 Button_PowerOn nRESET D_VDD GND 2 2 0 SMR0201 1 1 WKUP SMR0201 0 NOT MOUNT R113 R118 1 PWR_RSTIO/BATD SMR0201 0 NOT MOUNT R114 GND R119 10k SMR0201 BOOT1 TP105 C110 6.3V1uF SMD 0402 R116 10k SMR0201 BOOT0 TP104 C117 10uF 6.3V smc0402 SENS_A_VDD D_VDD GND C115 16V 100nF SMD 0201 VDD_A GND C113 16V 100nF SMD 0201 Boot/Reset/Wakeup GND VLCD GND C112 16V 100nF SMD 0201 VDD_3 D_VDD D_VDD VDD_2 D_VDD D_VDD VDD_1 C111 16V 100nF SMD 0201 MAG_INT MAG_DRDY Press_INT 6X_INT2 6X_INT1 USB_Monitor PWR_SD BluNRG_SPI_CS PWR_CHG PWR_CEN OSC32_OUT OSC32_IN BluNRG_IRQ SWD_SWDIO SWD_SWCLK 9X_SPI_SCK 1 2 1 2 1 9X_SPI_SCK 1 2 1 L2 D2 C7 K8 E8 A1 M1 2 1 2 1 2 2 1 2 1 1 2 2 1 1 2 1 2 1 2 1 1 2 1 DocID029122 Rev 2 2 BluNRG_SPI_CS BluNRG_SPI_SCK BluNRG_SPI_MOSI BluNRG_SPI_MISO BluNRG_IRQ BluNRG_RST PWR_ALM PWR_RSTIO/BATD PWR_SD PWR_CHG PWR_CEN PWR_I2C_SCL PWR_I2C_SDA Power managment MAG_INT Mag_DRDY 6X_INT2 6X_INT1 MAG_SPI_CS 6X_SPI_CS 9X_SPI_SCK 9X_SPI_MOSI 9X_SPI_MISO Press_INT Press_SPI_CS Sensors CK232_ConJ500 RX232_ConJ500 nRESET USB_Monitor Button_PowerOn LED_User EXT_ConJ500 USB_DP USB_DM SWD_SWCLK SWD_SWDIO PWR_ALM PWR_RSTIO/BATD PWR_SD PWR_CHG PWR_CEN PWR_I2C_SCL PWR_I2C_SDA MAG_INT Mag_DRDY 6X_INT2 6X_INT1 MAG_SPI_CS 6X_SPI_CS 9X_SPI_SCK 9X_SPI_MOSI 9X_SPI_MISO Press_INT Press_SPI_CS RX232_ConJ500 nRESET USB_Monitor Button_PowerOn LED_User EXT_ConJ500 USB_DP USB_DM SWD_SWCLK SWD_SWDIO Connectors and Interfaces BluNRG_SPI_CS BluNRG_SPI_SCK BluNRG_SPI_MOSI BluNRG_SPI_MISO BluNRG_IRQ BluNRG_RST BluNRG-MS UM2041 Figure 69: Microcontroller schematics Board schematic and bill of material GSPG2503161415SG 71/81 Board schematic and bill of material UM2041 Figure 70: Sensors subsystem schematics 72/81 DocID029122 Rev 2 1 MOSI 1 CLK 2 IRQ 3 4 VBAT35 6 7 8 U200 VBAT1 C216 C228 6.3V1uF 16V 100nF SMD 0402 SMD 0201 BLU_GND 2 2 SPI_MOSI SPI_CLK SPI_IRQ TEST1 VBAT3 TEST2 TEST3 TEST4 BlueNRG-MS BLU_GND C225 16V 100nF SMD 0201 VBAT2 BLU_VDD 1 2 L206 3.9nH SMD 0402 BLU_GND C226 C227 15p 15p SMD 0201SMD 0201 1 Y201 BLU_GND VBAT3 BLU_VDD BLU_GND RX_N GND A2 1 BLU_GND L205 3.9nH SMD 0402 NX2016SA 32MHz EXS00A-CS06644 BALF-NRG-01D3 B2 GND1 GND U201 Line 50 Ohm BLU_GND 1 BluNRG_SPI_CS BluNRG_SPI_SCK BluNRG_SPI_MOSI BluNRG_SPI_MISO BluNRG_IRQ BluNRG_RST Pulse W3008C BLU_GND ANT1 3 2.4 GHz 1 TP206 TP205 C224 TBD SMD 0402 CSN CLK MOSI MISO IRQ RST BLU_GND pi greek filter SMD 0402 L204 TBD C223 TBD SMD 0402 2 BLU_GND TP204 TP203 TP202 TP201 SMR0201 U.FL connector NOT MOUNT 3 51pF NOT MOUNT SMD 0402 C206 2 1 1 BLU_GND BLU_GND NX2012SA 32k EXS00A-MU00389 U202 B1 A1 RX_P ANT 2 C213 12p SMD 0201 BLU_GND 2 Y202 BLU_GND VBAT2 C212 12p SMD 0201 24 23 22 21 20 19 18 17 C219 16V 100nF SMD 0201 C222 100nF 16V SMD 0201 BLU_GND C214 100p SMD 0201 VBAT1 SXTAL0 SXTAL1 RF0 RF1 VBAT2 FXTAL0 FXTAL1 2 SMD 0805 L203 10uH 1 R201 10k 1 BLU_VDD 1 1 BLU_GND 1 C201 16V 100nF SMD 0201 C221 C229 100p 150n SMD 0201 SMD 0402 BLU_GND BLU_VDD BLU_GND GND 2 R200 10k SMR0201 1 C200 6.3V1uF SMD 0402 BLU_GND 1 2 33 1 1 1 2 1 2 1 2 2 GND 2 1 SIG 2 1 2 1 2 1 2 1 2 32 MISO 31 CSN 30 TEST10 29 28 27NO_SMPS 26 25 RST 1 2 1 SPI_MISO SPI_CS TEST10 VDD1V2 SMPSFILT2 NO_SMPS SMPSFILT1 RESETN TEST5 TEST6 TEST7 VDD1V8 TEST8 TEST9 TEST11 TEST12 1 2 2 1 VBAT1 2 1 9 10 11 12 13 14 15 16 2 1 2 DocID029122 Rev 2 1 UM2041 Figure 71: Connectivity subsystem schematics Board schematic and bill of material GSPG3003160815SG 73/81 Board schematic and bill of material UM2041 Figure 72: SWD and Reset connection schematics 74/81 DocID029122 Rev 2 UM2041 Board schematic and bill of material Figure 73: External connector schematics DocID029122 Rev 2 75/81 0 PWR_I2C_S DA PWR_I2C_SCL STC3115 PWR_RSTIO/B ATD PWR_ALM 1 TP405 BLU_GND SMR0201 R405 BLU_GND 2 PWR_I2C_S DA PWR_I2C_SCL PWR_ALM PWR_RSTIO/B ATD R405shall not be the only poi nt of conjunction between the grounds. It has been inserted only to differentiate GNDs label GND 2 L403 1.5 Ohm 215 mA SML0201 1 C3 B1 C1 A1 VDD L402 BLU_VDD 1 1.5 Ohm 215 mA SML0201 VDD 1.5 Ohm 215 mA SML0201 C408 10nF 10V smc0201 1 TP401 GND 10V SMD 0201 2 1 GND 1 TP403 RSTIO/BATD STC3115 C409 10nF 10V SMD 0201 D_VDD SDA SCL ALM U401 2 2 1 C405 10nF 2 GND 1 TP407 VCC VIN CG 1 R401 1R SMD 0201 6.3V D3 B2 B3 A3 PWR_GAS_ CG TP413 SMD 0201 2 1K PWR_B ATT+ GND C411 1uF 6.3V R403 1 1 2 3 STNS01 ISET SYS IN U400 GND SMD 0402 10K NTC R404 GND R412 1 C410 16V SMD 0402 NTC BATSNS BAT BATMS CEN CHG SD LDO TP414 GND 220nF 4 5 6 STLQ015 XG30R EN OUT GND NC IN NC1 U402 SMD 0201 2 PWR_N TC 1K SMD 0402 PWR_S YS 2 1 6.3V 9 GND I_fast = (V_iset/R_iset) *200 -- V_iset =1V --- I_fast from 15mA to 200mA GND R400 2K SMD 0201 C402 2.2uF SMC0402 PWR_S YS C406 100nF 16V SMD 0201 PWR_GAS_ CG R408 1 10uF 6.3V smc0402 C404 STLQ015 GND C403 C407 2.2uF 16V 100nF SMC0402 SMD 0201 BATD/CD 2 L401 2 1 1 2 1 1 1 2 2 1 1 1 1 2 1 2 1 2 USB_5V 1 2 13 7 EXP_PAD GND SMD 0201 2 PWR_B ATT+ 1M GND C412 100nF SMD 0402 1 2V 20mA The BATSNS pin must be connected as close as possible to the battery’s positive terminal. 33K VBAT VISHAYVLMS1500 -GS08 RED D401 R402 60 - 0.05W SMD 0201 SMD 0201 1 R413 2 10uF 6.3V smc0402 3.0V 150mA GND 1 2 C400 PWR_N TC BATSNS PWR_B ATT+ GND PWR_CEN PWR_CHG PWR_SD VDD 8 11 12 10 6 5 4 3 C401 6.3V 1uF SMD 0402 1 TP402 GND D1 NC D2 1 2 1 SENS_A_VDD 2 1 DocID029122 Rev 2 2 1 2 PWR_CHG TP408 PWR_I2C_S DA PWR_I2C_SCL PWR_ALM PWR_RSTIO/B ATD PWR_GAS_ CG PWR_N TC - End of charge; TP409 TP410 PWR_N TC - Battery voltage bel ow VPRE a fter the fast-charge has already started; - Charging timeout (p recharge, fast-charge); A t ransition H-> L->H restarts the charger stopped for: Low level disables the b attery charger. Leave floating or H at power on PWR_CEN Fault --> Toggling 1Hz Charging --> Low Not charging --> High Z PWR_CHG POWER_SHUTDOWN --> High level SD on 1 2 PWR_SD 1 VDD 1 STNS01 TP411 1 76/81 TP412 PWR_CEN PWR_SD 1 Voltage References and GNDs Board schematic and bill of material Figure 74: Battery and power management subsystem schematics UM2041 GSPG0404161400SG UM2041 7 Formal notices required by the U.S. Federal Communications Commission ("FCC") Formal notices required by the U.S. Federal Communications Commission ("FCC") Model: STEVAL-WESU1 FCC ID: S9NWESU1 Any changes or modifications to this equipment not expressly approved by STMicroelectronics may cause harmful interference and void the user’s authority to operate this equipment. This device complies with part 15 of the FCC rules. Operation is subject to the following two conditions: 1. 2. This device may not cause harmful interference, and This device must accept any interference received, including interference that may cause undesired operation. For Class A Digital Devices This equipment has been tested and found to comply with the limits for a Class A digital device, pursuant to part 15 of the FCC Rules. These limits are designed to provide reasonable protection against harmful interference when the equipment is operated in a commercial environment. This equipment generates, uses, and can radiate radio frequency energy and, if not installed and used in accordance with the instruction manual, may cause harmful interference to radio communications. Operation of this equipment in a residential area is likely to cause harmful interference in which case the user will be required to correct the interference at his own expense. For Class B Digital Devices This equipment has been tested and found to comply with the limits for a Class B digital device, pursuant to part 15 of the FCC Rules. These limits are designed to provide reasonable protection against harmful interference in a residential installation. This equipment generates uses and can radiate radio frequency energy and, if not installed and used in accordance with the instructions, may cause harmful interference to radio communications. However, there is no guarantee that interference will not occur in a particular installation. If this equipment does cause harmful interference to radio or television reception, which can be determined by turning the equipment off and on, the user is encouraged to try to correct the interference's by one or more of the following measures: Reorient or relocate the receiving antenna. Increase the separation between the equipment and the receiver. Connect the equipment into an outlet on a circuit different from that to which the receiver is connected. Consult the dealer or an experienced radio/TV technician for help. DocID029122 Rev 2 77/81 Formal notices required by the Industry Canada ("IC") 8 UM2041 Formal notices required by the Industry Canada ("IC") Model: STEVAL-WESU1 IC: 8976C-WESU1 English: This Class A or B digital apparatus complies with Canadian CS-03. Changes or modifications not expressly approved by the party responsible for compliance could void the user’s authority to operate the equipment. This device complies with Industry Canada licence-exempt RSS standard(s). Operation is subject to the following two conditions: (1) this device may not cause interference, and (2) this device must accept any interference, including interference that may cause undesired operation of the device. French: Cet appareil numérique de la classe A ou B est conforme à la norme CS-03 du Canada. Les changements ou les modifications pas expressément approuvés par la partie responsable de la conformité ont pu vider l’autorité de l'utilisateur pour actionner l'équipement. Le présent appareil est conforme aux CNR d'Industrie Canada applicables aux appareils radio exempts de licence. 'exploitation est autorisée aux deux conditions suivantes: (1) l'appareil ne doit pas produire de brouillage, et (2) l'utilisateur de l'appareil doit accepter tout brouillage radioélectrique subi, même si le brouillage est susceptible d'en compromettre le fonctionnement. 78/81 DocID029122 Rev 2 UM2041 9 Acronyms and abbreviations Acronyms and abbreviations Table 30: List of acronyms Acronym Description AHRS Attitude heading reference system API Application programming interface BLE Bluetooth low energy BSP Board support package CLI Command line interface DFU Device firmware upgrade FS Full scale (MEMS sensor setting) HAL Hardware abstraction level HCI Host command interface IDE Integrated development environment ODR Output data rate (MEMS sensor setting) OTA Over the air SOC Status of charge DocID029122 Rev 2 79/81 Revision history 10 UM2041 Revision history Table 31: Document revision history 80/81 Date Version Changes 07-Apr-2016 1 Initial release. 17-May-2016 2 Minor text edits Updated Section 3.6: "Toolchains" DocID029122 Rev 2 UM2041 IMPORTANT NOTICE – PLEASE READ CAREFULLY STMicroelectronics NV and its subsidiaries (“ST”) reserve the right to make changes, corrections, enhancements, modifications, and improvements to ST products and/or to this document at any time without notice. Purchasers should obtain the latest relevant information on ST products before placing orders. ST products are sold pursuant to ST’s terms and conditions of sale in place at the time of order acknowledgement. Purchasers are solely responsible for the choice, selection, and use of ST products and ST assumes no liability for application assistance or the design of Purchasers’ products. No license, express or implied, to any intellectual property right is granted by ST herein. Resale of ST products with provisions different from the information set forth herein shall void any warranty granted by ST for such product. ST and the ST logo are trademarks of ST. All other product or service names are the property of their respective owners. Information in this document supersedes and replaces information previously supplied in any prior versions of this document. © 2015 STMicroelectronics – All rights reserved DocID029122 Rev 2 81/81