AnsweredAssumed Answered

How to declare and use the SPI ADIS16209 sensor with the IIO driver?

Question asked by rafa on Jun 5, 2014
Latest reply on Jun 27, 2014 by larsc

We are using the ADIS16209/PCBZ in a Beaglebone Black system running Ubuntu 13.04, using the SPI interface.


We have done a preliminary test using the Adafruit Python libraries and the sensor was working. But for our application we need to use the IIO Linux driver available in the following page:

http://wiki.analog.com/resources/tools-software/linux-drivers/iio-accelerometer/adis16209?rev=1353005312


Every documentation that we have read so far refers that "Each and every IIO device, ... has a device folder under /sys/bus/iio/devices/iio:deviceX."


Our problem is that we don't have such device folder in our system. We suppose that some additional instruction is required to say that a IIO device is connected to SPI0, but couldn't figure out what. I guess our problem is with declaring the SPI slave devices. I realize that we should run __init board_init() according to the instructions on the above mentioned IIO driver web page, but I don't know where and how I should run that code.


If it is available please recommend some web page where I can find code snippets for reading from the sensor with IIO.


I give some more details below that may be of interest for understanding our issue.


 

ADDITIONAL INFO:


1) connection of the iSensor ADIS16209 (port SPI0 of Beaglebone Black, /dev/spidev1.0)

 

ADIS conector J1
BBB P9
2 (SCLK)
22 (spi0_clk)
3 (/CS)
17 (spi0_cs0)
4 (DOUT)
21 (spi0_d0)
6 (DIN)
18 (spi0_d1)
10, 11 or 12 (VDD)
3 ou 4 (DC_3.3V)
7 or 8 (GND)
1 ou 2 (GND)

 


2) to manually load the device tree overlay

# cat /lib/firmware/BB-SPIDEV0-00A0.dtbo > /sys/devices/bone_capemgr.9/slots

result: the devices /dev/spidev1.0 and /dev/spidev1.1 are automatically created.


To install in the boot, the following line was added to "/boot/uboot/uEnv.txt":

optargs=capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN capemgr.enable_partno=BB-SPIDEV0


The first part deactivates HDMI, and the second loads the device tree overlay.


3) The content of /etc/modules is as follows:


# /etc/modules: kernel modules to load at boot time.
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.
# Parameters can be specified after the module name.
iio_hwmon
ring_sw
adis_lib
adis16209


Outcomes