2020-09-13 11:11 PM
Device Reset after every data conversion
Value of all CTRL registers = Power On RESET value
device initialization steps
Read samples in polling mode
Solved! Go to Solution.
2020-09-14 04:30 AM
Hi @Aishwarya ,
which kind of error are you facing? Communication (SPI or I2C) error or dataout error?
I'm afraid there is something wrong with the IF_ADD_INC bit configuration in register CTRL2 (21h)... can you please try with setting this bit to 0?
Btw, I suggest you to check if your configuration is OK on the LIS2DTW12 C-examples on Github, especially the lis2dtw12_read_data_polling.c file.
/* Enable Block Data Update */
lis2dtw12_block_data_update_set(&dev_ctx, PROPERTY_ENABLE);
/* Set full scale */
lis2dtw12_full_scale_set(&dev_ctx, LIS2DTW12_8g);
/* Configure filtering chain
*
* Accelerometer - filter path / bandwidth */
lis2dtw12_filter_path_set(&dev_ctx, LIS2DTW12_LPF_ON_OUT);
lis2dtw12_filter_bandwidth_set(&dev_ctx, LIS2DTW12_ODR_DIV_4);
/* Configure power mode */
//lis2dtw12_power_mode_set(&dev_ctx, LIS2DTW12_HIGH_PERFORMANCE);
lis2dtw12_power_mode_set(&dev_ctx, LIS2DTW12_CONT_LOW_PWR_LOW_NOISE_12bit);
/* Set Output Data Rate */
lis2dtw12_data_rate_set(&dev_ctx, LIS2DTW12_XL_ODR_25Hz);
-Eleon
2020-09-14 04:30 AM
Hi @Aishwarya ,
which kind of error are you facing? Communication (SPI or I2C) error or dataout error?
I'm afraid there is something wrong with the IF_ADD_INC bit configuration in register CTRL2 (21h)... can you please try with setting this bit to 0?
Btw, I suggest you to check if your configuration is OK on the LIS2DTW12 C-examples on Github, especially the lis2dtw12_read_data_polling.c file.
/* Enable Block Data Update */
lis2dtw12_block_data_update_set(&dev_ctx, PROPERTY_ENABLE);
/* Set full scale */
lis2dtw12_full_scale_set(&dev_ctx, LIS2DTW12_8g);
/* Configure filtering chain
*
* Accelerometer - filter path / bandwidth */
lis2dtw12_filter_path_set(&dev_ctx, LIS2DTW12_LPF_ON_OUT);
lis2dtw12_filter_bandwidth_set(&dev_ctx, LIS2DTW12_ODR_DIV_4);
/* Configure power mode */
//lis2dtw12_power_mode_set(&dev_ctx, LIS2DTW12_HIGH_PERFORMANCE);
lis2dtw12_power_mode_set(&dev_ctx, LIS2DTW12_CONT_LOW_PWR_LOW_NOISE_12bit);
/* Set Output Data Rate */
lis2dtw12_data_rate_set(&dev_ctx, LIS2DTW12_XL_ODR_25Hz);
-Eleon
2020-09-14 06:18 AM