2025-01-10 03:30 AM - last edited on 2025-01-10 04:56 AM by Andrew Neil
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:
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!
2025-01-10 04:14 AM - edited 2025-01-10 04:57 AM
Welcome to the forum
@LT wrote:reading register values from the ISM330DLC sensor using a Python script over SPI.
:
:
- Correct wiring verified (VDD, GND, SCL, SDA, CS).
That doesn't make sense: SCL and SDA are I2C - not SPI.
Please show an actual schematic of your connections.
What Is the ISM330DLC sensor on - a breakout board? Please give details.
Please show the full Python code
Note that the Code Editor has an option for Python - it's not just for C
2025-01-10 05:57 AM
Thank you for editing my post.
Yor are right, i mixed some terms. The Data pins are only listet as SDO and SDA in the datasheet. I am using the MKI182V2 Adapterboard with ISM330DLC. The wiring with 4-Wire SPI:
MKI182V2 - Raspi5
GND - GND
VDD - 3.3V
SCL - SPI SCLK
CS - SPI CE0
SDA - SPI MOSI
SDO - SPI MISO
The Python-Code works perfectly with another Sensor (IIS2DH on MKI168v1). Any idea, why that gives me incorrect data on the ISM330DLC?