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:

/* * adis16485-overlay.dts * * ADIS16485 IMU (inertial measurement unit) connected to spi0 on Raspberry Pi * */ // See: // https://devicetree-specification.readthedocs.io/en/latest/ // https://mjmwired.net/kernel/Documentation/devicetree/bindings/pinctrl/brcm,bcm2835-gpio.txt // https://mjmwired.net/kernel/Documentation/devicetree/bindings/gpio // https://www.kernel.org/doc/html/latest/devicetree/overlay-notes.html // https://www.digi.com/resources/examples-guides/use-device-tree-overlays-to-patch-your-device-tree // https://developer-archives.toradex.com/knowledge-base/device-tree-overlays-linux // /dts-v1/; /plugin/; // #include // #include // 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 = ; __overlay__ { status = "okay"; }; }; fragment@1 { target = ; __overlay__ { status = "disabled"; }; }; fragment@2 { target = ; __overlay__ { status = "disabled"; }; }; /* The non-SPI pins for this device/mcu combo. */ fragment@3 { target = ; __overlay__ { adis16485_pins: adis16485_pins { /* For the following params: DR, RST. */ brcm,pins = ; brcm,function = ; /* input, output */ // bcrm,pull = ; /* disable pull-over */ }; }; }; fragment@4 { target = ; __overlay__ { /* needed to avoid dtc warning */ #address-cells = ; #size-cells = ; adis16485: adis16485@0 { compatible = "adi,adis16485"; reg = ; /* CS0 */ pinctrl-names = "default"; /* ctrl pins, as defined above */ pinctrl-0 = ; spi-cpha; /* Mode3 */ spi-cpol; /* ... */ reset-gpios = ; /* GPIO_ACTIVE_LOW */ spi-max-frequency = ; /* 15 MHz */ interrupts = ; /* IRQ_TYPE_EDGE_FALLING */ interrupt-parent = ; }; }; }; __overrides__ { device = ,"compatible"; drdy_dio1 = ,"brcm,pins:0=23", ,"interrupts:0=23", ,"interrupt-names=DIO1"; }; };

Running the simple script:

#!/usr/bin/python3 import adi imu = adi.adis16495( uri="local:", name="adis16485" ) imu.rx_output_type = "SI" imu.rx_enabled_channels = [0, 1, 2, 3, 4, 5] imu.sample_rate = 2000 imu.rx_buffer_size = 16 print( imu.sample_rate ) for _ in range( 2 ): data = imu.rx() for i, d in enumerate(data): print( d, imu._rx_channel_names[i] )

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

analog@analog:~/Logger $ sudo ./simple_test.py 2460 WARNING: High-speed mode not enabled Traceback (most recent call last): File "/home/analog/Logger/./simple_test.py", line 15, in data = imu.rx() File "/usr/local/lib/python3.9/dist-packages/adi/rx_tx.py", line 324, in rx data = self.__rx_non_complex() File "/usr/local/lib/python3.9/dist-packages/adi/rx_tx.py", line 297, in __rx_non_complex x = self.__rx_buffered_data() File "/usr/local/lib/python3.9/dist-packages/adi/rx_tx.py", line 264, in __rx_buffered_data self.__rxbuf.refill() File "/usr/local/lib/python3.9/dist-packages/iio.py", line 1037, in refill _buffer_refill(self._buffer) File "/usr/local/lib/python3.9/dist-packages/iio.py", line 62, in _check_negative raise OSError(-result, _strerror(-result)) TimeoutError: [Errno 110] Connection timed out

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

Can you advise?

Thanks - Andrew

Top Replies

    •  Analog Employees 
    Jan 16, 2023 in reply to A1B +1 verified

    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…