Wiki

This version is outdated by a newer approved version.DiffThis version (06 May 2011 23:15) is a draft.
Approvals: 0/1

This is an old revision of the document!


Adding ADIS16240 to the Kernel

To add support for the ADIS16240 to the kernel build system, a few things must be enabled properly for things to work.The configuration is as following:

Linux Kernel Configuration
  Device Drivers  ---> 
    Sound  ---> 
      [*] Staging drivers  ---> 
        <*>     Industrial I/O support  --->
          [*]   Enable ring buffer support within IIO
          {*}     Industrial I/O lock free software ring
          -*-   Enable triggered sampling support 
          <M>   Analog Devices ADIS16240 Programmable Impact Sensor and Recorder                   

Adding iioring Application

iioring is an application which can be used to read ring buffer from IIO deives. To add support for the iioring to the Linux build system, a few things must be enabled properly for things to work.The configuration is as following:

Blackfin test programs  --->
	[*] Analog Devices IIO device ring test 

Testing ADIS16240

root:/> modprobe adis16240
adis16240: module is from the staging directory, the quality is unknown, you have been warned.
adis16240: at CS5 (irq 54)

We can read individual sampling values from sysfs nodes like:

root:/> cd /sys/bus/iio/devices/device0/
root:/sys/devices/platform/bfin-spi.0/spi0.5/device0>ls
accel_x_offset                in0_raw
accel_x_peak_raw              in_supply_raw
accel_x_raw                   in_supply_scale
accel_xyz_squared_peak_raw    name
accel_y_offset                power
accel_y_peak_raw              reset
accel_y_raw                   scan_elements
accel_z_offset                subsystem
accel_z_peak_raw              temp_raw
accel_z_raw                   temp_scale
available_sampling_frequency  trigger
device0:buffer0               uevent
device0:event0

root:/sys/devices/platform/bfin-spi.0/spi0.5/device0> cat accel_x_raw
-26
root:/sys/devices/platform/bfin-spi.0/spi0.5/device0> cat accel_y_raw
18
root:/sys/devices/platform/bfin-spi.0/spi0.5/device0> cat accel_z_raw
54

We can also read values by ring:

root:/> ./iioring -n adis16240 -c 6 -l 1
iio device number being used is 0
iio trigger number being used is 0
c2a6 ffe5 c012 c034 ff06 c134  223474973672
42a6 ffe6 c012 c033 ff0a 4134  223475948544
42a6 ffe5 c012 c036 ff0b 4134  223476918262
c29f ffe4 c013 c036 ff0c c132  223477894720
429f ffe5 c012 c036 ff0b 4132  223478873037
429f ffe4 c013 c036 ff0c 4132  223479848295
429f ffe5 c013 c036 ff0c 4132  223480824783
c29f ffe6 c011 c036 ff0c c133  223481801231
429f ffe5 c013 c036 ff0d 4133  223482779102
429f ffe5 c012 c035 ff0c 4133  223483754224
429f ffe5 c012 c036 ff0d 4133  223484730442
c29d ffe5 c012 c036 ff0d c133  223485707336
429d ffe5 c012 c036 ff0d 4133  223486683912
429d ffe4 c013 c035 ff0d 4133  223487661479
429d ffe5 c012 c036 ff0d 4133  223488636705
c29f ffe6 c012 c035 ff0d c132  223489613257
429f ffe6 c012 c034 ff0d 4132  223490589761
429f ffe4 c013 c034 ff0d 4132  223491567496
429f ffe6 c011 c034 ff0c 4132  223492542674
c29f ffe6 c012 c035 ff0c c132  223493519154
429f ffe6 c011 c036 ff0c 4132  223494495594
429f ffe5 c012 c035 ff0c 4132  223495473713
429f ffe5 c011 c035 ff0c 4132  223496448667
c29d ffe5 c011 c036 ff0c c133  223497425123
429d ffe5 c012 c035 ff0c 4133  223498401811
429d ffe4 c013 c036 ff0c 4133  223499379714
429d ffe5 c012 c037 ff0c 4133  223500354652
c29f ffe5 c012 c036 ff0c c133  223501331292
429f ffe5 c012 c036 ff0c 4133  223502307732
429f ffe6 c012 c035 ff0c 4133  223503285571
429f ffe4 c013 c035 ff0d 4133  223504260813
c29b ffe5 c012 c036 ff0d c130  223505237181
429b ffe6 c012 c035 ff0d 4130  223506213765
429b ffe4 c013 c035 ff0d 4130  223507191396
429b ffe5 c013 c035 ff0c 4130  223508166646
c29d ffe6 c012 c035 ff0d c133  223509143294
429d ffe6 c012 c034 ff0d 4133  223510119686
429d ffe5 c012 c035 ff0d 4133  223511097549
429d ffe5 c013 c034 ff0d 4133  223512072687
c29f ffe6 c011 c035 ff0c c133  223513049367
429f ffe5 c012 c036 ff0c 4133  223514025775
429f ffe5 c012 c035 ff0c 4133  223515003422
429f ffe5 c012 c034 ff0c 4133  223515978976
c29d ffe4 c012 c037 ff0c c131  223516955360
429d ffe3 c013 c036 ff0c 4131  223517931808
429d ffe4 c014 c037 ff0c 4131  223518909719
429d ffe4 c013 c036 ff0c 4131  223519884929
c2a1 ffe6 c012 c036 ff0c c133  223520861249
42a1 ffe5 c012 c036 ff0d 4133  223521838041
42a1 ffe5 c013 c035 ff0c 4133  223522815616
42a1 ffe5 c012 c035 ff0d 4133  223523790970
c29f ffe6 c012 c036 ff0d c133  223524767354
429f ffe6 c012 c036 ff0d 4133  223525743786
429f ffe6 c012 c036 ff0d 4133  223526731713
429f ffe5 c013 c036 ff0d 4133  223527697043
c29f ffe5 c012 c033 ff0d c133  223528673323
429f ffe6 c012 c033 ff0d 4133  223529650043
429f ffe6 c012 c034 ff0d 4133  223530626347
429f ffe4 c013 c034 ff0d 4133  223531604474
c29f ffe6 c012 c036 ff0c c133  223532579412
429f ffe6 c011 c036 ff0c 4133  223533555804
429f ffe5 c012 c036 ff0c 4133  223534532420
429f ffe5 c012 c035 ff0c 4133  223535510331
c29f ffe5 c011 c035 ff0c c133  223536485445
root:/>

The ring is triggered by interrupts, after using ring, you will find interrupt number of adis16260 is increased:

root:/> cat /proc/interrupts
  6:      68795      CORE  Blackfin CoreTimer
 10:          1      INTN  rtc-bfin
 18:          8      INTN  BFIN_UART_RX
 19:        640      INTN  BFIN_UART_TX
 24:         96      INTN  EMAC_RX
 54:        148      GPIO  adis16240
NMI:          0      CORE  Non Maskable Interrupt
Err:          0
resources/tools-software/linux-drivers/iio-accelerometer/adis16240.1304716514.txt.gz · Last modified: 06 May 2011 23:15 by andyr