Post Go back to editing

how to install ADF5355 linux driver on Raspberry pi3 ?

Hi all,

I'm not seeing  ADF5355 driver in Raspberry pi kernel (https://github.com/raspberrypi/linux ). I tried versions up to 4.16. 

Under Synthesizers DDS/PLL category, I can see only ADF4350/ADF4350 as shown below : 

Also, ADF5355 IIO Wideband Synthesizer Linux Driver [Analog Devices Wiki]  suggests to set the following options.

 --- Industrial I/O support               -*-   Enable ring buffer support within IIO               -*-     Industrial I/O lock free software ring               -*-   Enable triggered sampling support

but what I get is as follows : There's no option for "Enable ring buffer support" & "Industrial I/O lock free software ring"

I saw this post : Stuck setting up ADF5355  and it says ADF5355 is working with Raspberry Pi3, but the post does not tell the steps taken to install the driver.  I don't know much about kernel/driver installation & I don't know where to put .dts files, where to put source files (.h .c) etc. when adding new drivers. 

Please bare with me, my linux kernel/driver installation knowledge is very limited. 

It would be great if someone could guide me to control ADF5355 with RPi 3 using iio device driver. 

Cheers,

  • That driver has not been upstreamed/mainlined yet.

    You can only use from the ADI kernel repo here: GitHub - analogdevicesinc/linux: Mirror of Linus Torvald's Kernel Tree 

  • I guess, I can' use ADI linux kernel directly on Raspberry Pi. 

    Is there a way modify it without knowing much about linux kernels?

    This post reports this driver works with Raspberry Pi:

    Stuck setting up ADF5355  

    How it's possible? By modifying ADI kernel or by modifying Raspberry PI kernel?

    Cheers,

  • I downloaded ADI RPi tree and started compiling kernel. 

    Do I need to add a .dts for ADF5355 on this source? or is it already there?

    if .dts is already there, what's the location please? 

    cheers,

  • Correct ADF5355 and similar are write only. LE functions as a typical SPI CS, while chip CE can be tied to Vdd.

    -Michael

  • Thanks Michael,

    I downloaded the ADI RPi repo and built the kernel with ADF5355 enabled.

    I used overlays you've mentioned.


    pi@raspberrypi:/sys/bus/iio/devices $ uname -a
    Linux raspberrypi 4.9.51-v7+ #1 SMP Fri Jun 1 16:51:30 UTC 2018 armv7l GNU/Linux

    When I reboot the Raspberry pi, looks like it does not load the adf5355 driver. 

    There's no /sys/bus/iio/devices is empty and no adf5355 in /sys/bus/spi as shown below

    I used overlay mentioned in the last one mentioned in this post : Stuck setting up ADF5355  and no change.

    pi@raspberrypi:~ $ cd /sys/bus/iio/devices
    pi@raspberrypi:/sys/bus/iio/devices $ ls
    pi@raspberrypi:/sys/bus/iio/devices $

    pi@raspberrypi:~ $ ls /sys/bus/spi/drivers
    spidev stmpe-spi

    but, after $ modprobe adf5355, adf5355 appears under /sys/bus/spi/drivers

    pi@raspberrypi:~ $ ls /sys/bus/spi/drivers
    adf5355 spidev stmpe-spi

    However, "Driver testing" in ADF5355 IIO Wideband Synthesizer Linux Driver [Analog Devices Wiki]  does not work as /sys/bus/iio/devices is empty.

    BTW, the spi port is working on this board when I use other user progs written on python.

    In addition to the overlay file, do I need to modify any other files to define IO pins of raspberry pi which ADF5355 SPI interface (DATA, CLK, LE) is connected to?

    cheers,

  • Hey,

    To make sure [and I'm sorry if this is redundant stuff] ; did you ?
    * copy the overlay file [dtbo] to your raspberry Pi's boot partition under /boot/overlays

    * add an entry in the /boot/config.txt file with dtoverlay=<your dtb-o file in /boot/overlays]

    When you say that the SPI port works: are you using the Raspberry Pi's SPI controller or a SPIDEV [that emulates SPI via userspace calls] ?

    Usually for drivers on Raspberry PI we use the Raspberry Pi's SPI controller [the one under Kconfig symbol CONFIG_SPI_BCM2835 ].

    If you want, maybe you could share some of the files you are using:

    * can you post your devicetree overlay file ?

    * /boot/config.txt file ?

    * some detail [a pic maybe[ about your wiring between the Raspberry PI and the ADF5355

    * dmesg output grepped via adf5355; something like  dmesg | grep -i adf5355 

    If it helps, here's a small script for updates of the device-tree overlay via SSH to the Pi:

    #!/bin/bash
     
    ip_pi="$1"
    dtfile="$2"
    dtc="$3"

    if [ -z "$ip_pi" ] || [ -z "$dtfile" ] || [ -z "$dtc" ] ; then
            echo "No IP addr or dt or dtc specified"
            exit 1
    fi

    $dtc -@ -I dts -O dtb -o $dtfile.dtbo $dtfile.dts

    scp -o StrictHostKeyChecking=no $dtfile.dtbo "root@$ip_pi:/boot/overlays"

    ssh -o StrictHostKeyChecking=no -t "root@$ip_pi" "if ! grep -q 'dtoverlay=$dtfile' /boot/config.txt ; then echo 'dtoverlay=$dtfile' >> /boot/config.txt ; fi ; reboot"

    You run it like (example):

    <dtbo_update.sh> 192.168.1.10 adf5335 /home/user/dtc/dtc

    Arguments are:

    * IP address of the Pi ; you need to be able to SSH via the root user

    * device-tree overlay file [local file on your computer] ; has to be named  adf5335.dts [in the above example]

    * device-tree compiler [on your computer; preferably full path] ; note that this has to be a fairly recent version that supports device-tree overlays ; I think that if you use this one, it should be ok: dtc/dtc.git - The Device Tree Compiler 

  • Thanks Micheal for the detailed info.
    Yes, I did compile the .dts and copied the .dtbo to /boot/overlays, also added the entry to /boot/config.txt

    Actually I tested Raspberry pi with SPIDEV call.

    My ADF5355 hardware board works and outputs proper freq. (when configured with a microcontroller, did this just to rule out hardware faults)

    Here's the wiring between raspberry pi (SPI0) & ADF5355 :

    ADF5355 pin     ||  Raspberry pi pin

    ================================

    CLK     --------------->  GPIO 11 (BCM 11) - SPI SCLK

    DATA   --------------->  GPIO 9 (BCM 9) - SPI MISO

    LE       --------------->  GPIO 10 (BCM 10) - SPI MOSI

    CE       --------------->  GPIO 8 (BCM 8) - SPI CS0

     

    dmesg | grep -i adf5355  does not output anything...

    Here are my .dts & config.txt files: 

    adf5355-overlay.dts

    // Overlay for ADF5355

    /dts-v1/;

    /plugin/;

    / {

    compatible = "brcm,bcm2708";

    fragment@0 {

    target = <&spidev0>;

    __overlay__ {

    status = "disabled";

    };

    };

    fragment@1 {

    target-path="/";

    __overlay__ {

    adf5355_clkin: oscillator {

    compatible = "fixed-clock";

    #clock-cells = <0>;

    clock-frequency = <122880000>;

    clock-output-names = "adf5355_clkin";

    };

    };

    };

    fragment@2 {

    target-path="/";

    __overlay__ {

    adf5355_reg:

    fixedregulator@0 {

    compatible = "regulator-fixed";

    regulator-name = "adf5355-reg";

    regulator-min-microvolt = <3300000>;

    regulator-max-microvolt = <3300000>;

    };

    };

    };

    fragment@3 {

    target = <&spi0>;

    __overlay__ {

    #address-cells = <1>;

    #size-cells = <0>;

    status = "okay";

    adf5355@0 {

    status = "okay";

    compatible = "adi,adf5355";

    reg = <0>;

    spi-max-frequency = <1000000>;

    clocks = <&adf5355_clkin>;

    clock-names = "clkin";

    clock-output-names = "adf5355_out";

    vcc-supply = <&adf5355_reg>;

    regulator-name = "adf5355-reg";

    adi,charge-pump-current = <900>;

    adi,muxout-select = <6>;

    adi,mute-till-lock-enable;

    adi,output-a-power = <2>;

    adi,output-b-power = <2>;

    adi,output-b-enable;

    adi,output-a-enable;

    adi,charge-pump-negative-bleed-enable;

    adi,reference-differential-input-enable;

    adi,muxout-level-3v3-enable;

    adi,power-up-frequency = /bits/ 64 <123000000>;

    };

    };

    };

    };

    ================================================

    /boot/config.txt :

    # For more options and information see
    # http://rpf.io/configtxtreadme
    # Some settings may impact device functionality. See link above for details

    # uncomment if you get no picture on HDMI for a default "safe" mode
    #hdmi_safe=1

    # uncomment this if your display has a black border of unused pixels visible
    # and your display can output without overscan
    #disable_overscan=1

    # uncomment the following to adjust overscan. Use positive numbers if console
    # goes off screen, and negative if there is too much border
    #overscan_left=16
    #overscan_right=16
    #overscan_top=16
    #overscan_bottom=16

    # uncomment to force a console size. By default it will be display's size minus
    # overscan.
    #framebuffer_width=1280
    #framebuffer_height=720

    # uncomment if hdmi display is not detected and composite is being output
    #hdmi_force_hotplug=1

    # uncomment to force a specific HDMI mode (this will force VGA)
    #hdmi_group=1
    #hdmi_mode=1

    # uncomment to force a HDMI mode rather than DVI. This can make audio work in
    # DMT (computer monitor) modes
    #hdmi_drive=2

    # uncomment to increase signal to HDMI, if you have interference, blanking, or
    # no display
    #config_hdmi_boost=4

    # uncomment for composite PAL
    #sdtv_mode=2

    #uncomment to overclock the arm. 700 MHz is the default.
    #arm_freq=800

    # Uncomment some or all of these to enable the optional hardware interfaces
    #dtparam=i2c_arm=on
    #dtparam=i2s=on
    dtparam=spi=on

    # Uncomment this to enable the lirc-rpi module
    #dtoverlay=lirc-rpi

    dtoverlay=adf5355

    # Additional overlays and parameters are documented /boot/overlays/README

    # Enable audio (loads snd_bcm2835)
    dtparam=audio=on

    # NOOBS Auto-generated Settings:
    hdmi_force_hotplug=1

    kernel=kernel7.img

    Cheers,

     

     

  • There's a small inconsistency between the filenames; so to make sure:

    • In your /boot/config.txt you added dtoverlay=adf5355
    • But your file seems to be named adf5355-overlay.dts
    • Question: did you copy adf5355.dtbo or adf5355-overlay.dtbo in /boot/overlays ? ; because you may need to add dtoverlay=adf5355-overlay to make it work [if you copied adf5355-overlay.dts in /boot/overlays ]