Post Go back to editing

set up ad5541 support for imx6sx SOM (device tree)

I need to set up an ad5541 IC connected to the system SPI bus using the device tree.

According my current linux kernel (4.1.15) the IC is supported by the ad5446.c driver. I already checked the docu from AnalogDevices.

https://wiki.analog.com/resources/tools-software/linux-drivers/iio-dac/ad5446

I already configured my SPI bus including chip select (see [1]) and tested the interface successfully.


How can I insert and configure the device tree example from the manufacture documentation to use the driver?

Thanks!!!

[1]:

#ifdef CONFIG_EFUSA9X_SPI_B
/* SPI_B implemented via ECSPI1, 1x or 2x CS, depending on RTS of UART_C */
&ecspi1 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_ecspi1>;
#if defined(CONFIG_EFUSA9X_BLUETOOTH) || defined(CONFIG_EFUSA9X_UART_C_RTSCTS)
	/* If UART_C uses RTS, we have only one CS for SPI_B */
	fsl,spi-num-chipselects = <1>;
	cs-gpios = <&gpio4 22 0>;
#else
	/* If UART_C does not use RTS, we can have a second CS on SPI_B */
	fsl,spi-num-chipselects = <2>;
	cs-gpios = <&gpio4 22 0>, <&gpio4 19 0>;
#endif
	status = "okay";
	// AD7190 Current
	spidev@0 {
		#address-cells = <1>;
		#size-cells = <1>;
		compatible = "linux,spidev";
		spi-max-frequency = <20000000>;
		reg = <0>;
	};

	
	// CurrentSink
#if !defined(CONFIG_EFUSA9X_BLUETOOTH) && !defined(CONFIG_EFUSA9X_UART_C_RTSCTS)
	spidev@1 {
		#address-cells = <1>;
		#size-cells = <1>;
		compatible = "linux,spidev";
		spi-max-frequency = <20000000>;
		reg = <1>;
	};
#endif
};
#endif /* CONFIG_EFUSA9X_SPI_B */

Parents
  • Do you want to use the Linux driver or the userspace AD5541 driver?

    spidev is a SW emulation/control for userspace to access devices using SPI protocol

    If you want to use the Linux driver, you need to make sure it's loaded/built into the kernel.

    If it's NXP's kernel, we can't say for sure if it's enabled/built; you will need to check yourself in their SDK [or whatever is being used].

    Are you using CS 1 or 0 ?

    &ecspi1 {

          ad5441: ad5441@1 {

                   compatible = <adi,ad5541a>;

                    #address-cells = <1>;
                    #size-cells = <1>;
                   reg = <1>;

          }

    }

  • I updated my linux kernel to: 4.9.88

    And I althogh made some changes at the device tree.

    #if !defined(CONFIG_EFUSA9X_BLUETOOTH) && !defined(CONFIG_EFUSA9X_UART_C_RTSCTS)
    
    	vref: fixedregulator@1 {
    		compatible = "regulator-fixed";
    		regulator-name = "fixed-supply";
    		regulator-min-microvolt = <4096000>;
    		regulator-max-microvolt = <4096000>;
    		regulator-always-on;
           };
    
    	dac_vcc: fixedregulator@1 {
    		compatible = "regulator-fixed";
    		regulator-name = "fixed-supply";
    		regulator-min-microvolt = <5000000>;
    		regulator-max-microvolt = <5000000>;
    		regulator-boot-on;
         };
    
    	ad5441: ad5441@1 {
    		compatible = "adi,ad5541a";
    		#address-cells = <1>;
    		#size-cells = <1>;
    		spi-max-frequency = <1000000>;
    		spi-cpha;
    		spi-cpol;
    //		vref-supply = <&vref>;
    		REF-supply = <&vref>;
    		vcc-supply = <&dac_vcc>;
    		reg = <1>;
    
    	};
    #endif

    The driver implementation seems to be good so far:


    When I write different values into the out_voltage0_raw, on the output VOUT no voltage change is detected.


    The problem seems to be that the reference voltage is unspecified.

    In the device tree example above are two reference deffinitions.
    I tried both, but got the same result. (see dmesg)



    How can I correctly define the reference voltage in the device tree?

    Thanks for your help!!!

Reply
  • I updated my linux kernel to: 4.9.88

    And I althogh made some changes at the device tree.

    #if !defined(CONFIG_EFUSA9X_BLUETOOTH) && !defined(CONFIG_EFUSA9X_UART_C_RTSCTS)
    
    	vref: fixedregulator@1 {
    		compatible = "regulator-fixed";
    		regulator-name = "fixed-supply";
    		regulator-min-microvolt = <4096000>;
    		regulator-max-microvolt = <4096000>;
    		regulator-always-on;
           };
    
    	dac_vcc: fixedregulator@1 {
    		compatible = "regulator-fixed";
    		regulator-name = "fixed-supply";
    		regulator-min-microvolt = <5000000>;
    		regulator-max-microvolt = <5000000>;
    		regulator-boot-on;
         };
    
    	ad5441: ad5441@1 {
    		compatible = "adi,ad5541a";
    		#address-cells = <1>;
    		#size-cells = <1>;
    		spi-max-frequency = <1000000>;
    		spi-cpha;
    		spi-cpol;
    //		vref-supply = <&vref>;
    		REF-supply = <&vref>;
    		vcc-supply = <&dac_vcc>;
    		reg = <1>;
    
    	};
    #endif

    The driver implementation seems to be good so far:


    When I write different values into the out_voltage0_raw, on the output VOUT no voltage change is detected.


    The problem seems to be that the reference voltage is unspecified.

    In the device tree example above are two reference deffinitions.
    I tried both, but got the same result. (see dmesg)



    How can I correctly define the reference voltage in the device tree?

    Thanks for your help!!!

Children
No Data