AnsweredAssumed Answered

ADIS16448 iio driver on Nvidia Jetson TK1

Question asked by curtis on Jun 18, 2015
Latest reply on Dec 14, 2015 by rswami

Hello,

 

I am attempting to set up an ADIS16448 imu on a Nvidia Jetson TK1 over SPI. I have been following the guide here to configure the Jetson TK1 for spidev.

 

After following this guide, I have verified that I can communicate out over the SPI interface on the TK1 using the configured spidev interface by tweaking the ioctl commands as shown in the code sample from the tutorial.

 

I have compiled the kernel modules and made sure that they are loaded:

    username@host:~$ lsmod

    Module                  Size  Used by

    dm_crypt               12216  0

    bnep                   11872  2

    rfcomm                 46483  0

    rtc_as3722              3212  0

    bluetooth             279594  10 bnep,rfcomm

    rfkill                 14634  3 bluetooth

    parport_pc             28658  0

    parport                27466  1 parport_pc

    adis16400              10748  0

    adis_lib                5597  1 adis16400

    nvhost_vi               2908  0

 

 

The tutorial linked above has the following snippet from the device tree:

 

spi@7000d400 {
        compatible = "nvidia,tegra114-spi";
        reg = <0x7000d400 0x200>;
        interrupts = <0x0 0x3b 0x4>;
        nvidia,dma-request-selector = <0x7 0xf>;
        nvidia,memory-clients = <0xe>;
        #address-cells = <0x1>;
        #size-cells = <0x0>;
        status = "okay";
        spi-max-frequency = <0x17d7840>;

        spi0_0 {
            #address-cells = <0x1>;
            #size-cells = <0x0>;
            compatible = "spidev";
            reg = <0x0>;
            spi-max-frequency = <0x17d7840>;
            spi-cpha;
            nvidia,enable-hw-based-cs;
            nvidia,cs-setup-clk-count = <0x1e>;
            nvidia,cs-hold-clk-count = <0x1e>;
            nvidia,rx-clk-tap-delay = <0x1f>;
            nvidia,tx-clk-tap-delay = <0x0>;
        };
    };

where spi0_0 corresponds to the spidev device that presents itself as /dev/spidev0.0

 

My guess is that I need to join the IMU to this same spi bus, but I am unsure how. I have attempted to follow this similar issue that deals with the same concepts on the beaglebone, but the device tree is so vastly different that I am uncertain whether I am doing it right.

 

By adding the spi0_1 entry (as seen below), I was able to get your IIO driver to present itself. Note that when I have it configured like this, the spidev device seems to be unable to access the chip select line (as verified by my logic analyzer). I believe that both devices want to use reg = <0x0> for their chip select.

 

  spi@7000d400 {
                compatible = "nvidia,tegra114-spi";
                reg = <0x7000d400 0x200>;
                interrupts = <0x0 0x3b 0x4>;
                nvidia,dma-request-selector = <0x7 0xf>;
                nvidia,memory-clients = <0xe>;
                #address-cells = <0x1>;
                #size-cells = <0x0>;
                status = "okay";
                spi-max-frequency = <0x17d7840>;

                spi0_0 {
                        #address-cells = <0x1>;
                        #size-cells = <0x0>;
                        compatible = "spidev";
                        reg = <0x1>;
                        spi-max-frequency = <0x17d7840>;
                        spi-cpha;
                        nvidia,enable-hw-based-cs;
                        nvidia,cs-setup-clk-count = <0x1e>;
                        nvidia,cs-hold-clk-count = <0x1e>;
                        nvidia,rx-clk-tap-delay = <0x1f>;
                        nvidia,tx-clk-tap-delay = <0x0>;

                };

                spi0_1{
                    #address-cells = <0x1>;
                    #size-cells = <0x0>;
                    compatible = "adi,adis16400";
                    reg = <0x0>;
                    spi-cpha;
                    spi-cpol;
                    spi-max-frequency = <0x17d7840>;
                    nvidia,enable-hw-based-cs;
                    nvidia,cs-setup-clk-count = <0x10>;
                    nvidia,cs-hold-clk-count = <0x10>;
                    nvidia,rx-clk-tap-delay = <0x28>;
                    nvidia,tx-clk-tap-delay = <0x0>;
                };

        };

 

 

My issue is that when I add the spi0_1 piece, the device shows up under the IIO but when I attempt to read values, they all return "0". I am new to the concept of device trees, so I believe that I am close, but I just need to tweak these entries somehow.

 

Any info on how to get data out of the device from this stage would be helpful =)

 

Thank you,

Curtis

Outcomes