cancel
Showing results for 
Search instead for 
Did you mean: 

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

atamby187
Associate II

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

1 ACCEPTED SOLUTION

Accepted Solutions
Federica Bossi
ST Employee

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
In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

View solution in original post

4 REPLIES 4
Federica Bossi
ST Employee

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
In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

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


@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

 

 

Hi Andrew, 

Thank you for the clarification. I am quite new in electronics.

Best regards,

Audric.