Post Go back to editing

pyadi-iio example w/ADIS16485 timing out

Category: Software
Product Number: ADIS16485
Software Version: 0.0.14

Attempting to use the pyadi-iio lib to read out data from the ADIS16485:

  • The IMU is bolted to an RPIZ board, which is installed on a RPi 4B
  • Using Kuiper Linux, latest version
  • Using pyadi-iio v0.0.14

Created my own DT overlay to get the device to show up on /sys/bus/iio:

Running the simple script:

Results in a TimeOut exception thrown on the adi.rx() call.

Based on this ticket, changing up rx_buffer_size and/or sample_rate didn't change the behavior.

Can you advise?

Thanks - Andrew

  • Thanks for your reply.

    The interrupts are only present (enabled) when you start a buffered read (eg: in osc capture window).

    OK, good to know.

    To which pin is the GPIO25 connected? From what I'm seeing, it should be DIO1 right?

    The IMU is mounted on an unmodified EVAL-ADISIMU1-RPIZ board.

    From the RPIZ schematic (02_059367b_top.pdf), DIO2 should be on GPIO25.  From previous experience with this IMU (bare metal, not Linux), DIO2 is the default DR line for the ADIS16485.

    Signal chain should be: P2-9 (IMU DIO2) -> P4-22 (RPi GPIO25).

  • Hi,

    From the RPIZ schematic (02_059367b_top.pdf), DIO2 should be on GPIO25.  From previous experience with this IMU (bare metal, not Linux), DIO2 is the default DR line for the ADIS16485.

    Signal chain should be: P2-9 (IMU DIO2) -> P4-22 (RPi GPIO25).

    Then this might be your problem... As you're not specifying 'interrupt-names', DIO1 is the ping being configured as data ready (see here) and it seems we have nothing connect to it.

    Hence you need to add this to your overlay: interrupt-names = "DIO2" so that DIO2 is used as data ready,

    - Nuno Sá

  • OK, that did it!

    Interesting - my initial Python script can retrieve data OK now, but the o-scope app still doesn't display data (nor the DMM, which used to show data).

    The last DTS is entered below.  Note that it does not have overrides enabled in its current state.

    /*
    * adis16485-overlay.dts
    *
    * ADIS16485 IMU (inertial measurement unit) connected to spi0 on Raspberry Pi
    *
    */
    /dts-v1/;
    /plugin/;
    
    // #include <dt-bindings/interrupt-controller/irq.h>
    // #include <dt-bindings/gpio/gpio.h>
    
    // From irq.h
    // #define IRQ_TYPE_NONE		0
    // #define IRQ_TYPE_EDGE_RISING	1
    // #define IRQ_TYPE_EDGE_FALLING	2
    // #define IRQ_TYPE_EDGE_BOTH	(IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING)
    // #define IRQ_TYPE_LEVEL_HIGH	4
    // #define IRQ_TYPE_LEVEL_LOW	8
    
    // From gpio.h
    // /* Bit 0 express polarity */
    // #define GPIO_ACTIVE_HIGH 0
    // #define GPIO_ACTIVE_LOW 1
    
    // /* Bit 1 express single-endedness */
    // #define GPIO_PUSH_PULL 0
    // #define GPIO_SINGLE_ENDED 2
    
    // /* Bit 2 express Open drain or open source */
    // #define GPIO_LINE_OPEN_SOURCE 0
    // #define GPIO_LINE_OPEN_DRAIN 4
    
    // /*
    //  * Open Drain/Collector is the combination of single-ended open drain interface.
    //  * Open Source/Emitter is the combination of single-ended open source interface.
    //  */
    // #define GPIO_OPEN_DRAIN (GPIO_SINGLE_ENDED | GPIO_LINE_OPEN_DRAIN)
    // #define GPIO_OPEN_SOURCE (GPIO_SINGLE_ENDED | GPIO_LINE_OPEN_SOURCE)
    
    // /* Bit 3 express GPIO suspend/resume and reset persistence */
    // #define GPIO_PERSISTENT 0
    // #define GPIO_TRANSITORY 8
    
    // /* Bit 4 express pull up */
    // #define GPIO_PULL_UP 16
    
    // /* Bit 5 express pull down */
    // #define GPIO_PULL_DOWN 32
    
    / {
        compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709", "brcm,bcm2711";
        
        fragment@0 {
            target = <&spi0>;
            
            __overlay__ {
                status = "okay";
            };
        };
    
        fragment@1 {
            target = <&spidev0>;
            
            __overlay__ {
                status = "disabled";
            };
        };
        
        fragment@2 {
            target = <&spidev1>;
            
            __overlay__ {
                status = "disabled";
            };
        };
        
        /* The non-SPI pins for this device/mcu combo. */
        fragment@3 {
            target = <&gpio>;
            
            __overlay__ {
            
                adis16485_pins: adis16485_pins {
                    /* For the following params: DR, RST. */
                    brcm,pins = <24 12>;
                    brcm,function = <0 1>; /* input, output */
                    // bcrm,pull = <0 0>; /* disable pull-over */
                };
            };
        };
    
        fragment@4 {
            target = <&spi0>;
    
            __overlay__ {
                /* needed to avoid dtc warning */
                #address-cells = <1>;
                #size-cells = <0>;
                
                adis16485: adis16485@0 {
                    compatible = "adi,adis16485";
                    reg = <0>; /* spi0 */
                    pinctrl-names = "default"; /* ctrl pins, as defined above */
                    pinctrl-0 = <&adis16485_pins>;
                    spi-cpha;  /* Mode3 */
                    spi-cpol;  /* ... */
                    reset-gpios = <&gpio 12 1>; /* GPIO_ACTIVE_LOW */
                    spi-max-frequency = <15000000>; /* 15 MHz */
                    interrupts = <25 1>; /* IRQ_TYPE_EDGE_RISING */
                    interrupt-parent = <&gpio>;
                    interrupt-names = "DIO2";
                };
            };
        };
    
    	// __overrides__ {
    	// 	device = <&adis16485>,"compatible";
    	// 	drdy_dio1 = <&adis16485_pins>,"brcm,pins:0=23",
    	// 			<&adis16485>,"interrupts:0=23",
    	// 			<&adis16485>,"interrupt-names=DIO1";
    	// };
    };
    

  • but the o-scope app still doesn't display data (nor the DMM, which used to show data).

    For the capture window, try to lower the sample rate... The DMM is more interesting and I honestly don't know why it's not working for you. It's just about reading the attributes directly which means there's no buffering involved nor interrupts. So, changing the pin for data ready should have no effect...

    - Nuno Sá