introduciton to Industrial IO
- overview of industrial IO. In short, SPI and I2C sensor framework for Linux
- sensor categories: “ADC, DAC, light, accel(erometer), gyro, magnetometer, humidity, temperature, amplifier, frequency, orientation, health”, etc
- merged to mainline kernel 3.14, used by beagleBone, sysfs and char device based, see the IIO architecture
- DAQmx base for linux: commercial lib from national instrument
- comedi: PCI/PCIe, USB devices for data acquisition
- hwmon: very low speed,traditionally for CPU temperature monitoring
- HID: like mouse, keyboard, generally low speed input device
- bluetooth smart:
user space IIO API
#include <iio.h>four basic classes: iio_contex, iio_device, iio_channel and iio_buffer
iio_triggeris kind of
iio_devicewithout channel but with name inc “trigger”
iio_contexthas internal operation functions structure, kernel driver
- windows user can use libiio to access network iiod
- python and cshaprt wrapping for user space API: python-iio libiio-cil-dev
- XML context: attributes calibration data, scale, etc.
(http://events.linuxfoundation.org/sites/events/files/slides/lceu15_baluta.pdf) + scan_element(), iio_channel_is_scan_element(): elements in buffer is called scan /sys/bus/iio/devices/iio:devices/scan elements
- read_raw() from register (possible 12bit) to integer in memory. NO integer to physical quantity (with unit) like comedilib?
trigger readings based on an external interrupt source hardware interrupt (IRQ pins) software interrupts (periodic timers, sysfs triggers)
design of IIO
- modes: DIRECT,BUFFER SOFTWARE,BUFFER HARDWARE,BUFFER TRIGGERED
- iio_triggered_buffer iio_events only found in kernel mode iio_core, see
(linux/iio/triggered_buffer.h);trigger are software trigger, not hardware TTL signal in DAQ terminology?
documentation for IIO
- user space library
- kernel document text does not provide enough information for user
- analogdevice wiki on IIO
- blog on IIO
- mail list
- high speed IIO
supported hardware list
About 200 device drivers by the time of kernel 4.4; many drivers supports a varierty of models.
see/search kernel source tree linux/iio, there are a few subfolders corresponds to sensor categories: “ADC, DAC, light, accel(erometer), gyro, magnetometer, humidity, temperature, amplifier, frequency, orientation, health”, etc
test of IIO dummy device on ubuntu 16.04
“dummy” a virtual sensor for testing
sudo apt-get install libiio libiio-dev libiio-python libiio-utils
<span class="hljs-comment">#all trigger related function need kernel module to support</span>
sudo modprobe iio_dummy
ls /sys/bus/iio/devices/iio\<span class="hljs-symbol">:device0</span>
cat /sys/bus/iio/devices/iio\<span class="hljs-symbol">:device0/name</span>
<span class="hljs-comment">#no need to enable?</span>
cat /sys/bus/iio/devices/iio\<span class="hljs-symbol">:device0/in_accel_x_raw</span>
desired feature of IIO
- user space tool to expose sensors to webUI?
- devicetree: platform device support is supported such as beaglebone.
- standardisation calibration data in XML attribute file to simulate: IEEE 1451.4 Plug and Play Sensors (TEDS)
- possiblity of user space driver development based on user space SPI, i2c and libusb?
- physical value conversion “The functions comedi_to_physical, comedi_to_phys, comedi_from_physical and comedi_from_phys are used to convert between Comedi’s integer data and floating point numbers corresponding to physical values (voltages, etc.). ”
Author: Qingfeng XIA
copyright (C) 2011-2017
please keep the original link in your reference.