on
2021-09-14
3:05 AM
- edited on
2025-09-10
6:54 AM
by
Laurids_PETERSE
ST and its partners offer software expansion packages that enable the use of specific features or external devices with the STM32 MCU. These 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.
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:
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.
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.
Select the latest version of the package by checking the blue box on the left side and then click Install Now:
Once downloaded, acknowledge the licensing agreement and press Finish:
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.
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:For 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.
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:
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:
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:
X-CUBE-CELLULAR doesn't show up on the Embedded software packages Manager.
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.
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...
@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
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!