I am unable to communicate with ADXL345 using an FPGA i.e. the accelerometer has its output stuck at zero.I write(MSB = 0) to any configuration register and then read(MSB = 1) back the register value and get all zeros.I wanted a simple implementation of SPI in HDL, and decided to test it out with the ADXL345’s 4-wire SPI bus.I have gone through the accelerometer’s data sheet, and the supported SPI mode seems to be CPOL = 1, CPHA = 1.
Kindly view the attached simulation (SPI.PNG) and see if there’s anything wrong with the timing.The timing axis isn’t accurate in the simulation, but I tested the design with SCL from 300KHz to 2.5MHz and it didn’t work once.The simulation shows the start,transfer and stop of a typical SPI 2-byte transfer.
After this, I hooked up the design to a logic analyzer(LogicAnalyzerSPI.jpg) which pretty much confirmed the simulation results.Note that the accelerometer remains stuck at zero.
I have no idea what I’m doing wrong and would appreciate help in this regard.
P.S. I know from going through the forums that there are two ADXL345 boards, one with pins on both side of the board and another with pins on only one side.I have tested my design with both the modules.