Post Go back to editing

Kindly reply on Accelerometer queries asked multiple times earlier

Category: Hardware
Product Number: ADXL357

Hello      

We have asked the below query multiple times on this forum but no help is provided. Please help in proceeding further regarding this matter.

We have been using ADXL357 interfaced with STM32L562 Microcontroller. We are able to read and config the various registers of ADXL357 and read acceleration data in the X, Y and Z Data registers. We are unsure that we are obtaining the correct values or not. In other words, we wish an explanation on how to calculate 'g' value from these registers' data. Also, we need to know that how to calculate the threshold values of 'g' for this Accelerometer. We are calculating 'g' values from Raw data using below formula:

Vibration in 'g' = 20 bit Raw data * (1 / Sensitivity)

We have 3 same PCBs with us on which this Accelerometer is mounted and we are getting three completely different values on each board in steady state i.e. when PCBs are placed on table in no movement condition.

In our case, even if apply some vibrations  manually to the device, the raw data of each axis are same everytime. How to proceed further ?

Kindly help.

  • Hi  , 

    the sensitivity units are [LSB/g], so your equation to get the acceleration in [g] should be raw_data[LSB]*sensitivity[LSB/g] 

    Can you please quantify your observations on both steady condition and by moving the accelerometer manually? Can you also please share your register map configuration? 

    Regards, 

    Pablo 

  • Thank your for your reply.

    The equation mentioned by you for calculating Acceleration in 'g' will lead to a huge value. For e.g. the typical sensitivity corresponding to 10g test condition is 51200 LSB/g as mentioned in datasheet and raw data will be of 20 bit which will be obtained from FIFO. If we multiply them then this will give a large value which can't be 'g' definitely. Are you sure about the correctness of the equation you provided ? Please verify.

    I am providing the values which I obtained on two different PCBs in both conditions (Steady state and Vibrations by hands).

    1st PCB (Corresponding to 10g test value):

    Raw data of X-axis: 0x3DE9, Raw data of Y-axis: 0x610D, Raw data of Z-axis: 0x11401

    Sensitivity taken = 51200 LSB/g

    2nd PCB (Corresponding to 10g test value):

    Raw data of X-axis: 0xA002, Raw data of Y-axis: 0x3C01, Raw data of Z-axis: 0x12C01

    Sensitivity taken = 51200 LSB/g

    These readings are same and not changing during steady state as well as while shaking PCBs manually with hands.

    Below is our code for your observation:

    uint8_t Status_Reg_Read[] = {0x04};

    uint8_t Status_Reg_Read_Value[1];

    uint8_t Range_Cntrl_Reg_Value[] = {0x2C, 0x81};

    uint8_t Filter_Setting_Reg_Value[] = {0x28, 0x0A};

    uint8_t Power_Cntrl_Reg_Value[] = {0x2D, 0x00};

    uint8_t Self_Test_Reg_Value[] = {0x2E, 0x03};

    if(HAL_I2C_Master_Transmit(&hi2c1, (uint16_t)ACCMETER_IC_ADDRESS, (uint8_t *)Status_Reg_Read, sizeof(Status_Reg_Read), 1000)==HAL_OK)

    {

    if( HAL_I2C_Master_Receive(&hi2c1, (uint16_t)ACCMETER_IC_ADDRESS, (uint8_t *)Status_Reg_Read_Value, sizeof(Status_Reg_Read_Value), 1000) == HAL_OK)

    {

    uint8_t data[] = "\r\nX-Axis \r\n";

    HAL_UART_Transmit (&huart1, data, sizeof (data), 10);

    printf("OK");

    }

     

    }

    if(HAL_I2C_Master_Transmit(&hi2c1, (uint16_t)ACCMETER_IC_ADDRESS, (uint8_t *)Range_Cntrl_Reg_Value, sizeof(Range_Cntrl_Reg_Value), 1000)==HAL_OK)

    {

    printf("OK");

    }

    if(HAL_I2C_Master_Transmit(&hi2c1, (uint16_t)ACCMETER_IC_ADDRESS, (uint8_t *)Filter_Setting_Reg_Value, sizeof(Filter_Setting_Reg_Value), 1000)==HAL_OK)

    {

    printf("OK");

    }

    /////////////*****Power Control Register must be set at LAST after other Configuration registers*****//////////////////

    if(HAL_I2C_Master_Transmit(&hi2c1, (uint16_t)ACCMETER_IC_ADDRESS, (uint8_t *)Power_Cntrl_Reg_Value, sizeof(Power_Cntrl_Reg_Value), 1000)==HAL_OK)

    {

    printf("OK");

    }

    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    if(HAL_I2C_Master_Transmit(&hi2c1, (uint16_t)ACCMETER_IC_ADDRESS, (uint8_t *)Self_Test_Reg_Value, sizeof(Self_Test_Reg_Value), 1000)==HAL_OK)

    {

    printf("OK");

    }

  •    

    Thank your for your reply.

    The equation mentioned by you for calculating Acceleration in 'g' will lead to a huge value. For e.g. the typical sensitivity corresponding to 10g test condition is 51200 LSB/g as mentioned in datasheet and raw data will be of 20 bit which will be obtained from FIFO. If we multiply them then this will give a large value which can't be 'g' definitely. Are you sure about the correctness of the equation you provided ? Please verify.

    I am providing the values which I obtained on two different PCBs in both conditions (Steady state and Vibrations by hands).

    1st PCB (Corresponding to 10g test value):

    Raw data of X-axis: 0x3DE9, Raw data of Y-axis: 0x610D, Raw data of Z-axis: 0x11401

    Sensitivity taken = 51200 LSB/g

    2nd PCB (Corresponding to 10g test value):

    Raw data of X-axis: 0xA002, Raw data of Y-axis: 0x3C01, Raw data of Z-axis: 0x12C01

    Sensitivity taken = 51200 LSB/g

    These readings are same and not changing during steady state as well as while shaking PCBs manually with hands.

    Below is our code for your observation:

    uint8_t Status_Reg_Read[] = {0x04};

    uint8_t Status_Reg_Read_Value[1];

    uint8_t Range_Cntrl_Reg_Value[] = {0x2C, 0x81};

    uint8_t Filter_Setting_Reg_Value[] = {0x28, 0x0A};

    uint8_t Power_Cntrl_Reg_Value[] = {0x2D, 0x00};

    uint8_t Self_Test_Reg_Value[] = {0x2E, 0x03};

    if(HAL_I2C_Master_Transmit(&hi2c1, (uint16_t)ACCMETER_IC_ADDRESS, (uint8_t *)Status_Reg_Read, sizeof(Status_Reg_Read), 1000)==HAL_OK)

    {

    if( HAL_I2C_Master_Receive(&hi2c1, (uint16_t)ACCMETER_IC_ADDRESS, (uint8_t *)Status_Reg_Read_Value, sizeof(Status_Reg_Read_Value), 1000) == HAL_OK)

    {

    uint8_t data[] = "\r\nX-Axis \r\n";

    HAL_UART_Transmit (&huart1, data, sizeof (data), 10);

    printf("OK");

    }

     

    }

    if(HAL_I2C_Master_Transmit(&hi2c1, (uint16_t)ACCMETER_IC_ADDRESS, (uint8_t *)Range_Cntrl_Reg_Value, sizeof(Range_Cntrl_Reg_Value), 1000)==HAL_OK)

    {

    printf("OK");

    }

    if(HAL_I2C_Master_Transmit(&hi2c1, (uint16_t)ACCMETER_IC_ADDRESS, (uint8_t *)Filter_Setting_Reg_Value, sizeof(Filter_Setting_Reg_Value), 1000)==HAL_OK)

    {

    printf("OK");

    }

    /////////////*****Power Control Register must be set at LAST after other Configuration registers*****//////////////////

    if(HAL_I2C_Master_Transmit(&hi2c1, (uint16_t)ACCMETER_IC_ADDRESS, (uint8_t *)Power_Cntrl_Reg_Value, sizeof(Power_Cntrl_Reg_Value), 1000)==HAL_OK)

    {

    printf("OK");

    }

    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    if(HAL_I2C_Master_Transmit(&hi2c1, (uint16_t)ACCMETER_IC_ADDRESS, (uint8_t *)Self_Test_Reg_Value, sizeof(Self_Test_Reg_Value), 1000)==HAL_OK)

    {

    printf("OK");

    }

  • Hi  , 

    sorry for the mistake, I realized I have a typo on my previous response -->  raw_data[LSB] / sensitivity[LSB/g] 

    Thanks for sharing your code. Can you also share the section of your code that perform the reads from the FIFO?

    And can you please verify that the I2C communications are not corrupted? for example, by checking with a signal analyzer that the sensor is actually reading constant values for X Y and Z channels as you describe?

    I would also recommend checking you get the same results by reading the XDATA, YDATA and ZDATA registers.

    THanks, 

    Pablo.  

  •    

    Yes reading XDATA, YDATA and ZDATA registers are also leading the same values as of FIFO read. Here I am sharing the FIFO read section of my code:

    #define ACCMETER_IC_ADDRESS (0x53<<1)

    uint8_t Fifo_Access_Reg[] = {0x11};

    uint8_t Fifo_Access_Reg_Read_Val[96];

    if(HAL_I2C_Master_Transmit(&hi2c1, (uint16_t)ACCMETER_IC_ADDRESS, (uint8_t *)Fifo_Access_Reg, sizeof(Fifo_Access_Reg), 1000)==HAL_OK)

    {

    if( HAL_I2C_Master_Receive(&hi2c1, (uint16_t)ACCMETER_IC_ADDRESS, (uint8_t *)Fifo_Access_Reg_Read_Val, sizeof(Fifo_Access_Reg_Read_Val), 1000) == HAL_OK)

    {

    printf("OK");

    }

    }

  •  , 

    can you please also share the oscilloscope output showing the issue on the I2C transaction? 

    Also, when you write to the registers below, can you please read them back after you write to them, to verify the settings were properly written to the device? 

    uint8_t Status_Reg_Read[] = {0x04};

    uint8_t Status_Reg_Read_Value[1];

    uint8_t Range_Cntrl_Reg_Value[] = {0x2C, 0x81};

    uint8_t Filter_Setting_Reg_Value[] = {0x28, 0x0A};

    uint8_t Power_Cntrl_Reg_Value[] = {0x2D, 0x00