cancel
Showing results for 
Search instead for 
Did you mean: 

LSM6DSV16X – I²C Communication Fails

Taksh
Associate III

Hello ST Community,

I am currently working on integrating the LSM6DSV16X accelerometer with an STM32H7 series MCU over I²C.
 Our main goal is to detect the tilt angle of the system.

 

Hardware Setup

  • MCU: STM32H7

  • Sensor: LSM6DSV16X (mounted on a custom board)

  • Interface: I²C

  • SA0 Pin: Pulled high → I²C address = 0x6B

  • Power Supply: 3.3 V

  • Pull-ups: 4.7 kΩ on SDA and SCL lines

  • I²C Speed: Tested at both 100 kHz and 400 kHz

 

The setup is straightforward — the sensor is connected to the STM32H7’s I²C1 bus, and it can be successfully detected using an I²C scanner.

 

I’m using the official STMicroelectronics driver from this repository:

https://github.com/STMicroelectronics/STMems_Standard_C_drivers/blob/master/lsm6dsv16x_STdC/examples/lsm6dsv16x_self_test.c 

 

However, I’m facing an unusual issue during normal operation.

 

Issue Description

When I try to read the WHO_AM_I register using the official LSM6DSV16X driver, I get inconsistent results.

 

Case 1 – Normal Run (no breakpoints)

  • HAL_I2C_Mem_Read() returns HAL_ERROR

  • WHO_AM_I value = 0x00

  • Failure occurs inside:

if (I2C_WaitOnTXISFlagUntilTimeout(...) != HAL_OK)
    return HAL_ERROR;

 

Case 2 – With Debugger Breakpoint (1s delay before read)

  • Communication works perfectly

  • WHO_AM_I value = 0x70

  • The LSM6DSV16X is detected successfully

It seems that communication only succeeds when a manual delay or breakpoint is added before the I²C transaction.

 

What I’ve Verified So Far

I²C scanner detects the device at address 0x6B (correct SA0 configuration)
Pull-ups and wiring verified – no shorts, clean signal levels
Tested with both 100 kHz and 400 kHz I²C speeds
HAL I²C initialization succeeds
Using official ST driver functions (lsm6dsv16x_device_id_get())

 

 

Example Logs

[17:28:28:084] Scanning I2C bus...
[17:28:28:094] Found device at address 0x6B
[17:28:28:098] Found device at address 0x7E
[17:29:08:877] WHO_AM_I: 0x70
[17:29:33:614] WHO_AM_I: 0x00
[17:29:33:616] Unknown device! WHO_AM_I = 0x00

 

 

Questions

  1. Why does I²C communication (especially HAL_I2C_Mem_Read) fail unless a manual delay is inserted before accessing the registers?

  2. Is there a specific startup or boot delay required after powering up the LSM6DSV16X before register access?

  3. Are there any known timing or synchronization issues between the STM32H7 I²C peripheral and the LSM6DSV16X?

  4. For tilt angle detection (±60° range), is the LSM6DSV16X suitable for directly computing pitch and roll angles from accelerometer data?

 

 

Expected Behavior

  • The WHO_AM_I register should consistently return 0x70 without requiring any artificial delay.

  • The sensor should be fully ready for I²C communication as soon as power and I²C lines are stable.

 

Summary

It appears there may be a timing or readiness issue between the LSM6DSV16X startup and the first I²C transaction.
Any guidance on the proper initialization sequence, recommended power-up delays, or I²C timing adjustments would be greatly appreciated.

 

 

Best regards

Taksh Patel

 

1 REPLY 1
Federica Bossi
ST Employee

Hi @Taksh 

thank you for your analytic description.
"Example Logs" are taken from your I2C scanner? It found LSM6DSV16X (0x6B) and STM32H7 (0x7E), or is there a different sensor on the bus?
I see from the scanner that it responds correctly.

 

  1.  Just to ensure that sensor has finished boot, before reading WHO_AM_I (0Fh) check that register CTRL3 (12h) has BOOT [7] and SW_RESET [0] bits deasserted (value '0'). CTRL3 ensure that boot procedure has finished.
  2. LSM6DSV16X does not have any recommendation on delay after power up, I suggest to rise VDD and VDDIO together and communicate after they have reached stable value.
  3. I'm not aware of any known timing issue with STM32H7 digital communication, it should be correct like for the other transactions.
  4. Yes, LSM6DSV16X is suitable for your goal.

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.