Post Go back to editing

AD5372 offset using iio

Hello,

I'm controlling an EVAL-AD5372 board using a Raspberry Pi 4 running ADI's Linux distribution and kernel with a reference voltage of 5V.  The default offset results in a range of  -6.6V to 11.2V but I need -10V to 10V.   I'm able to set the correct offset to achieve the range, then set the raw output so that the channels all sit at 0V.  Since there's a delay between setting the offset and setting the output, I fear the temporary voltage spike may damage the equipment I'm controlling.   Is there a way to set the offset in the device tree or the kernel driver?

Thank you for your advice.

Parents
  • Hi, 

    I'll check your concern with the Linux driver support team. 

    If you're worried about the spike when changing the output range via the offset, what you can do is to make use of the /CLR function before setting the offset and output.

    Best regards,

    Ian

  • Thank you Ian and Travis.  Could you clarify on how this is accomplished in the device tree?  Matches for string "offset" in the page you shared are limited to the sysfs sections.  I'm attaching my working device tree.

     

    /dts-v1/;
    /plugin/;
    
    / {
            compatible = "brcm,bcm2711";
            fragment@0 {
                    target-path = "/";
                    __overlay__ {
                            vref0: fixedregulator@0 {
                                    compatible = "regulator-fixed";
                                    regulator-name = "fixed-supply";
                                    regulator-min-microvolt = <5000000>;
                                    regulator-max-microvolt = <5000000>;
                                    regulator-boot-on;
                            };
                            vref1: fixedregulator@1 {
                                    compatible = "regulator-fixed";
                                    regulator-name = "fixed-supply";
                                    regulator-min-microvolt = <5000000>;
                                    regulator-max-microvolt = <5000000>;
                                    regulator-boot-on;
                            };
                    };
            };
    
            fragment@1 {
                    target = <&spi0>;
                    __overlay__ {
                            #address-cells = <1>;
                            #size-cells = <0>;
                            status = "okay";
    
                            ad5372@0{
                                    compatible = "adi,ad5372";
                                    reg = <0>;
                                    spi-max-frequency = <100000>;
                                    spi-cpha;
                                    vref0-supply = <&vref0>;
                                    vref1-supply = <&vref1>;
                            };
                    };
            };
    };

Reply
  • Thank you Ian and Travis.  Could you clarify on how this is accomplished in the device tree?  Matches for string "offset" in the page you shared are limited to the sysfs sections.  I'm attaching my working device tree.

     

    /dts-v1/;
    /plugin/;
    
    / {
            compatible = "brcm,bcm2711";
            fragment@0 {
                    target-path = "/";
                    __overlay__ {
                            vref0: fixedregulator@0 {
                                    compatible = "regulator-fixed";
                                    regulator-name = "fixed-supply";
                                    regulator-min-microvolt = <5000000>;
                                    regulator-max-microvolt = <5000000>;
                                    regulator-boot-on;
                            };
                            vref1: fixedregulator@1 {
                                    compatible = "regulator-fixed";
                                    regulator-name = "fixed-supply";
                                    regulator-min-microvolt = <5000000>;
                                    regulator-max-microvolt = <5000000>;
                                    regulator-boot-on;
                            };
                    };
            };
    
            fragment@1 {
                    target = <&spi0>;
                    __overlay__ {
                            #address-cells = <1>;
                            #size-cells = <0>;
                            status = "okay";
    
                            ad5372@0{
                                    compatible = "adi,ad5372";
                                    reg = <0>;
                                    spi-max-frequency = <100000>;
                                    spi-cpha;
                                    vref0-supply = <&vref0>;
                                    vref1-supply = <&vref1>;
                            };
                    };
            };
    };

Children