cancel
Showing results for 
Search instead for 
Did you mean: 

Range setting in ISM330DLC

reedomneck
Associate III

Hi All,

I am working on a project that is using ISM330DLC sensor for measuring the acceleration along the X,Y and Z-axis. 

When I set range 2G,4G and 8G I'm seeing difference in the sensor raw value and when I set it to 16G, I'm getting same data as 8G.

eg: 

Z-axis data:

2G : 1030 

4G : 517

8G : 258

16 : 256  

Regards, 

Dom

10 REPLIES 10
Miroslav BATEK
ST Employee

What is your sensor configuration?

Are the reported values really raw data from the sensor? It doesn't look to me.

If not how do you convert the raw values from high and low register to mg?

reedomneck
Associate III

Below are configuration:

ISM330DLC_CTRL3_C = 0x44        

ISM330DLC_CTRL8_XL = 0x20            

ISM330DLC_FIFO_CTRL5 = 00;          

ISM330DLC_CTRL1_XL  = 0xA4;        

           

ISM330DLC_FIFO_CTRL3 = 0x01;

And reported values are all Z-axes raw data from the sensor for different ranges

Miroslav BATEK
ST Employee

You read or interpret the output data incorrectly.

You can do it in example as follows:

int16_t result_lsb;

float result_mg;

result_lsb = ((int16_t)high_byte<<8)+(uint16_t)low_byte;

result_mg = result_lsb * sensitivity; // LSB to mg, see sensitivity in datasheet

reedomneck
Associate III

0690X000006CJX0QAO.pngThis part I'm able to do ..

My issue is for 8G and 16G, the raw data values are same..

You can refer to the attached graph for more details..

Miroslav BATEK
ST Employee

Your raw data for 2g and 4g look also the same.

If you measure 1g of gravity the raw value for 2g range should be around 16000.

I think you have some mistake in your program.

How do you switch the full scale ranges?

reedomneck
Associate III

At run time dynamically we are not changing.

For testing we are changing ISM330DLC_CTRL1_XL register and building and flashing.

reedomneck
Associate III

Do you have any sample project or source code.

It would be really helpful

Miroslav BATEK
ST Employee
reedomneck
Associate III

Thanks,

I'm using the same code as reference and I have modified according to my application requirement.

But still I'm facing the same issue..

Initialization code:

ISM330DLC_WRITE(Register,value);///Prototype

ISM330DLC_WRITE((0x12), 0x44);

ISM330DLC_WRITE((0x17), 0x20 );

ISM330DLC_WRITE((0x0A), 0x00);

ISM330DLC_WRITE((0x10), 0xA0 );

ISM330DLC_WRITE((0x0A), (0x50));

ISM330DLC_WRITE((0x08), 0x01 );

ISM330DLC_WRITE((0x0A), 0x56);

ISM330DLC_WRITE((0x06), 0x30);

ISM330DLC_WRITE((0x0D), 0x08 }

Read data part:

typedef struct{ // Result structure

  int16_t acc_x;

  int16_t acc_y;

  int16_t acc_z;

} lsm_data;

ISM330DLC_READ(FIFO_DATA_OUT_L,lsm_data);