2018-11-04 11:07 PM
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
2018-11-05 12:25 AM
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?
2018-11-05 12:35 AM
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
2018-11-05 01:16 AM
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
2018-11-05 01:17 AM
This 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..
2018-11-05 03:42 AM
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?
2018-11-05 03:57 AM
At run time dynamically we are not changing.
For testing we are changing ISM330DLC_CTRL1_XL register and building and flashing.
2018-11-05 09:09 PM
Do you have any sample project or source code.
It would be really helpful
2018-11-06 01:18 AM
Please check the example here:
https://github.com/STMicroelectronics/STMems_Standard_C_drivers/tree/master/ism330dlc_STdC
2018-11-06 03:12 AM
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);