Showing results for 
Search instead for 
Did you mean: 

Issues with LIS2DW12 temperature sensor in Single data mode


Hello, guys!

Could you help us understand the issue with single data conversion for an internal temperature sensor of LIS2DW12? While experimenting we followed datasheet (DS11811 - Rev 8), Application Note AN5038 and single data conversion app note DT0102.

When the device is powered up and single data conversion is started we never receive the first two measurement results. The only thing which helps us is the measurement restart.

Other conditions:
- for data control we use of INT2 pin - DRDY_T sensing
- the sensor is used for some other purposes between the two consecutive temperature read calls, that's why the sensor is configured each time for single data conversion
- code fragment is given below:


    // Set up Single data conversion, Low power mode 25 Hz, LP mode 1 12bit resolution:
    write_reg(CTRL6, 0x84, 1);
    write_reg(CTRL2, 0x88);
    write_reg(CTRL1, 0x38);

    // Route DRDY_T on INT2
    write_reg(CTRL5, 0x10);

    // Enable interrupts
    write_reg(CTRL7, 0x20);
    // Start single data conversion
    write_reg(CTRL3, 0x03);

        if ((!delay_count) && (restart_count))
            // Workaround: Restart single data conversion in case of the result absence:
            write_reg(CTRL3, 0x03);
            delay_count = 0x0F;
        drdy = HAL_GPIO_ReadPin(... INT2_PIN);

    } while ((GPIO_PIN_RESET == drdy) && (delay_count-- > 0));
    if (GPIO_PIN_SET == drdy)
        read_reg(OUT_T_L, temperature, 2); 



In the code above for the first two measurements after the sensor power up INT2 never fired whichever values of 'delay_count' were used. Only consecutive restart of the single data conversion helped finally to have INT2 =1 and the result achieved. This is true for each test after the device is power up and several single data conversion is started using the code above. After the first measurement is received, consecutive conversion cycles work flawlessly, giving out the results immediately. We also tried to play with delays, but to no avail. Only the solution above seems to be stable.

We didn't find explanation for this kind of behavior in ST documents.

1. How this can be explained?
2. Are there any mistakes in the measurement configuration we applied?
3. If there is explanation, is this behavior expected for all LIS2DW12 sensors irrespective of revision / delivery lot?

Federica Bossi
ST Employee

Hi @stKAT ,

This behavior is not expected, we have never faced something like this. It could be related to your code, so please try this instead of your do while:

SET CTRL3 to 0x03;
uint8_t drdy_t;
while(interrupt_temp == 1 && drdy_t == 0){
  drdy_t = READ_TEMP_DRDY();
if(drdy_t == 1){

Remember to set in INT2 routine the interrupt_temp variable to 1.

If this helps you, please mark my answer as "Best Answer" by clicking on the "Accept as Solution" button, this can be helpful for Community users to find this solution faster.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.