Post Go back to editing

ADIS16362 IIO Driver for Raspberry PI?

According to the instructions at we can build build Linux kernel for Raspberry PI and can add driver support for adis16400 which indeed support ADIS16362.

But the question is how a 16-bit SPI works with Raspberry Pi which only supports 8-bit SPI transactions. How the drivers handle this issue? Is it possible to keep CS low for two bytes transfer for the legacy Linux SPI driver provided with Raspberry Pi OS? 

Secondly I am looking for a Raspberry Pi OS c/c++ example which somehow uses the iio adis16400 drivers to read/write the ADIS16362 registers. So far I have tried to use this driver

by modifying it for ADIS16362 and it is not working... nothing received on MISO pin! It would be very helpful if someone guide or provide an example code to use iio adis16400 driver specifically for to reading/writing the ADIS16362 registers.

  • Hi,

    The recommended way to interact with ADIS16362 is using the Linux kernel driver and IIO framework.

    If you want direct register access you can have it through IIO debugfs direct_register_access.

    Also ADI provide a Linux distribution based on Raspbian with all the ADI drivers already built in. You can find it here.

    The examples you linked are userspace implementations of ADIS driver and use the SPI dev driver. Is there any reason you prefer user-space driver? The IIO driver is complete and already provide you some features like triggering and if required buffering of samples.  

  • Hi

    Ok, I will install the ADI Raspbian Linux distribution with adis16400 and adis16475 drivers, but still want to use the  userspace driver to update the following routines, lets say in

    _px4_accel.update(now, accel_x, accel_y, accel_z);

    _px4_gyro.update(now, gyro_x, gyro_y, gyro_z);

    So... if I include <iio.h> in the userspace driver and call iio_device_reg_read(adis16362, 0x02, &gyro_x) to read the data, would it work?

    I need a working example of C code to understand and for userspace implementation along with IIO drivers.

  • Hi,

    The role of the IIO driver is to create an abstraction layer over direct register writes. The register writes are handled by the driver internally and it provides you an interface to read the data like acceleration.

    Please take a look at this IIO example. It is for a dummy IIO device and you should adapt it for your specific IIO device created by the adis16400 driver. You can identify its number using "iio_info -a". This command is part of libiio and you can study about that too.

    Also there you'll see the channels supported by ADIS IIO device and reading those you'll actually get the data that's of interest for you.

    Please take a look at adis16400 drivers documentation page. There is described in detail how the IIO channel data can be interpreted.