cancel
Showing results for 
Search instead for 
Did you mean: 

How to install and import a software expansion package with STM32CubeMX

ST AME Support NF
ST Employee

Introduction

ST and its partners offer software expansion packages that enable the use of specific features or external devices with the STM32 MCUThese can be installed locally and included in projects using STM32CubeMX.

This article demonstrates how to download the X-CUBE-MEMS1 package, which enables the use of external MEMS sensors with the MCU, and include it in an STM32CubeMX project.

 

1. Download the package through STM32CubeMX

First, it is necessary to download and install the X-CUBE-MEMS1 package through the STM32CubeMX Embedded Software Packages Manager, available by selecting Help -> Manage embedded software packages as shown below:
1833.png
Selecting this option opens the Embedded Software Packages Manager. This is where the user installs STM32 MCU packages, and ST or partner-provided expansions. The X-CUBE-MEMS1 package is provided by ST, and is located in the STMicroelectronics tab.
1834.png

In the package list, locate the X-CUBE-MEMS1 package. Clicking on the dropdown button to the left of its name reveals the list of available versions of the package that the user can include in their projects through STM32CubeMX.
1835.png
Select the latest version of the package by checking the blue box on the left side and then click Install Now:
1836.png
Once downloaded, acknowledge the licensing agreement and press Finish:
1837.png
A green box next to the package version's row indicates that it is now locally installed and can be used in projects. The Embedded Software Packages Manager can be closed now.
1839.png


2. Import the package into an STM32CubeMX project

For the purposes of this example, create an empty project based on the STM32G071RBTx MCU.

In the Pinout and Configuration tab of the opened project, the Software Packs -> Select Components option will reveal the Software Packs Component Selector, which allows management of the expansion packs that are included in the project:
1840.pngFor the purposes of this example, we will add the drivers for a LSM6DSL device using an I2C interface to the project. To do this, expand the X-CUBE-MEMS1 dropdown as shown below, and select LSM6DSL with the I2C interface option. Once this is done, save the changes and close this window by clicking Ok.
1841.png
In the Pinout & Configuration tab, enable the I2C peripheral that will be used to interface to MEMS. In the case of this example, enable I2C1:
1842.png
In the component list on the left, the Software Packs category shows which expansions are included in the project. For the X-CUBE-MEMS1 package, enable the Board Part AccGyr option in the Mode section. This component is further configured in the Configuration section, where for this example "I2C1" will be selected as the solution for the driver in Platform Settings:
1843.png
After configuration is done, generate the code with the Generate Code button. The additional drivers are added to the file structure of the project, and the provided functions can be used in application code:
1844.png

Comments
SDomi.2
Associate

X-CUBE-CELLULAR doesn't show up on the Embedded software packages Manager.

JSanc.7
Associate II

Sorry, I've tried to follow your post and when I generated the code, in the 2 generated files "app_ble.c" and "p2p_client.c" there are a lot of errors, most of which are due to undeclared variables.

Is there anything I miss? 

I'm going to post photos to show these errors.

Could you help me?

Thank you.

Screenshot_5.pngScreenshot_6.png

Lex
Associate III

In addition to missing X-CUBE-CELLULAR, X-CUBE-NFC6 is also missing... It looks strange that no one from ST staff could explain how extension packages from ST could be imported into STM32CubeMX or CubeIDE...

Peter BENSCH
ST Employee

@SDomi.2 @Lex OK, but unfortunately, you are confusing the terms a bit here and you will probably only understand this if you delve a little into the history: CUBE packages were made available long before the introduction of the free GUI STM32CubeIDE and could not be installed in STM32CubeMX at that time. However, it was already quite easy to integrate the file structure of the CUBE package into one's own project, even those provided by external developers are often integrated in this way. Information on this can be found in UM2312, UM2385 and UM2388.

Newer CUBE packages from ST are then gradually made installable in CubeMX/IDE.

Hope I could help a little?

Regards
/Peter

Tobias_
Associate II

Hi @Peter BENSCH ,

thank you for the contribution in this thread!

It is sad, ST still haven't done anything in the meantime to address the issue, so Im glad you at least gave explanation on how it evolved.

However, you say "quite easy to integrate the file structure" ... "Information on this can be found" ... I checked those 3 documents, but I haven't found anything easy there.

If its easy for you,  could you maybe explain it in more simple words to someone (not at all on a master level) like me?

Thanks!

Version history
Last update:
‎2025-09-10 6:54 AM
Updated by: