This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
resources:tools-software:linux-drivers:iio-accelerometer:adxl372 [20 Nov 2018 16:52] Stefan Popa Updated links with upstream version |
resources:tools-software:linux-drivers:iio-accelerometer:adxl372 [16 Sep 2019 16:09] Stefan Popa Updated Set the fifo watermak subchapter |
||
---|---|---|---|
Line 25: | Line 25: | ||
^ Function ^ File ^ | ^ Function ^ File ^ | ||
- | | core driver | [[git.linux.org>drivers/iio/accel/adxl372.c]] | | + | | core driver | [[linux.github>master?drivers/iio/accel/adxl372.c | drivers/iio/accel/adxl372.c]] | |
- | | spi driver | [[git.linux.org>drivers/iio/accel/adxl372_spi.c]] | | + | | spi driver | [[linux.github>master?drivers/iio/accel/adxl372_spi.c | drivers/iio/accel/adxl372_spi.c]] | |
- | | i2c driver | [[git.linux.org>drivers/iio/accel/adxl372_i2c.c]] | | + | | i2c driver | [[linux.github>master?drivers/iio/accel/adxl372_i2c.c | drivers/iio/accel/adxl372_i2c.c]] | |
- | | header | [[git.linux.org>drivers/iio/accel/adxl372.h]] | | + | | header | [[linux.github>master?drivers/iio/iio/accel/adxl372.h | drivers/iio/accel/adxl372.h]] | |
+ | | Documentation | [[linux.github>master?Documentation/devicetree/bindings/iio/accel/adxl345.txt | adxl345.txt]] | | ||
+ | | ABI documentation| [[linux.github>master?Documentation/ABI/testing/sysfs-bus-iio-accel-adxl372 | sysfs-bus-iio-accel-adxl372]] | | ||
- | ===== Devicetree ===== | + | Example device tree |
+ | |||
+ | ^ Function ^ File ^ | ||
+ | | dts | [[linux.github>rpi-4.19.y?arch/arm/boot/dts/overlays/rpi-adxl372-overlay.dts | rpi-adxl372-overlay.dts]] | | ||
+ | |||
+ | ====== Example platform device initialization ====== | ||
Required devicetree properties: | Required devicetree properties: | ||
Line 94: | Line 101: | ||
-r--r--r-- 1 root root 4096 Oct 25 04:25 name | -r--r--r-- 1 root root 4096 Oct 25 04:25 name | ||
lrwxrwxrwx 1 root root 0 Oct 25 04:25 of_node -> ../../../../../../../../firmware/devicetree/base/soc/spi@7e204000/adxl372@0 | lrwxrwxrwx 1 root root 0 Oct 25 04:25 of_node -> ../../../../../../../../firmware/devicetree/base/soc/spi@7e204000/adxl372@0 | ||
+ | -r--r--r-- 1 root root 4096 Oct 25 04:25 peak_fifo_mode_enable | ||
drwxr-xr-x 2 root root 0 Oct 25 04:25 power | drwxr-xr-x 2 root root 0 Oct 25 04:25 power | ||
-r--r--r-- 1 root root 4096 Oct 25 04:25 sampling_frequency_available | -r--r--r-- 1 root root 4096 Oct 25 04:25 sampling_frequency_available | ||
Line 175: | Line 183: | ||
</xterm></WRAP> | </xterm></WRAP> | ||
- | ===== Trigger management ===== | + | ===== Using the FIFO Buffer ===== |
+ | |||
+ | **Description:**\\ | ||
+ | The ADXL372 includes a deep, 512 sample FIFO buffer. The 512 FIFO samples can be allotted in several ways, such as the following: | ||
+ | * 170 sample sets of concurrent 3-axis data | ||
+ | * 256 sample sets of concurrent 2-axis data (user selectable) | ||
+ | * 512 sample sets of single-axis data | ||
+ | * 170 sets of impact event peak (x, y, z) | ||
+ | |||
+ | ==== Trigger management ==== | ||
+ | |||
+ | **Description:**\\ | ||
+ | The FIFO is configured in **Stream Mode** and **FIFO_FULL** interrupt is enabled. The interrupt will be triggered when the FIFO watermark is reached. | ||
<WRAP box bggreen><wrap info>This specifies any shell prompt running on the target</wrap> | <WRAP box bggreen><wrap info>This specifies any shell prompt running on the target</wrap> | ||
Line 183: | Line 203: | ||
</xterm></WRAP> | </xterm></WRAP> | ||
- | ===== Buffer management ===== | + | ==== Buffer management ==== |
**Description:**\\ | **Description:**\\ | ||
Line 207: | Line 227: | ||
Before enabling the buffer, a few steps need to be completed. | Before enabling the buffer, a few steps need to be completed. | ||
- | * First, the axis that we want to read data from need to be enabled: | + | * For example, if we want the FIFO to store sample sets of concurrent 3-axis data, we need to enable the scan elements: |
<WRAP box bggreen><wrap info>This specifies any shell prompt running on the target</wrap> | <WRAP box bggreen><wrap info>This specifies any shell prompt running on the target</wrap> | ||
<xterm> | <xterm> | ||
Line 229: | Line 249: | ||
* Set the fifo watermak: | * Set the fifo watermak: | ||
+ | Because we enabled all three channels, then the watermark can be set to a maximum of 170 sample sets. | ||
<WRAP box bggreen><wrap info>This specifies any shell prompt running on the target</wrap> | <WRAP box bggreen><wrap info>This specifies any shell prompt running on the target</wrap> | ||
<xterm> | <xterm> | ||
root:/sys/bus/iio/devices/iio:device0/buffer> **echo 170 > watermark** | root:/sys/bus/iio/devices/iio:device0/buffer> **echo 170 > watermark** | ||
</xterm></WRAP> | </xterm></WRAP> | ||
+ | |||
+ | The FIFO can also be configured to store peak acceleration (x, y, and z) for every over-threshold event. This can be done by writing 1 to the **peak_fifo_mode_enable** attribute: | ||
+ | <WRAP box bggreen><wrap info>This specifies any shell prompt running on the target</wrap> | ||
+ | <xterm> | ||
+ | root:/sys/bus/iio/devices/iio:device0> **echo 1 > peak_fifo_mode_enable** | ||
+ | </xterm></WRAP> | ||
+ | Note that this mode can work only if all three axis are enabled. | ||
* Enable the buffer: | * Enable the buffer: |