AnsweredAssumed Answered

Not good values ADXL372

Question asked by Teliarg on Apr 30, 2018
Latest reply on May 2, 2018 by jwang

Hi,

 

I'm testing the ADXL372 and it seems some values aren't correct.

So I'm working in Measurement Mode and I read the registers from 0x08 to 0x0d in order to read the accelerations in x, y and z.

When the adxl isn't moving, I receive values from -1.5 to 1.5g. I suppose it's noise and offset as explained in datasheets, that's okey.

 

But when I try some test with the adxl in mouvement, I receive weird values. For example, when I drop my pcb from only 1cm, I receive some 60g... 70g or even 120g! I don't really know the value of such a shock is but I'm pretty sure it's not 40, 80 or 120g! Has anyone already have the same problem or maybe have an idea?

 

I'm pretty sure of my conversion, but here is how it looks like (example for x value) :

 

x1=ReadSpi(0x08);                                  // x1 = 1111 1111;                            
x2=ReadSpi(0x09);                                  // x2 = 2222 0000;


if (x1<128)                                           // if x1>=128, that means the highest bit is 1 ==> negatif

{   

      x=0x0000;                                       // x = 0000 0000 0000 0000
      x=x1;                                             // x = 0000 0000 1111 1111
      x=x<<4;                                        // x = 0000 1111 1111 ????
      x=x&0b1111111111110000;          // x = 0000 1111 1111 0000
      x2= x2>>4;                                   // x2= ???? 2222;
      x2=x2&0b00001111;                      // x2= 0000 2222;
      x=x|x2;                                           // x = 0000 1111 1111 2222


}

if (x1>=128)

{
      x1=~x1;
      x2=~x2;
      x=0x0000;                                           // x = 0000 0000 0000 0000
      x=x1;                                                    // x = 0000 0000 1111 1111
      x=x<<4;                                                 // x = 0000 1111 1111 ????
      x=x&0b1111111111110000;                   // x = 0000 1111 1111 0000
      x2= x2>>4;                                             // x2= ???? 2222;
      x2=x2&0b00001111;                               // x2= 0000 2222;
      x=x|x2;                                                    // x = 0000 1111 1111 2222
      x=x+1;

}

 

*And I send the value of x to the terminal in g/10

 

 

And Here is my configuration :

 

WriteSpi(0x3d,0b01100000);

WriteSpi(0x3e,0b00000100); 

WriteSpi(0x3f,0b00010011);

 

Big thank you!

Outcomes