Skip to main content
Visitor II
February 7, 2023
Solved

Can I add a second instance of a supported MEMS sensor to project in the CubeMX configurator?

  • February 7, 2023
  • 2 replies
  • 1278 views

Sorry for the I'm too stupid to figure this out myself question, but couldn't figure out how to do this myself. In CubeMX Pinout & Configuration under software packs, I can install MEMS support, add a LSM6DSO (and required support elements) using i2c. In the Software Packages I can configure the mems and the LSM6DSO (including the SD0/AD0 pin for LSB of the address).

But, how does one add a second LSM6DSO to the project? Configuring the second slave address looks easy enough, but I need a second sensor instance first. Do I have to manually replicate the generated code used to create the first instance or is there some built-in way to "give me another i2c device with this configuration" option?

    This topic has been closed for replies.
    Best answer by Foued_KH

    Hello @JD.1avies​ ,

    Unfortunately, this feature is not supported today.

    At the moment only one instance per sensor can be used.

    Foued

    2 replies

    Foued_KHAnswer
    ST Employee
    February 10, 2023

    Hello @JD.1avies​ ,

    Unfortunately, this feature is not supported today.

    At the moment only one instance per sensor can be used.

    Foued

    JD13Author
    Visitor II
    February 10, 2023

    Thanks for the reply, so since there's not GUI way to do it, how would one do it in manually? Is there any refence material for doing so?

    Would be nice if there was internal support for just "add" another instance which then gets its own handlers. I didn't look too deep, instead I just copied off a "my_lsm6dso.c" from the generated file and made the changes to support a second. Seems incredibly inefficient, but it was a hack to get something working.