AnsweredAssumed Answered

ADXL345 gives 0xFF as device id, output data

Question asked by prasanth.ch.92 on Apr 22, 2013
Latest reply on May 2, 2013 by neilzhao

Hi everyone,

 

I'm using ADXL345 for a tilt-sensing application. I'm using the SDP-B controller board which is based on the Blackfin processor BF527. I'm trying to establish an 4-wire SPI comm interface between the SDP-B and the ADXL345. I'm using the following settings:

 

 

SPI Serial CLK = 300000 (300 KHz)

SPI Clock Polarity = 1

SPI Clock Phase = 1

Frame frequency = 0

Word size = 16

 

Data_Format register = 0x00  =>  Range:- 2g ;; Resolution:- 10-bit (fixed) ;;

Power_Control register = 0x08 => Switching to measurement mode from Standby mode after programming the Data_Format register.

 

Now, after all this, when i read the Device ID (0xE5) register of the ADXL345, i get 0xFF. Following is the C++ code for this operation:


//Reading device ID register(0x00) and verifying if its 0xE5

array<uInt16>^devid_addr = { 0x8000 };

array<uInt16>^devid_data = { 0x0000 };

spi_adxl345->writeReadU16(devid_addr, 1, devid_data);

(devid_data[0]) = (devid_data[0]) & 0x00FF ;

printf("INFO: Accelerometer-device-ID = 0x%x \n", devid_data[0]);

if( devid_data[0] == 0x00E5 )

    printf("INFO: ADXL345 connected \n");

else

    printf("INFO: Error in ADXL345 \n");

 

After this, when i try to read the three axes (x,y,z) data, I either get a 0x00(less frequently) or a 0xFF(more frequently) for each of the 6 registers: datax0, datax1, datay0, datay1, dataz0, dataz1. I have tried it infinitely many times and the result turns out be the same.

 

Can someone please help me out here? What is the reason for the 0xFF, 0x00 i keep getting from every register i try to read?

 

Thank you in advance.

 

Regards,

Sai Prasanth.

Outcomes