Skip to main content
Visitor II
September 14, 2020
Solved

LIS2DTW12 Read data continuous @ dataRate 25Hz, High-Resolution mode. ERROR

  • September 14, 2020
  • 1 reply
  • 817 views

Device Reset after every data conversion

Value of all CTRL registers = Power On RESET value

device initialization steps

  • power on
  • delay 20 ms
  • read device id
  • reset device
  • delay 5 ms
  • write CTRL1 0x30
  • write CTRL2 0x0C
  • write CTRL6 0x60

Read samples in polling mode

    This topic has been closed for replies.
    Best answer by Eleon BORLINI

    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

    1 reply

    ST Employee
    September 14, 2020

    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

    AishwaryaAuthor
    Visitor II
    September 14, 2020

    Thanks

    Eleon BORLINI

    yes this is a problem of IF_ADD_INC bit configuration