Skip to content

Latest commit

 

History

History

application_examples

1 - Application examples - Introduction

The Application examples section of the Machine Learning Core repository contains examples of applications ready to be used on the ST MEMS devices, and are grouped by part number.

Each folder (related to a sensor part number) contains sub-folders with examples of Machine Learning Core configurations. See a typical path below:

\lsm6dsox\Vibration monitoring\

Each example sub-folder contains:

  • A README.md file, with information about the specific application example.

  • A .ucf file (Unico Configuration File), containing the device configuration generated by Unico GUI. This file can be loaded in different software tools (Unico GUI , Unicleo GUI , AlgoBuilder GUI, etc...) in combination with different hardware tools (STEVAL-MKI109V3, STM32 Nucleo, SensorTile.box, etc...) provided by ST. The following section describes how to use the file using the different tools.

  • A .h file, containing the same information as the .ucf file, but in the format of a C programming language header (also this file is generated by Unico GUI). Examples of .h file integration in C projects are available at platform independent drivers repository for STMicroelectronics sensors.

2. How to run the application examples

Run the example with Professional MEMS tool board and Unico GUI

Click to see/hide details

Unico GUI is a software tool working with STEVAL-MKI109V3, professional evaluation board for MEMS sensors, referenced as ProfiMEMS in ST docs.

To run the MLC application example in Unico GUI, the .ucf file has to be loaded as described in the following steps:

  1. Download the latest version of Unico GUI (if not already installed on your PC)

  2. Plug the DIL24 adapter (e.g. STEVAL-MKI197V1, depending on the example) to the ProfiMEMS motherboard

  3. Plug the ProfiMEMS board to your PC through a USB-microUSB cable

    • if necessary, upgrade the firmware of your board as described in the user manual UM2116
  4. Run Unico GUI selecting the desired device (adapter board, e.g. STEVAL-MKI197V1)

  5. Go to the Load/Save tab, of the Unico GUI and load the Unico Configuration File (.ucf)

  6. Once the device has been configured, press Start and you can visualize MLC results in the Data tool of Unico GUI

Run the example with STM32 Nucleo board and Unicleo GUI

Click to see/hide details

Unicleo GUI software tool works with STM32 Nucleo motherboards coupled with X-NUCLEO expansion boards (e.g. X-NUCLEO-IKS01A3). Optional sensor in form of DIL24 adapter can be plugged on top of the X-NUCLEO expansion board.

To run the MLC application example in Unicleo GUI, the .ucf file has to be loaded. Here are all the required steps:

  1. Download the latest version of Unicleo GUI (if not already installed on your PC)

  2. Download the latest version of X-CUBE-MEMS1

  3. Plug X-NUCLEO expansion board (e.g. MEMS expansion board X-NUCLEO-IKS01A3 to STM32 Nucleo board

  4. Optionally plug the DIL24 adapter with MLC feature (e.g. STEVAL-MKI197V1, depending on the example) to the DIL24 socket on X-NUCLEO expansion board

  5. Plug the STM32 Nucleo board to your PC through a USB-miniUSB cable

  6. STM32 Nucleo has to be programmed with DataLogExtended firmware from X-CUBE-MEMS1 package (if already programmed you can skip the following two steps)

    • Locate DatalogExtended.bin file in X-CUBE-MEMS1 package (STM32CubeExpansion_MEMS1_Vx.x.x\Projects\STM32xxxxxx-Nucleo\Examples\IKS0xxxx\DataLogExtended)

    • Copy the DatalogExtended.bin file to the disk drive associated with the STM32 Nucleo board

  7. Run Unicleo GUI, connect to the device, select the desired sensors, click the checkbox to enable the MLC, then click on the MLC button on the left panel, browse and load the Unico GUI Configuration File (.ucf) through the Browse button, finally click the Start button in the main window

  8. MLC results are displayed in the MLC window and User Messages Tab

Run the example with SensorTile.box and Unicleo GUI

Click to see/hide details

The .ucf file can also be loaded in the SensorTile.box board through the DataLogExtended firmware available in FP-SNS-STBOX1 package. The SensorTile.box can be programmed by STM32CubeProgrammer software. Here all the steps:

  1. Download the latest version of Unicleo GUI (if not already installed on your PC)

  2. Download the latest version of FP-SNS-STBOX1

  3. SensorTile.box has to be programmed with DataLogExtended firmware from FP-SNS-STBOX1 package (if already programmed you can skip the following two steps)

    • Put the SensorTile.box in DFU mode (Direct Firmware Upgrade): disconnect the battery and unplug the USB cable, press and hold the "DFU boot" button, connect the USB cable then release the button while connecting the USB cable.

    • Run STM32CubeProgrammer, select "USB" from the pull-down menu on the right, then press "Connect". Click on the Menu button in the top-left corner. Optionally perform a full chip erase. Select "Erase & Programming", browse to select the DataLogExtended binary, set the address to 0x8000000, check "Run after Programming", then click "Start Programming".

  4. Run Unicleo GUI, connect to the device, select the desired sensors, click the checkbox to enable the MLC, then click on the MLC button on the left panel, browse and load the Unico GUI Configuration File (.ucf) through the Browse button, finally click the Start button in the main window

  5. MLC results are displayed in MLC window and User Messages Tab

Run the example with SensorTile.box and AlgoBuilder

Click to see/hide details

AlgoBuilder is a software tool able to design a custom processing flow and to build the firmware for STM32 Nucleo boards coupled with the MEMS expansions, or for form-factor evaluation boards such as SensorTile.box.

You will create a firmware project using AlgoBuilder, which can be configured to use STM32CubeIDE to generate the binary file, STM32CubeProgrammer to program the SensorTile.box device, and Unicleo GUI to display the output in real-time.

  1. Configure AlgoBuilder: "File" -> "Application Settings", browse to select the path for Unicleo GUI, STM32CubeIDE, and STM32CubeProgrammer.
  2. Create a new design: "File" -> "New Design", browse and select the directory for the project, select the available IDE toolchain, select "SensorTile.box" or "SensorTile.box BLE" as target platform (the latter will support the use of a Bluetooth connection instead of the USB cable).
  3. Click and configure the default "Sensor Hub" block in the design to use the timer as data rate control, set the data rate and the full-scale of the sensors according to the example to be loaded. These settings should match the MLC settings.
  4. Expand the "Sensor Hub" library, drag and drop the "FSM / MLC" block in the design, connect it to the "Sensor Hub" block, click and configure it for 0 Finite State Machine, 1 Decision Tree in the Machine Learning core, browse and select the corresponding .ucf file.
  5. Optionally, from the "Sensor Hub" library, drag and drop the "Acceleration" block, connect it to the "Sensor Hub" block. Then, from the "Display" library, drag and drop the "Graph" block, click and configure it for the accelerometer data type, then connect it to the Acceleration block.
  6. Then, from the "Display" library, drag and drop the "Value" block, click and configure it for the custom data type, set Number of Values to 1, set Window, Value, Unit names and then connect it to the MLC output from FSM / MLC function block.
  7. Generate the project: "Firmware" -> "Generate C code". Then build the binary: "Firmware" -> "Build Firmware".
  8. Program the target: put the SensorTile.box in DFU mode, "Tools" -> "Program Target".
  9. Open Unicleo GUI: "Tools" -> "Run Unicleo-GUI application", connect to the device, press Start to display the output in real-time.

Run the example with STWIN and HSDatalog

Click to see/hide details

HSDatalog is a high speed data logging command line application for the STWIN board.

HSDatalog also allows configuring ISM330DHCX Machine learning Core and reading the output of the selected algorithm.

Here all the required steps to run a MLC example through STWIN and HSDatalog:

  1. Download the latest version of HSDatalog, contained in FP-SNS-DATALOG1 ( STM32Cube High Speed Datalog function pack for STWIN evaluation kits )

  2. STWIN has to be programmed with HSDatalog firmware from FP-SNS-DATALOG1 package (if already programmed you can skip the following two steps)

    • Put the STWIN in DFU mode (Direct Firmware Upgrade): disconnect the battery and unplug the USB cable, press and hold the "USR" button, connect the USB cable then release the button while connecting the USB cable.

    • Run STM32CubeProgrammer, select "USB" from the pull-down menu on the right, then press "Connect". Click on the Menu button in the top-left corner. Optionally perform a full chip erase. Select "Erase & Programming", browse to select the HSDatalog binary (e.g. \FP-SNS-DATALOG1_V1.0.0\Projects\HSDatalog\Binary\HSDatalog.bin), set the address to 0x8000000, check "Run after Programming", then click "Start Programming".

  3. Load the .ucf configuration to ISM330DHCX on STWIN, and acquire data logs to see MLC outputs. To do this, a terminal has to be opened, and the "cli_example" application (contained in \FP-SNS-DATALOG1_V1.0.0\Utilities\cli_example\bin) has to be called specifying the .ucf file name and (optionally) the period of the acquisition:

    cli_example.exe -u file_name.ucf -t n_sec
    

    Further details on the high-speed data log function pack are available in the user manual UM2688.

Run the example on a custom hardware using C-programming

Click to see/hide details

A .h file is provided to easily include the MLC configuration in any C-programmable custom hardware.

For using the C header files (.h), it is required:

  • A standard C language compiler for the target MCU
  • A C library for the target MCU and the desired interface (i.e. SPI, I2C)

To run the example through the configuration provided in the .h file, it necessary to:

  1. Include the C header file (.h) in the desired project

  2. Use the desired interface C library for the target MCU for writing the configuration registers array contained in the C header file (.h).

Some examples of sensors integration are available at the platform independent drivers repository for STMicroelectronics sensors.



More Information: http://www.st.com

Copyright © 2020 STMicroelectronics