Help with lsm6dsl imu on verdin imx8mm running torizon os 6.4

Hi.

I am using an IMU LSM6DSL on torizoncore. I have written a dts entry and the device is recognized by the som and appears as iio device 2 and 3 on the iio bus.

The issue I am facing is that although it shows several channels for accelerometer and gyros, there are no buffers or triggers present in the related device folders.

from the tcb project, when I search lsm6dsx in the linux directory, it shows the driver supports only a FIFO buffer. but somehow the buffer isnt shown inside the directories.

For another iio device, the buffer and trigger folders shows up.

Can the issue be related to the iio driver being used inside the kernel? or due to some other kernel configs?

Best Regards.

EDIT: these are the closest references I could find:

The following is the status of config flags in config.gz

torizon@verdin-imx8mm-14756428:~$ zcat /proc/config.gz | grep -i CONFIG_IIO
CONFIG_IIO=m
CONFIG_IIO_BUFFER=y
CONFIG_IIO_BUFFER_CB=m
# CONFIG_IIO_BUFFER_DMA is not set
# CONFIG_IIO_BUFFER_DMAENGINE is not set
# CONFIG_IIO_BUFFER_HW_CONSUMER is not set
CONFIG_IIO_KFIFO_BUF=m
CONFIG_IIO_TRIGGERED_BUFFER=m
# CONFIG_IIO_CONFIGFS is not set
CONFIG_IIO_TRIGGER=y
CONFIG_IIO_CONSUMERS_PER_TRIGGER=2
# CONFIG_IIO_SW_DEVICE is not set
# CONFIG_IIO_SW_TRIGGER is not set
# CONFIG_IIO_TRIGGERED_EVENT is not set
# CONFIG_IIO_CROS_EC_ACCEL_LEGACY is not set
CONFIG_IIO_ST_ACCEL_3AXIS=m
CONFIG_IIO_ST_ACCEL_I2C_3AXIS=m
CONFIG_IIO_ST_ACCEL_SPI_3AXIS=m
# CONFIG_IIO_RESCALE is not set
CONFIG_IIO_CROS_EC_SENSORS_CORE=m
CONFIG_IIO_CROS_EC_SENSORS=m
# CONFIG_IIO_CROS_EC_SENSORS_LID_ANGLE is not set
CONFIG_IIO_MS_SENSORS_I2C=m
# CONFIG_IIO_SCMI is not set
# CONFIG_IIO_SSP_SENSORHUB is not set
CONFIG_IIO_ST_SENSORS_I2C=m
CONFIG_IIO_ST_SENSORS_SPI=m
CONFIG_IIO_ST_SENSORS_CORE=m
CONFIG_IIO_ST_GYRO_3AXIS=m
CONFIG_IIO_ST_GYRO_I2C_3AXIS=m
CONFIG_IIO_ST_GYRO_SPI_3AXIS=m
CONFIG_IIO_ST_LSM6DSX=m
CONFIG_IIO_ST_LSM6DSX_I2C=m
CONFIG_IIO_ST_LSM6DSX_SPI=m
CONFIG_IIO_ST_LSM6DSX_I3C=m
# CONFIG_IIO_ST_LSM9DS0 is not set
CONFIG_IIO_ADIS_LIB=m
CONFIG_IIO_ADIS_LIB_BUFFER=y
CONFIG_IIO_CROS_EC_LIGHT_PROX=m
CONFIG_IIO_ST_MAGN_3AXIS=m
CONFIG_IIO_ST_MAGN_I2C_3AXIS=m
CONFIG_IIO_ST_MAGN_SPI_3AXIS=m
# CONFIG_IIO_MUX is not set
CONFIG_IIO_INTERRUPT_TRIGGER=m
CONFIG_IIO_SYSFS_TRIGGER=m
CONFIG_IIO_CROS_EC_BARO=m
CONFIG_IIO_ST_PRESS=m
CONFIG_IIO_ST_PRESS_I2C=m
CONFIG_IIO_ST_PRESS_SPI=m

Greetings @geopaxpvtltd,

I’m not familiar with this specific peripheral, so I’m not sure how much help I can provide but I’ll see what I can comment on.

I see the there is a driver for this peripheral in the Linux kernel. Are you using this version of the driver or are you using the one from the STM repo that you linked?

For another iio device, the buffer and trigger folders shows up.

The fact that this works for other devices does indicate that the issue is specific to this device. Now I’m not sure if it’s the driver, or perhaps this peripheral needs more configuration for buffer and trigger. I found this: IMU — NetModule OEM Linux Distribution 1.0.0 documentation

Which seems to suggest that buffered mode needs to be enabled. Though I’m unsure how up-to-date this documentation is. I also found this article from STM on using the sensor: https://wiki.st.com/stm32mpu/wiki/IKS01A2_MEMS_expansion_board#Read_motion_MEMS_via_bash_script

Though there doesn’t seem to be mention of buffer or trigger. I can’t seem to find much else beyond this.

Best Regards,
Jeremias

I am using the kernel driver. I thought the kernel driver is the same as the st repo?

Is it possible that the buffer is dependent upon scan_elements and creation of scan_elements is dependent upon the inturrupts being correctly configured? I say this because imu int pins are connected a gpio expander on my cb but the gpio expander’s int pin is not connected to the verdin som. This may cause the driver to not be able to get interrupts through the gpio exp?

Hi @jeremias.tx,

I was able to jerry rig a jumper to the int pin to SODIMM216 and enable the interrupt functionality of the gpio expander and the buffer and scan elements started appearing.

Seems interrupt is necessary.

Glad you were able to resolve the issue!