I'm trying to configure the ad7124-4 to read its internal temperature sensor. I feel this is most of a software issue (configuration) than hardware that I'm not reading the right value.
This my code flow:
SPI_write 0xB211 to 0x0E // Channel 5, AINP to temperature sensor, AINM to AVSS
SPI_write 0x0810 to 0x1C // Config 3
SPI_write 0x0182 to 0x01 // ADC_CONTROL
while ( SPI_read(0x00) & (1<<7)); // wait till RDY bit goes low
data_32 = SPI_read from address 0x02 // Data register
float temperature = ((data_32 - 0x800000)/13,584) - 272.5;
But I end up getting 311.5 as my temperature and it never changes. It's always constant. Also when I read 0x00 status register, it is 0x00 all the time. I don't get why it doesn't even show channel 5 as active.
Note: 1. I have verified that all my SPI writes have gone through by reading back the registers again.
2. I observed the DRDY pin when CS was pulled low, CLK , VS, GND : connected, MISO, MOSI: unconnected and it was pulsing as expected.
3. The AD7124-4 is connected to my STM32 discover board which is powered by my USB.
4. All the other registers not mentioned above have their default values.
5. The reset_device() has also been verified by reading back the values of the registers and they match the reset values specified in the datasheet.
Any help is greatly appreciated.