2020-02-17 10:11 PM
It is always 0 to get the value of OUT_TEMP_L_A (0Ch), OUT_TEMP_H_A (0Dh).
Before reading OUT_TEMP_L_A (0Ch), OUT_TEMP_H_A (0Dh), check the values of TEMP_CFG_REG_A (1Fh), CTRL_REG4_A (23h) and STATUS_REG_AUX_A (07h) as bellow:
TEMP_CFG_REG_A (1Fh): 0xC7
CTRL_REG4_A (23h): 0x80
STATUS_REG_AUX_A (07h): 0xFF
2020-02-18 01:23 AM
which protocol and controller you are using?
2020-02-18 04:57 PM
Host side is Freescale i.MX8MQ. The STMems_Android_Sensor_HAL_Input driver from ST's website is used on Android 9.
No temperature sensor is implemented in the lsm303agr part of STMems_Android_Sensor_HAL_Input driver.
I try to add some code in the lsm303agr_acc.c to verify the temperature sensor.
In the initial function(lsm303agr_acc_hw_init), the BDU bit is set to 1 in CTRL_REG4_A (23h) and the TEMP_EN[1:0] bits are set to ‘1’ in the TEMP_CFG_REG_A (1Fh) register, too.