Hi,
on a IMX6Q, MEAS MS5611 pressure sesor connected via I2C.
Kernel configs:
```
CONFIG_IIO_SW_TRIGGER=y
CONFIG_IIO_TRIGGERED_EVENT=y
CONFIG_IIO_HRTIMER_TRIGGER=y
CONFIG_IIO_INTERRUPT_TRIGGER=y
CONFIG_IIO_SYSFS_TRIGGER=y
```
I can read data via SYSFS_TRIGGER using the buffer, with something like this:
```
d /sys/bus/iio/devices
echo 0 > iio_sysfs_trigger/add_trigger
cat trigger0/name
sysfstrig0
echo 1 > iio:device1/scan_elements/in_pressure_en
echo 1 > iio:device1/scan_elements/in_temp_en
echo 1 > iio:device1/scan_elements/in_timestamp_en
echo sysfstrig0 > iio:device1/trigger/current_trigger
echo 10 > iio:device1/buffer/length
echo 1 > iio:device1/buffer/enable
hexdump -e '"iio0: " 8/2 "%04x " "\n"' /dev/iio:device1 &
cat iio:device1/buffer/data_available
0
echo > iio_sysfs_trigger/trigger0/trigger_now
cat iio:device1/buffer/data_available
1
echo > iio_sysfs_trigger/trigger0/trigger_now
cat iio:device1/buffer/data_available
2
...
iio0: 8c4d 0001 0922 0000 8c4d 0001 0922 0000
fend 0x00018c4d in dec
101453
```
How can I use a time based trigger to get e.g. 10Hz triggers?
I tried to explore is using IIO_HRTIMER_TRIGGER. How should I configure device tree (DTS)? How to enable and use it?
Note, there seems to be no HRTIMER active stuff:
```
# ls -l
total 0
lrwxrwxrwx 1 root root 0 Jan 25 10:59 iio:device0 -> ../../../devices/platform/soc/2100000.bus/21a4000.i2c/i2c-1/1-0077/iio:device0
lrwxrwxrwx 1 root root 0 Jan 25 10:59 iio:device1 -> ../../../devices/platform/soc/2100000.bus/21a4000.i2c/i2c-1/1-0068/iio:device1
lrwxrwxrwx 1 root root 0 Jan 25 10:58 iio_sysfs_trigger -> ../../../devices/iio_sysfs_trigger
# lsiio
Device 000: mpu6050
Device 001: ms5611
```
Any hints/help?
Cheers,
Andrea
Solved! Go to Solution.
Configs were ok. The hiccup was about "how to create a HRTIMER trigger". It happens what there is not `add_trigger` file, as in SYSFS_TRIGGER. Instead, you need to create a directory:
```
mkdir /sys/kernel/config/iio/triggers/hrtimer/mytrigger
echo mytrigger > iio:device0/trigger/current_trigger
#the /sys/bus/iio/devices/trigger0 directory is created
```
I could not find specific documentation, I had to look into kernel sources.
Rest works ok and I can sample date at different frequencies tuning the sample rate with:
```
echo 0 > iio:device1/buffer/enable
echo 10 > /sys/bus/iio/devices/trigger0/sampling_frequency
echo 1 > iio:device1/buffer/enable
```
Configs were ok. The hiccup was about "how to create a HRTIMER trigger". It happens what there is not `add_trigger` file, as in SYSFS_TRIGGER. Instead, you need to create a directory:
```
mkdir /sys/kernel/config/iio/triggers/hrtimer/mytrigger
echo mytrigger > iio:device0/trigger/current_trigger
#the /sys/bus/iio/devices/trigger0 directory is created
```
I could not find specific documentation, I had to look into kernel sources.
Rest works ok and I can sample date at different frequencies tuning the sample rate with:
```
echo 0 > iio:device1/buffer/enable
echo 10 > /sys/bus/iio/devices/trigger0/sampling_frequency
echo 1 > iio:device1/buffer/enable
```
Hi @andreaaizza
Can you use menuconfig to enable configs?