Post Go back to editing

Issue Reading Analog Values from AIN1 on AD7793 (ESP32-IDF)

Category: Software
Product Number: AD7793
Software Version: ESPIDF

Hello,

I am working with the AD7793 ADC on the ESP32-IDF platform using SPI communication. I have successfully configured SPI and verified communication by reading the ID Register (0x04) and the AVDD monitor channel, both of which return correct values.

However, when I try to read analog values from AIN1 (AIN1+/AIN1-), I am getting garbage values instead of expected ADC conversions. Here’s what I have done:

What Works:

White check mark ID Register (0x04) returns expected value (0xB masked with 0xF).
White check mark AVDD monitor mode (AD7793_CH_AVDD_MONITOR) gives correct values (~3.3V).

Issue:

X Reading from AIN1 (AD7793_CH_AIN1P_AIN1M) returns garbage values.

Steps I Have Taken:

1️⃣ Reset AD7793 before configuration.
2️⃣ Set AIN1 channel using AD7793_SetChannel(AD7793_CH_AIN1P_AIN1M).
3️⃣ Set Gain = 1 using AD7793_SetGain(AD7793_GAIN_1).
4️⃣ Enable internal 1.17V reference using AD7793_SetIntReference(AD7793_REFSEL_INT).
5️⃣ Wait for RDY bit to go low before reading.
6️⃣ Use AD7793_SingleConversion() to get the ADC result.

Despite following these steps, I am getting incorrect/random values when reading from AIN1.
Could you please help me debug this issue? If possible, could you provide any reference code or examples for correctly reading analog inputs on the AD7793 with SPI?

Thank you for your support!