LIS2DU12TR accelerometer
Hi.
I used LIS2DU12TR accelerometer IC on the PCB.
It's angle value was changing every sec. but my smart phone app indicated current angle is 0.0 degree.
current angle is -0.515648
[proc_bt_read_all] TX data (len=15)
00 00 02 00 00 00 00 00 00 7F 00 64 37 01 00
current angle is -0.865430
[proc_bt_read_all] TX data (len=15)
00 00 02 00 00 00 00 00 00 7F 00 64 37 01 00
current angle is -0.460660
[proc_bt_read_all] TX data (len=15)
00 00 02 00 00 00 00 00 00 7F 00 64 37 01 00
current angle is -0.688205
[proc_bt_read_all] TX data (len=15)
00 00 02 00 00 00 00 00 00 7F 00 64 37 01 00
---------------------------------
How can I set ODR and FS variables , more accuracy and more stable this IC ,
LIS2DU12StatusTypeDef LIS2DU12_Begin()
{
/* Disable I3C */
if (lis2du12_bus_mode_set(®_ctx, LIS2DU12_I3C_DISABLE) != LIS2DU12_OK) {
return LIS2DU12_ERROR;
}
/* Enable register address automatically incremented during a multiple byte
access with a serial interface. Enable BDU. */
if (lis2du12_init_set(®_ctx, LIS2DU12_DRV_RDY) != LIS2DU12_OK) {
return LIS2DU12_ERROR;
}
/* FIFO mode selection */
lis2du12_fifo_md_t fifo_mode = {
.operation = LIS2DU12_BYPASS,
.store = LIS2DU12_16_BIT,
.watermark = 0,
};
if (lis2du12_fifo_mode_set(®_ctx, &fifo_mode) != LIS2DU12_OK) {
return LIS2DU12_ERROR;
}
/* Select default output data rate. */
X_odr = 400.0f;
/* Select default ultra low power (disabled). */
X_ultra_low_power = LIS2DU12_ULTRA_LOW_POWER_DISABLE;
/* Output data rate: power down, full scale: 2g */
lis2du12_md_t mode = {
.odr = LIS2DU12_OFF,
.fs = LIS2DU12_2g,
};
if (lis2du12_mode_set(®_ctx, &mode) != LIS2DU12_OK) {
return LIS2DU12_ERROR;
}
initialized = 1L;
return LIS2DU12_OK;
}
