Re: [PATCH v11 1/2] dt-bindings: adc: add AD7173

Ceclan Dumitru
2024-01-18T08:10:50Z

On 1/17/24 18:37, Jonathan Cameron wrote:
> On Wed, 17 Jan 2024 14:43:21 +0200
> Ceclan Dumitru <mitrutzceclan@gmail.com> wrote:
>> On 1/16/24 18:30, Jonathan Cameron wrote:
>>> On Mon, 15 Jan 2024 15:53:39 -0600
>>> David Lechner <dlechner@baylibre.com> wrote:
>>>> On Wed, Dec 20, 2023 at 4:48 AM Dumitru Ceclan <mitrutzceclan@gmail.com> wrote:

...

>>>>> +
>>>>> + refin-supply:
>>>>> + description: external reference supply, can be used as reference for conversion.
>>>> If I'm understanding correctly, this represents both voltage inputs
>>>> REF+ and REF-, correct? The datasheet says "Reference Input Negative
>>>> Terminal. REF− can span from AVSS to AVDD1 − 1 V". It seems like they
>>>> should be separate supplies in case REF- is non-zero. Otherwise, how
>>>> can we know what voltage it is? (same comment applies to refin2.)
>>> Agreed, in this case these are directly used as references (we recently
>>> had another driver that could take a wide range of negative and positive
>>> inputs but in that case an internal reference was generated that didn't
>>> made it not matter exactly what was being supplied. Not true here though!
>>>
>> Wouldn't it be alright to specify that the voltage specified here should
>> be the actual difference (REF+)-(REF-)?
> How do you establish the offset to apply to single ended channels if you don't
> know the value of REF- (relative to local ground)?
>
> So no - as the device supports single ended channels the difference isn't
> enough information. It would probably be fine to do as you say if it
> were a device with only differential channels where all that matters is
> the scaling.

I suppose that you are referring to the first page presentation: "Cross
point multiplexer; 8 full differential or 16 single-ended channels". I
consider this to be a bit misleading as all channels are actually fully
differential (must select positive and negative source, AVSS is not one
of them).

Even more, the datasheet specifies that when using "single-ended"
inputs you need to select which of the pins is the common one and
connect it to the desired GND (be it AVSS, REF-):

"Because there is a cross point mux, the user can set any of the analog
inputs as the common pin. An example of such a scenario is to connect
the AIN16 pin to AVSS or to the REFOUT voltage (that is, AVSS +
2.5 V)" (ad7173-8 page 27)

For me this is 100% the case that this is a fully differential ADC in
which the datasheet presents a way to use it single-ended. Let's say
that we are using EXT_REF, and REF- is non zero. If someone connects
AVSS to the desired common pin, the ADC will still measure correctly the
difference of voltage between AIN_POS and AIN_NEG and compare it to the
EXT_REF.