ISM330DLC reading Registers failed Python
I am reaching out regarding an issue I am experiencing while reading register values from the ISM330DLC sensor using a Python script over SPI. Specifically, I am encountering incorrect data when accessing certain registers.
For example, when reading the WHO_AM_I register (0x0F), I receive a value of 0x7F instead of the expected 0x6A. This discrepancy suggests there may be an issue with the communication setup or the sensor response.
Here is a brief outline of my setup and process:
- Hardware:Raspberry Pi 5 connected to the ISM330DLC via SPI.
- Correct wiring verified (VDD, GND, SCL, SDA, CS).
- Software:Python with spidev library for SPI communication.
- SPI mode set to Mode 0 (CPOL=0, CPHA=0).
- SPI clock speed: 1 MHz.
Code Snippet:
import spidev
spi = spidev.SpiDev()
spi.open(0, 0)
spi.max_speed_hz = 1000000
spi.mode = 0
# Reading WHO_AM_I register
reg = 0x80 | 0x0F # Set MSB for read operation
response = spi.xfer2([reg, 0x00])
print(f"Response: {response}") Despite these checks, the returned values remain inconsistent with the datasheet specifications. I would greatly appreciate your guidance on troubleshooting this issue and verifying the sensor’s communication settings.
Thank you for your support!
