sparkfun / SparkFun_LIS2DH12_Arduino_Library

Library for I2C communication with ST LIS2DH12 low power accelerometer
Other
15 stars 10 forks source link

Using the libary with a SC7A20 Accelerometer #12

Open gadjet opened 1 week ago

gadjet commented 1 week ago

Subject of the issue

I have used the libray to access a SC7A20 accelorometer but all of a sudden it fails to connect to the device and I can't figure out what's changed, it was working fine

Your workbench

Steps to reproduce

Press reset or power up

Expected behavior

The serial console streams accelerometer data form the ESP32 via the USB connection (DCD on boot enabled). It has successfully done this for a few hours bfore suddenly failing to connect and never workiing again

Actual behavior

I just gives the "Accelerometer not detected. Are you sure you did a Wire.begin()? Freezing..." error

I have used a logic analyser to see what the I2C messages are doing and that looks to be good image

gadjet commented 1 week ago

Futher information: - I removed the #define LIS2DH12_ID = 0x11 from the sketch and edited the LIS2DH_reg.h file and changed LIS2DH12_ID = 0x33U to LIS2DH12_ID = 0x11U and it works now.

Why would local #define statement not override the LIS2DH_reg.h file?