Hi
I am using the dwm-simple example from new firmware release to add more functionalities such as reading accelerometer and temperature sensor data from LIS2DH12. As per the datasheet of LIS2DH12, there is inbuilt temperature sensor . The value of temperature sensor can be read from two output registers OUT_TEMP_L, OUT_TEMP_H.
I am using following configurations to initialize LIS2DH12 registers:
- Write 57h into CTRL_REG1 // Turn on the sensor and enable X, Y, and Z, ODR = 100 Hz
- Write 00h into CTRL_REG2 // High-pass filter disabled
- Write 40h into CTRL_REG3 // Interrupt activity 1 driven to INT1 pad
- Write 80h into CTRL_REG4 // FS = ±2 g, enable BDU
- Write 08h into CTRL_REG5 // Interrupt 1 pin latched
- Write 10h into INT1_THS // Threshold = 250 mg
- Write 00h into INT1_DURATION // Duration = 0
- Write 2Ah into INT1_CFG
- Write C0h into TEMP_CFG_REG
If there is new data arrival i.e TDA bit is high in STATUS_REG_AUX, my code reads output temperature registers, I use the following method to convert raw temperature reading to Celsius.
temp_in_celsius = ((OUT_TEMP_H / 64) / 4) + 25;
The problem is I am only getting same value i.e 25. I used soldering iron to test the variations in temperature but nothing has changed the raw data output of both registers OUT_TEMP_H, OUT_TEMP_L.
I would really appreciate any help.