Skip to main content
Explorer
March 3, 2024
Solved

Not able to get acceleration data from Adafruit LSM6DSO32 with STM32 Nucleo F446RE

  • March 3, 2024
  • 1 reply
  • 2000 views

Hi, 

I have been trying to get acceleration data from an Adafruit LSM6DSO32 with the STM32 Nucleo board F446RE via i2c. I used the STMems_Standard_C_drivers  (GitHub - STMicroelectronics/lsm6dso32-pid at 308cf0e4de0db190c453f3e211b0c40990f1f39b) in order to set the IMU properly. I also use the STM32CubeIDE app to programme the MCU. 

Despite many efforts, the Nucleo board is not able to recognise the IMU (I checked that a test buffer that prints whether the device is recognised using the whoami register (please refer to the 7z folder attached)), though I double checked the slave address of the components and the connections (please see attached image (IMG_0605.jpg). Could you please help me solve that problem? 

You can find enclosed a copy of the STM32CubeIDE project. 

Best regards, 

Audric

    This topic has been closed for replies.
    Best answer by Federica Bossi

    Hi @atamby187 ,

    Welcome to ST Community!

    I see two possible issues in your code:

    1. the who_am_i is defined as LSM6DSO32_ID in the drivers while you use another value
    2. Since you have not connected pin D0 you can try the i2c address LSM6DSO32_I2C_ADD_L

    1 reply

    Technical Moderator
    March 8, 2024

    Hi @atamby187 ,

    Welcome to ST Community!

    I see two possible issues in your code:

    1. the who_am_i is defined as LSM6DSO32_ID in the drivers while you use another value
    2. Since you have not connected pin D0 you can try the i2c address LSM6DSO32_I2C_ADD_L
    atamby187Author
    Explorer
    May 8, 2024

    Hi Frederica Bossi, 

    Thank you for helping solve this problem.

    The problem was with the i2c address of the Adafuit IMU which is 0xD4 (0x6A << 1) and not 0x6A as seen on Adafruit website.

    Best regards, 

    Audric

    Super User
    May 8, 2024

    @atamby187 wrote:

    The problem was with the i2c address of the Adafuit IMU which is 0xD4 (0x6A << 1) and not 0x6A as seen on Adafruit website.


    An I2C address is just 7 bits, so Adafruit are correct to say that the I2C address is 0x6A = 110 1010

    The value 0xD4 is made up of the address plus the R/W bit1101 010= 0xD4

    This is a frequent cause of confusion:

    https://www.avrfreaks.net/s/topic/a5C3l000000UXMPEA4/t142031?comment=P-1150738#:~:text=The%20discrepancy%20between%20talking%20of%20I2C%20addresses%20as%207%20or%208%20bits%20is%20very%20common%20indeed%20in%20software%2C%20tutorials%2C%20articles%2C%20and%20device%20datasheets.

     

    As shown in the ST datasheet, the value 0xD4 is the "SAD+R/W" - ie, Slave ADdress plus the R/W bit:

    AndrewNeil_0-1715182085664.png