LIS3DH Auxiliary ADC using STM8 is giving constant value
Hi
I am working on a project where we are reading the battery level on the ADC1 of LIS3DH. This value I need to read using STM8L051F3P. I am using SDCC compiler.
I am able to read the WHO_AM_I register. I am also able to set the accelerometer thresholds and detect the interrupt. This means that I2C communication between STM and LIS is working fine.
I have followed the steps to configure ADC1 as given in datasheet:
The user must set the BDU bit (bit 7) to 1 in CTRL_REG4 (23h) -- DONE
The ADC_EN bit (bit 7) to 1 in TEMP_CFG_REG (1Fh) -- DONE
In low-power mode, the ADC resolution is 8-bit. -- OK
Now what's happening is, whenever I read the
OUT_ADC1_L (08h) -- always giving 0x00
OUT_ADC1_H (09h) -- always giving 0x80
- What do these values mean?
- What could be wrong with my configuration? Am I missing setting up some register? Do I need to follow the read regsiter command with some other command after every operation?
I didn't find any relevant codes online on blogs etc. either.
(Because I am using SDCC, I cannot do LIVE debugging in ST Visual Develop, so I am writing the variable values in EEPROM instead.)
Looking forward to your input(s).
