ADXL372 output random data.

HI

I am trying to read adxl372 in full bandwidth measurement mode.

I have set register as following.

POWER_CTRL(0x3F) == 0x3E ( I have tried with disabled filter as well 0x07 and 0x0F, but same result)

Measurement Control Register (0x3E)  ==  0x04(3200 Hz bandwith)

I am getting random value with 12bit signed conversation. I have tried with below conversation as well but no luck.

	    x_raw = ((uint16_t)data_buffer[0]<<4 | (uint16_t)data_buffer[1]>>4)&0x0FFF;
	    y_raw = ((uint16_t)data_buffer[2]<<4 | (uint16_t)data_buffer[3]>>4)&0x0FFF;
	    z_raw = ((uint16_t)data_buffer[4]<<4 | (uint16_t)data_buffer[5]>>4)&0x0FFF;

	    x_acc = (twos_complement(x_raw,12))*0.1;
	    y_acc = (twos_complement(y_raw,12))*0.1;
	    z_acc = (twos_complement(z_raw,12))*0.1;
	    
	    



int twos_complement(val,bits){
    int value  = (int)val;
    if (value & (1 << (bits-1))){
    	 value -= 1 << bits;
    }

    return value;
}

I am reading the raw register (starting from 0x08) every second.

Can someone suggest me whats going on? Am I missing anything ?

  • 0
    •  Analog Employees 
    on Oct 19, 2021 1:37 AM

    Hi skynet, 

    cool nickname by the way :) 

    If I remember correctly the sequence to enter to instant on mode is: 

    1- while in standby mode (default) set all desired register configs, except POWER_CTRL register (should always be the last register to configure)

    2- set the part in measurement mode

    3- wait at least until first data is available (this depends on the filter settling time :16ms or 370ms)

    4- set the part to instant on mode

    Can you check if this works?

    Also every time the part switches from instant-on to measurement mode, it should be configured back to instant-on mode manually.  

    I hope this helps, 

    Pablo. 

  • HI Pablo,

    Thank you for your reply.

    I am not putting it into instant on mode. I will be always using measurement mode to get the samples @1Hz.

    As it is logging device with continuous power supply, I am putting any other mode using any interrupt.

    I am only reading raw data from 0x08 very second. The value I am getting back is 150g,200g,-100g,-20g.

    So, believe there must be something wrong.I have checked the forum and I found that many people have the same issue.

    Has anyone found reliable solution ?

  • 0
    •  Analog Employees 
    on Oct 19, 2021 1:37 PM in reply to skynet

    Hi Skynet,

    when you do POWER_CTRL(0x3F) == 0x3E  you are setting the part to instant on mode, I am confused now. 

    Can you share your code for all the registers configurations and also the raw data of the sensor output? I will try to reproduce your test, to confirm I see the same problem. 

    Pablo. 

  • Sorry That was my mistake.

    I am only setting POWER CTRL = 0x07 (or 0x0F). Rest of the all registers are at default.

    And My output is

    FF E0 00 20 18 7d

    00 40 FF D0 FF d0

    00 A0 FF 70 FF 90

    00 80 FF A0 FF A0

    FF F0 FF E0 FF D0

    00 10 FF D0 FF E0

    FF F0 FF F0 00 00

    00 A0 FF 90 00 30

    Thanks

  • 0
    •  Analog Employees 
    on Oct 21, 2021 9:10 AM in reply to skynet

    Hi Skynet, 

    I used the raw data you shared and the previous code to run a test: 

    #include <stdio.h>
    #include <stdint.h>
    
    //Customer data
    unsigned char data_buffer[8][6] = {
    	{0xFF,0xE0,0x00,0x20,0x18,0x7d},
    	{0x00,0x40,0xFF,0xD0,0xFF,0xd0},
    	{0x00,0xA0,0xFF,0x70,0xFF,0x90},
    	{0x00,0x80,0xFF,0xA0,0xFF,0xA0},
    	{0xFF,0xF0,0xFF,0xE0,0xFF,0xD0},
    	{0x00,0x10,0xFF,0xD0,0xFF,0xE0},
    	{0xFF,0xF0,0xFF,0xF0,0x00,0x00},
    	{0x00,0xA0,0xFF,0x90,0x00,0x30}
    	};
    
    unsigned int x_raw,y_raw,z_raw;
    float  x_acc,y_acc,z_acc;
    
    int twos_complement(unsigned int val,unsigned char bits){
        int value  = (int)val;
        if (value & (1 << (bits-1))){
        	 value -= 1 << bits;
        }
    
        return value;
    }
    
    int main( void )
    {
        int i;
        for (i = 0; i < 8; i++)
    	{
    		x_raw = ((uint16_t) data_buffer[i][0]<<4 | (uint16_t) data_buffer[i][1]>>4)&0x0FFF;
    		y_raw = ((uint16_t) data_buffer[i][2]<<4 | (uint16_t) data_buffer[i][3]>>4)&0x0FFF;
    		z_raw = ((uint16_t) data_buffer[i][4]<<4 | (uint16_t) data_buffer[i][5]>>4)&0x0FFF;
    
    		x_acc = (twos_complement(x_raw,12))*0.1;
    		y_acc = (twos_complement(y_raw,12))*0.1;
    		z_acc = (twos_complement(z_raw,12))*0.1;
    			
    		printf("%.2f\t%.2f\t%.2f\n", x_acc,y_acc,z_acc);	 
    	}
    	
        
        
        return 0;
    }

    and I this is the result I get: 

    seems like the first data point on the Z-axis is corrupted, but all the subsequent reads are within the expected response of the sensor. I dont see 200g or 150g spikes. 

    I wonder if the first data set captured a transient while the sensor is settling at start up? 

    Regards, 

    Pablo.