STMicroelectronics / st-mems-android-linux-sensors-hal

stm mems sensors-hal for Android and Linux platforms.
Apache License 2.0
24 stars 7 forks source link

Support for lsm6dsv32x ? #5

Closed soares-sergio closed 3 months ago

soares-sergio commented 5 months ago

Hi folks, I'm trying to use the hal and just realized it doesn't seem to support the lsm6dsv32x sensor, only the 16x. What would involve adding support for the 32x?

I've tried adding it to SensorsSupported.cpp and SensorsSupported.h like this:

/* LSM6DSV32X */
   SensorsSupported::Accel("lsm6dsv32x_accel", "LSM6DSV32X Accelerometer Sensor", 0.0f),
   SensorsSupported::Gyro("lsm6dsv32x_gyro", "LSM6DSV32X Gyroscope Sensor", 0.0f),
   SensorsSupported::InternalTemperature("lsm6dsv32x_temp", "LSM6DSV32X Temperature Sensor", 0.0f),

It seems like the HAL can find the sensors but when trying to sample it's stuck. These are the multihal logs:

06-05 18:01:51.283  2914  2914 I sensors-multihal@2.1-stm: gyroscope rotation matrix: 1.000000,0.000000,0.000000;0.000000,1.000000,0.000000;0.000000,0.000000,1.000000
06-05 18:01:51.284  2914  2914 I sensors-multihal@2.1-stm: magnetometer rotation matrix: 1.000000,0.000000,0.000000;0.000000,1.000000,0.000000;0.000000,0.000000,1.000000
06-05 18:01:51.285  2914  2914 I sensors-multihal@2.1-stm: accelerometer rotation matrix: 1.000000,0.000000,0.000000;0.000000,1.000000,0.000000;0.000000,0.000000,1.000000
06-05 18:01:51.285  2914  2914 I sensors-multihal@2.1-stm: gyroscope placement: 0.000000, 0.000000, 0.000000
06-05 18:01:51.285  2914  2914 I sensors-multihal@2.1-stm: magnetometer placement: 0.000000, 0.000000, 0.000000
06-05 18:01:51.286  2914  2914 I sensors-multihal@2.1-stm: pressure placement: 0.000000, 0.000000, 0.000000
06-05 18:01:51.286  2914  2914 I sensors-multihal@2.1-stm: accelerometer placement: 0.000000, 0.000000, 0.000000
06-05 18:01:51.296  2914  2914 D sensors-multihal@2.1-stm: found 8 IIO devices available under /sys/bus/iio/devices
06-05 18:01:51.306  2914  2914 E sensors-multihal@2.1-stm: lsm6dsv32x_temp: unable to set full scale.
...
06-05 18:01:51.354  2914  2914 D sensors-multihal@2.1-stm: LSM6DSV32X Accelerometer Sensor: injection mode not available
06-05 18:01:51.355  2914  2914 I sensors-multihal@2.1-stm: accel calibration library: stm-accel-lib-mock
06-05 18:01:51.356  2914  2914 D sensors-multihal@2.1-stm: LSM6DSV32X Gyroscope Sensor: injection mode not available
06-05 18:01:51.356  2914  2914 I sensors-multihal@2.1-stm: gyro calibration library: stm-gyro-lib-mock
06-05 18:01:51.357  2914  2914 I sensors-multihal@2.1-stm: sensors fusion (6X) library: stm-sensors-fusion-6X-lib-mock
06-05 18:01:51.357  2914  2914 I sensors-multihal@2.1-stm: sensors fusion (9X) library: stm-sensors-fusion-9X-lib-mock
06-05 18:01:51.364  2914  2914 E sensors-multihal@2.1-stm: selftest functions cannot be loaded correctly
06-05 18:01:51.364  2914  2914 D sensors-multihal@2.1-stm: 7 sensors available and ready
06-05 18:01:51.366  2914  2914 I sensors-multihal@2.1-stm: timesync library: stm-timesync-lib-mock
06-05 18:01:51.367  2914  2914 W sensors-multihal@2.1-stm: failed to load gyro bias
06-05 18:01:51.367  2914  2914 W sensors-multihal@2.1-stm: failed to load accel bias

...
06-05 18:20:03.110  2914  2914 D sensors-multihal@2.1-stm: LSM6DSV32X Accelerometer Sensor: changed pollrate to 60.002400Hz, timeout=0ms
06-05 18:20:03.115  2914  2914 D sensors-multihal@2.1-stm: LSM6DSV32X Gyroscope Sensor: changed pollrate to 60.002400Hz, timeout=0ms
06-05 18:20:03.116  2914  2914 D sensors-multihal@2.1-stm: LSM6DSV32X Accelerometer Sensor: power-on
06-05 18:20:03.136  2914  2914 D sensors-multihal@2.1-stm: LSM6DSV32X Gyroscope Sensor: power-on
06-05 18:20:09.521  2914  2914 D sensors-multihal@2.1-stm: LSM6DSV32X Accelerometer Sensor: power-off
06-05 18:20:09.531  2914  2914 W sensors-multihal@2.1-stm: failed to save accel bias
06-05 18:20:09.531  2914  2914 D sensors-multihal@2.1-stm: LSM6DSV32X Gyroscope Sensor: power-off
06-05 18:20:09.546  2914  2914 W sensors-multihal@2.1-stm: failed to save gyro bias
06-05 18:20:23.983  2914  2914 D sensors-multihal@2.1-stm: LSM6DSV32X Accelerometer Sensor: changed pollrate to 60.002400Hz, timeout=0ms
06-05 18:20:23.988  2914  2914 D sensors-multihal@2.1-stm: LSM6DSV32X Gyroscope Sensor: changed pollrate to 60.002400Hz, timeout=0ms
06-05 18:20:23.988  2914  2914 D sensors-multihal@2.1-stm: LSM6DSV32X Gyroscope Sensor: changed pollrate to 60.002400Hz, timeout=0ms
06-05 18:20:23.988  2914  2914 D sensors-multihal@2.1-stm: LSM6DSV32X Accelerometer Sensor: power-on
06-05 18:20:24.004  2914  2914 D sensors-multihal@2.1-stm: LSM6DSV32X Gyroscope Sensor: power-on
06-05 18:20:24.014  2914  2914 D sensors-multihal@2.1-stm: LSM6DSV32X Gyroscope Sensor: power-on
06-05 18:20:26.102  2914  2914 D sensors-multihal@2.1-stm: LSM6DSV32X Accelerometer Sensor: power-off
06-05 18:20:26.122  2914  2914 W sensors-multihal@2.1-stm: failed to save accel bias
06-05 18:20:26.122  2914  2914 D sensors-multihal@2.1-stm: LSM6DSV32X Gyroscope Sensor: power-off
06-05 18:20:26.143  2914  2914 W sensors-multihal@2.1-stm: failed to save gyro bias
06-05 18:20:26.144  2914  2914 D sensors-multihal@2.1-stm: LSM6DSV32X Gyroscope Sensor: power-off
06-05 18:20:30.802  2914  2914 D sensors-multihal@2.1-stm: LSM6DSV32X Accelerometer Sensor: changed pollrate to 60.002400Hz, timeout=0ms
06-05 18:20:30.802  2914  2914 D sensors-multihal@2.1-stm: LSM6DSV32X Accelerometer Sensor: changed pollrate to 60.002400Hz, timeout=0ms
06-05 18:20:30.803  2914  2914 D sensors-multihal@2.1-stm: LSM6DSV32X Accelerometer Sensor: power-on
06-05 18:20:30.821  2914  2914 D sensors-multihal@2.1-stm: LSM6DSV32X Accelerometer Sensor: power-on
06-05 18:20:35.831  2914  2914 D sensors-multihal@2.1-stm: LSM6DSV32X Accelerometer Sensor: power-off
06-05 18:20:35.846  2914  2914 W sensors-multihal@2.1-stm: failed to save accel bias
06-05 18:20:35.846  2914  2914 D sensors-multihal@2.1-stm: LSM6DSV32X Accelerometer Sensor: power-off
Namburger commented 5 months ago

+1

mariotesi commented 3 months ago

This commit a3c1c0f add support to LSM6DSV32X IMU device