Skip to contentSkip to conversation

iio: dac: ad5504: Inquiry regarding voltage scale calculation

RFC Taha Ed-Dafili 2 participants 3 messages Feb 10 – Feb 11 IIO

lore
Share & tools
lore
#0 lore raw

Greetings everyone,

I've been reviewing the ad5504 driver and comparing it with the datasheet, and I want to verify my understanding of a potential discrepancy.

Datasheet:

https://www.analog.com/media/en/technical-documentation/data-sheets/ad5504.pdf

The Issue:

The driver currently uses the vcc regulator voltage to calculate the output scale. However, the datasheet (Rev B, Page 1) states the device has an integrated precision reference. The output range (0-30V or 0-60V) is determined by the R_SEL pin, not the supply voltage.

If my understanding is correct, using vcc for scaling is flawed. For example, a 40V supply currently results in a ~9.7mV scale (40V / 4096), whereas the hardware output (in 30V mode) is fixed at ~7.32mV (30V / 4096).

My Questions:

1. Is it correct to replace the VCC-based scaling with fixed constants?
2. To support the 60V range, the driver needs to know the state of the R_SEL pin. What is the preferred way to handle this hardware configuration in the bindings?

If you can confirm this and provide guidance on the binding, I would be happy to prepare a patch to address it.

Thanks,
Taha

reviewer
#1 lore raw
Quoted 17 lines · Taha Ed-Dafili

Greetings everyone,

I've been reviewing the ad5504 driver and comparing it with the datasheet, and I want to verify my understanding of a potential discrepancy.

Datasheet:

https://www.analog.com/media/en/technical-documentation/data-sheets/ad5504.pdf

The Issue:

The driver currently uses the vcc regulator voltage to calculate the output scale. However, the datasheet (Rev B, Page 1) states the device has an integrated precision reference. The output range (0-30V or 0-60V) is determined by the R_SEL pin, not the supply voltage.

Quoted 8 lines

If my understanding is correct, using vcc for scaling is flawed. For example, a 40V supply currently results in a ~9.7mV scale (40V / 4096), whereas the hardware output (in 30V mode) is fixed at ~7.32mV (30V / 4096).

My Questions:

1. Is it correct to replace the VCC-based scaling with fixed constants?

Yes, I think you are reading the datasheet correctly. I'm guessing past users just put in raw values and didn't use the scale attribute.

Quoted 3 lines

2. To support the 60V range, the driver needs to know the state of the R_SEL pin. What is the preferred way to handle this hardware configuration in the bindings?

This is another one of those cases where the pin could be hard-wired or controlled by a GPIO. We don't have to implement both cases in the driver, but we should try to make the DT bindings complete.

properties:
output-range-gpios:
description:
A GPIO connected to the /R_SEL pin to select the output voltage range.
output-range-volts:
description:
Hard-wired /R_SEL pin state. 30 V when pin is high and 60 V when pin is low.
enum: [30, 60]
default: 60

allOf:
# Can't have GPIO and hard-wired at the same time.
- if:
required: output-range-gpios
then:
output-range-volts: false
- if:
required: output-range-volts
then:
output-range-gpios: false

Quoted 3 lines

If you can confirm this and provide guidance on the binding, I would be happy to prepare a patch to address it.

And we should fix other trivial missing things in the bindings while we are at it.

vlogic-supply: true

clear-gpios:
description: GPIO that controls the /CLR pin

ldac-gpios: true

Quoted 3 lines

Thanks,
Taha

#2 lore raw

Hi David,

Thank you for confirming the issue and for the detailed guidance on the bindings.

I will prepare a patch series following your suggestions and send it as soon as it is ready for review.

Best regards,
Taha