sensord: use interrupts to improve LSM6DS3 timing accuracy (#24525)

* change LSM6DS3TR(-c) gyroscope  and accelerometer to interrupt

* add pthread for linking

* add interrupt collector thread to fetch in parallel to non interrupt based sensors

* change get_event interface to return true on successful read

* fetch sensor interrupts via gpiochip

* avoid sending empty messages (interrupt only, non interupt magn can leave a gap in the orphan block)

* add verifier script to sensor interrupts (sensor_data_to_hist.py)

* add/update sensord testsweet (test_sensord.py)

* add poll timed out check

* unexport interrupt gpio pins

* gpiochip on both edges, but skip falling edge if rising edge is detected, this is handled in the sensor as the status flag is checked if new data is availble

* add test to sensord to verify 100Hz interrupt frequency

* add sensor shutdown/low power mode functionality on sensord exit

* relax test, will be readded in the splitup PR

Co-authored-by: Kurt Nistelberger <kurt.nistelberger@gmail.com>
This commit is contained in:
Willem Melching
2022-09-13 07:29:31 +02:00
committed by GitHub
parent 56b05d55eb
commit 84a3c355e5
31 changed files with 711 additions and 58 deletions
+11
View File
@@ -462,6 +462,17 @@ class Tici(HardwareBase):
sudo_write("N", "/sys/kernel/debug/msm_vidc/clock_scaling")
sudo_write("Y", "/sys/kernel/debug/msm_vidc/disable_thermal_mitigation")
# *** unexport GPIO for sensors ***
# remove from /userspace/usr/comma/gpio.sh
sudo_write(str(GPIO.BMX055_ACCEL_INT), "/sys/class/gpio/unexport")
sudo_write(str(GPIO.BMX055_GYRO_INT), "/sys/class/gpio/unexport")
sudo_write(str(GPIO.BMX055_MAGN_INT), "/sys/class/gpio/unexport")
sudo_write(str(GPIO.LSM_INT), "/sys/class/gpio/unexport")
# *** set /dev/gpiochip0 rights to make accessible by sensord
os.system("sudo chmod +r /dev/gpiochip0")
def configure_modem(self):
sim_id = self.get_sim_info().get('sim_id', '')
+6
View File
@@ -19,3 +19,9 @@ class GPIO:
CAM0_RSTN = 9
CAM1_RSTN = 7
CAM2_RSTN = 12
# Sensor interrupts
BMX055_ACCEL_INT = 21
BMX055_GYRO_INT = 23
BMX055_MAGN_INT = 87
LSM_INT = 84