cancel
Showing results for 
Search instead for 
Did you mean: 

LIS3DSH

chaitanya chippada
Associate II

Hi,

I interfaced LIS3DSH with Nordic controller(PCA10040). I am facing following issues:

  1. Data is repeating in Y-Axis.
  2. Data is coming 0 for 3 times continously in I2C read buffer.
  3. In X-axis same data is coming for 4 seconds data like 1964

please suggest any ways to solve this problems.

for your reference I am attaching data0690X000009YTBMQA4.png

Thanks & Regards,

Chaitanya.

4 REPLIES 4
Eleon BORLINI
ST Employee

Hi @chaitanya chippada​ , a few questions to understand the issue: are you correctly converting raw data into 16-bit two's complement data? Are you reading data in continuous mode and at which ODR? Vdd and VddIO have the same value? Regards

chaitanya chippada
Associate II

Hi Eleon,

Thanks for your reply,

are you correctly converting raw data into 16-bit two's complement data?

A. Yes, we are converting correctly, as some other data points is correct, following is the function we are using for converting raw value to g value.

int16_t two_compl_to_int16(uint16_t two_compl_value)

{

   int16_t int16_value = 0;

   /* conversion */

   if (two_compl_value > 32768) {

       int16_value = (int16_t)(-(((~two_compl_value) & (uint16_t)(0xFFFF)) + (uint16_t)(1)));

   } else {

       int16_value = (int16_t)(two_compl_value);

   }

   return int16_value;

}

Are you reading data in continuous mode and at which ODR?

A. we are reading data from sensor continously (stream mode)by giving required delay, for your reference I am attaching configured parameters, please suggest if any other settings required.

   ret_code_t err = NRF_SUCCESS;

   uint8_t reg[2] = {0x00};

   reg[0] = MEMS_SENSOR_CTRL_REG4_ADDR;

   reg[1] |= DATARATE_1600;

   err = writeTolis3dsh(&reg[0], sizeof(reg));

   APP_ERROR_CHECK(err);

   reg[0] = MEMS_SENSOR_CTRL_REG4_ADDR;

   reg[1] |= XYZ_ENABLE;

   err = writeTolis3dsh(&reg[0], sizeof(reg));

   APP_ERROR_CHECK(err);

   reg[0] = MEMS_SENSOR_CTRL_REG3_ADDR;

   reg[1] = 0x00;

   err = writeTolis3dsh(&reg[0], sizeof(reg));

   APP_ERROR_CHECK(err);

   reg[0] = MEMS_SENSOR_CTRL_REG5_ADDR;

   reg[1] |= FILTER_BW_800;

   err = writeTolis3dsh(&reg[0], sizeof(reg));

   APP_ERROR_CHECK(err);

   reg[0] = MEMS_SENSOR_CTRL_REG5_ADDR;

   reg[1] |= FULLSCALE_2;

   err = writeTolis3dsh(&reg[0], sizeof(reg));

   APP_ERROR_CHECK(err);

   reg[0] = MEMS_SENSOR_CTRL_REG5_ADDR;

   reg[1] |= (SELFTEST_NORMAL | SERIALINTERFACE_4WIRE);

   err = writeTolis3dsh(&reg[0], sizeof(reg));

   APP_ERROR_CHECK(err);

   reg[0] = MEMS_SENSOR_CTRL_REG6_ADDR;

   reg[1] |= (FIFO_ENABLE | AUTO_ADDRESS_INCREMENT);

   err = writeTolis3dsh(&reg[0], sizeof(reg));

   APP_ERROR_CHECK(err);

   reg[0] = MEMS_SENSOR_FIFO_CTRL_ADDR;

   //reg[1] |= FIFO_STREAM_MODE;

   reg[1] = FIFO_STREAM_MODE;//0x40;//0x54;

   err = writeTolis3dsh(&reg[0], sizeof(reg));

   APP_ERROR_CHECK(err);

Vdd and VddIO have the same value?

A. Yes, Vdd & VddIO is same value 3.3 V

Thanks for your quick support,

Regards,

chaitanya

chaitanya chippada
Associate II

a few questions to understand the issue:

are you correctly converting raw data into 16-bit two's complement data?

A. Yes we are correctly converting raw data

Are you reading data in continuous mode and at which ODR?

A. We are reading in stream mode with 1.6KHz ODR

Vdd and VddIO have the same value?

VDD and Vddio have same value 3.3volts

Regards,

chaitanya

Eleon BORLINI
ST Employee

Do you have the same issue also at lower ODR? Regards