Getting Started with X-CUBE-MEMS1

Sep 1, 2020 11:26 · 1224 words · 6 minute read click finish stm32 latest stm32cubemx

Getting Started with X-CUBE-MEMS1 In this webinar we will see an introduction to STM32Cube the list of the required hardware and software tools how to install an STM32Cube Expansion Package in STM32CubeMX how to get started with the X-CUBE-MEMS1 in STM32CubeMX Introduction to STM32Cube STM32Cube is the Software Ecosystem for STM32, made and supported by STMicroelectronics, and proposed to all STM32 developers for free. It combines a set of PC software development tools and a set of embedded software bricks. STM32CubeExpansion packages provides an easy and powerful way to integrate additional components to the project, such as drivers for other ST components (sensor for instance) or middleware components. The latest STM32CubeExpansion specifications offer the ability to configure and integrate these components directly into the project from STM32CubeMX and STM32CubeIDE. The embedded software environment for STM32 offers the standard STM32Cube MCU packages (such as STM32CubeF4, STM32CubeH7 or STM32CubeL5…).

01:38 - STM32Cube Expansion packages extend it with additional software components enabling high-level application solutions. Those packages can come: - from STMicroelectronics, to support digital or high-level software component from ST portfolio (eg : NFC, MEMS, Bluetooth or even AI). - from ST Partners or third parties - from communities and education programs, or from your own, personal or professional, to share embedded software components with each other or just within restricted groups. The STM32Cube Expansion guidelines are publicly available on www.st.com/stm32cube Required hardware and software You need an ST Nucleo board or any evaluation board equipped with an STM32MCU on the ST Nucleo board you have flexible board power supply through USB or external source integrated ST-Link/V2-1 for mass storage device flash programming 2 push buttons and 2 color LEDs the Arduino connectors to easy access to add-ons the STM32 MCU the Morpho extension headers to directly access the MCU pinout In this webinar we will use a Nucleo-F401RE You need the ST X-NUCLEO-IKS01A3 expansion board equipped with motion MEMS and environmental sensors on this board you have in particular a humidity and temperature sensor: HTS221 a pressure and temperature sensor: LPS22HH a temperature sensor: STTS751 a 3-axis accelerometer and a 3-axis gyroscope: LSM6DSO a 3 axis accelerometer: LIS2DW12 a 3-axis magnetometer: LIS2MDL the ST Morpho connector the Arduino UNO R3 connector the DIL24 connector to plug other sensors The X-NUCLEO-IKS01A3 expansion board must be plugged on top of the STM32 Nucleo board Finally, you need the latest STM32CubeMX tool, available on st.com, installed on your PC.

04:14 - How to install an STM32Cube Expansion Package in STM32CubeMX Launch the STM32CubeMX on your PC Click the INSTALL/REMOVE button Go to STMicroelectronics tab Expand the pack you need to install (e.g. the X-CUBE-MEMS1) Click the Refresh button to retrieve all the available pack versions Select the version you want to install (it is suggested to install the latest one) Click the Install Now button to install the selected pack version To successfully complete the installation process, accept the license terms and click Finish The green box indicates that the pack has been successfully installed Close the window Getting Started with X-CUBE-MEMS1 in STM32CubeMX In this webinar we will set up a new project selecting an ST board We will use the ST Nucleo-F401RE board To easily find it in the ST board list, use some filter Check the Nucleo-64 box in the board Type list and the STM32F4 box in the MCU Series list Once you find your board, double click on it start the project Click Yes to initialize all peripherals with their default mode From the Pinout view it is possible to Configure the MCU pins and enable the Peripherals Clicking the Software Packs menu it is also possible to include additional software components to the project Just expand the line of the STM32 Expansion Package components you want to add And start to select the components The best way to get familiar with an STM32Cube Expansion Package is generating one of the included sample application For example, select the IKS01A3_DataLogTerminal sample application Double clicking the Application row, some useful information are displayed You can open the Getting Started Guide containing all the information on how to set up a project using the X-CUBE-MEMS1 components like, for instance, the description of the sample applications for all the expansion boards supported into the pack and also the applications for the custom boards You can also find the Configuration Steps and the use of MEMS Library with sample applications for all expansion boards with the information on the additional software settings the pins, the peripherals and the middlewares to use After selecting the sample application the required software components can be easily detected from the Component dependencies window In this case we just need to select the IKS01A3 Board Extension element and all icons become green Now the pinout configuration can start using the information contained in the Getting Started guide. Open it and take note of the pins, peripherals and middlewares that must be enabled and configured then you can start Let’s start from the I2C bus Set PB9 as I2C1_SDA PB8 as I2C1_SCL and enable the I2C1 from the Connectivity list you can set the I2C speed to 400 KHz and then enable all the EXTI pins: PB5 (LSM6DSO INT1) PB4 (LSM6DSO INT2) PB10 (LPS22HH INT) PB0 (LIS2DW12 INT1) and PC1 (STTS751 INT) Nothing has to be done for User Button, USART and LED since they are enabled by default Now we can configure the MEMS components clicking on Software Packs and then on STMicroelectronics.X-CUBE-MEMS1 pack. Select all the MEMS components and associate peripherals and pins to their proper function: the PC13 for the User Button the USART2 as bus for the COM logs the PA5 for the LED the I2C1 as bus for the communication between the MCU and the MEMS sensors Clicking the System View the user can access the NVIC section to enable the interrupt lines for all the EXTI pins enabled in the Pinout Now click the Project Manager tab Insert your project name Choose between Advanced and Basic structure Select your preferred toolchain among the list of the supported ones. In this example we use the STM32CubeIDE (without the Under Root option) Now we are ready to generate the code clicking the GENERATE CODE button Wait few seconds until the code generation process finish To open the generated STM32CubeIDE project click the Open Project button The STM32CubeIDE will start opening…

10:48 - Once the STM32CubeIDE is open, a pop-up will show the project import status, Close the pop-up, expand the project structure and browse the generated code (where you can find the application, the driver and the middleware files). Build the project to generate the binary file The Console output in the IDE shows the logs of the build process Wait until the build process finishes… After connecting your STM32 development board to your PC, flash it with the generated binary file Right-click on the project name and select the Run As –> STM32 Cortex-M C/C++ Application Accept the default settings in the Edit Configuration clicking OK The flashing process will start (its progress is shown in the Console output) Once the flashing process has successfully terminated Open a serial terminal on your PC and start playing with the application for more information, please, visit www.st.com/stm32cubemx Thank You! For further information on our products, please, visit us at www.st.com .