2025-11-05 5:04 AM
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.
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:
However, I’m facing an unusual issue during normal operation.
When I try to read the WHO_AM_I register using the official LSM6DSV16X driver, I get inconsistent results.
HAL_I2C_Mem_Read() returns HAL_ERROR
WHO_AM_I value = 0x00
Failure occurs inside:
if (I2C_WaitOnTXISFlagUntilTimeout(...) != HAL_OK)
return HAL_ERROR;
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.
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())
[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
Why does I²C communication (especially HAL_I2C_Mem_Read) fail unless a manual delay is inserted before accessing the registers?
Is there a specific startup or boot delay required after powering up the LSM6DSV16X before register access?
Are there any known timing or synchronization issues between the STM32H7 I²C peripheral and the LSM6DSV16X?
For tilt angle detection (±60° range), is the LSM6DSV16X suitable for directly computing pitch and roll angles from accelerometer data?
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.
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