SPI - Pyboard and ADXL345 #9279
Unanswered
TradUncle
asked this question in
Libraries & Drivers
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I have been banging my head against the wall trying to get this code to work. I have adapted old code that had several errors, and have had no luck getting accel data off the ADXL345.
The only thing I've managed is reading the register for the device ID, which is correct and reads 0xe5. After reading, the next thing that happens is I write to all the ADXL registers to setup the device.
However, after this happens, reading any other register over SPI just returns the same 0xe5 repeatedly. The image below shows an attempt at reading the POWER_CTRL register and DATA registers, which all return 0xe5.
REPL output
The sensor works with I2C, I don't have access to an oscilloscope, and the pin connections are correct and using SPI(1). In-case I've missed something obvious, I've attached an image of the current attachment.
There is something simple I'm missing, but I need another pair of eyes to tell me where I've gone wrong because I can't figure it out. Any help would be appreciated.
ADXL Datasheet
https://www.analog.com/media/en/technical-documentation/data-sheets/ADXL345.pdf
Wiring Setup
main.py
adxl345.py
Beta Was this translation helpful? Give feedback.
All reactions