Eval-ad5370 device tree questions


I am new to AD537x DACs. Currently I want to control the evaluation board eval-ad5370 via SPI directly with my Raspberry Pi 4. I built the kernel (wiki.analog.com/.../raspberrypi) and add the Linux iio drivers for Eval-ad5370 via "make menuconfig" . However, I encounter troubles when writing the device tree overlay file. I copied and change the codes on dtbo file of ad5686 from (https://github.com/analogdevicesinc/linux/commit/4a5b5b72149ad91fe7aa857a75d24fc97f13722e#diff-dc041e47200262dfab1ff9f9e0ef64c7). The code is shown as follows:



/ {

	compatible = "brcm,bcm2708";

	fragment@0 {

		target-path = "/";

		__overlay__ {

			adc_vref: fixedregulator@0 {

				compatible = "regulator-fixed";

				regulator-name = "fixed-supply";

				regulator-min-microvolt = <3000000>;

				regulator-max-microvolt = <3000000>;





	fragment@1 {

		target = <&spi0>;

		__overlay__ {

			#address-cells = <1>;

			#size-cells = <0>;

			status = "okay";


				compatible = "adi,ad5370";

				reg = <0>;

				spi-max-frequency = <1000000>;


				vcc-supply = <&adc_vref>;





The codes actually compiled with one warning, using  "dtc -I dts -O dtb -o" commands. However, it fails to makefile using

sudo dtoverlay rpi-ad5370-overlay.dtbo

I also did not see my dac is connected using  

cd /sys/bus/iio/devices/

So I think my codes for device tree file has issues. I am wondering if someone can help me with the correct setting. I may need the required properties to build the device tree, such as this link (github.com/.../dac) or this link (wiki.analog.com/.../ad5676)

I think there are some threads talking about using Raspberry Pi to control the ad5370. However, I am not sure how they successfully added the device tree.

My ultimate goal is using python codes to control it, such as this link (github.com/.../AD5370). So I think after successfully adding the device tree overlay, I can achieve my goal.

Another option is using windows. However, I may need to program the channels and make a system with feedback(No speed requirements). If there are APIs on python with on windows platform, it will also be great.

Thanks a lot in advance for your help!

  • Hi Mircea,

    Here are some updates.

    I followed your instructions and downloaded the image: https://wiki.analog.com/resources/tools-software/linux-software/adi-kuiper_images. Then I compiled the dts files again. The same warning still occurred.

    However, after adding the device tree via "dtoverlay rpi-ad5370.dtbo", it seems the driver has been added, now I can see the device (iio:device0) in "/sys/bus/iio/devices" path.

    Though I have not connected my Pi to the real device. I think it is a breakthrough since the driver is added. I will update in weekdays to confirm that I can control the DAC with my RPi.


    Sam Feng

  • Update: The driver is added. However,I currently cannot control the device with codes. There are several issues,

    Firstly, I cannot do the following things

    root:/sys/devices/platform/bfin-spi.0/spi0.3/iio:device0> cat name

    I understand that bfin may refer to the "blackfin" processor. Therefore, I do not need to follow its procedure. However, I can't see any other useful information in this folder. I can do "cat name" in other folders, such as:

    root:/sys/devices/platform/bfin-spi.0/spi0.3/iio:device0> cat name

    and shows "ad5370", but I cannot control the voltage with the built-in codes in https://wiki.analog.com/resources/tools-software/linux-drivers/iio-dac/ad5360

    I also try to control the codes with python by sending commands to SPI device directly. The codes available on Github and may be verified by others.  However, errors occurred: "spi.open(0,0) IOError: Errno 2 No such file or directory" . I cannot see spi0.0 by using "ls /dev/spi*". However, I can see spi0.0 in "/sys/bus/spi/devices" and actually "iio:device0" folder is also in "/sys/bus/spi/devices" . Therefore, I should open spi0.0 though I cannot do it.

    I am not sure what wrong it is, I will also check if the connections of SPI and GPIO pins are correct. 


    Chenghao Feng

  • Hi,

    You can see the channels in:

    cd /sys/bus/iio/devices/iio:device0

    Here you have all the channels that you can control with the device. You don't have to send commands directly to the spi that is the role of the driver. Here are command examples:

    echo 10000 > out_voltage0_raw

    Also you could give IIO-Scope a try since you are using the Kuiper Image. This tool will show iio devices and you can interact with them: