Xiao BLE Sense & IMU - ZephyrOS

Hi Everyone,

I am trying to develop a simple application with the XIAO BLE Sense device, the idea is to send a BLE message with a something hits the device. To achieve this, I wanted to configure the IMU so that /*********************************/

First of all, let me summarize what I am using and what program I have uploaded to the device:

  • Hardware:
    • Xiao BLE Sense.
  • Software:
    • Visual Studio Code.
    • nRF Connect for VS Code Extension Pack (latest version).
    • nRF Connect SDK Toolchain v2.5.2
    • nRF Connect SDK v2.5.2
    • Zephyr OS.

I have used the Zephyr Example for LSM6DSL but I have modified the following piece of code:

#ifdef CONFIG_LSM6DSL_TRIGGER
        struct sensor_trigger trig;
		struct sensor_value dur;
		struct sensor_value th;
					 
		trig.type = SENSOR_TRIG_MOTION;
        trig.chan = SENSOR_CHAN_ACCEL_XYZ;

        if (sensor_trigger_set(lsm6dsl_dev, &trig, lsm6dsl_trigger_handler) != 0) {
            printk("Could not set sensor type and channel\n");
            return 0;
        }
		if (sensor_attr_set(lsm6dsl_dev,SENSOR_CHAN_ACCEL_XYZ,SENSOR_ATTR_SLOPE_TH, &val) !=0){
			printk("Could not set sensor attribute slope TH\n");
            return 0;
		}

		if (sensor_attr_set(lsm6dsl_dev,SENSOR_CHAN_ACCEL_XYZ,SENSOR_ATTR_SLOPE_DUR, &val) !=0){
			printk("Could not set sensor attribute slope DUR\n");
            return 0;
		}
    #endif
I also attach the prj.config
CONFIG_STDOUT_CONSOLE=y
CONFIG_I2C=y
CONFIG_SPI=y
CONFIG_SENSOR=y
CONFIG_LSM6DSL=y
CONFIG_LSM6DSL_ACCEL_ODR=8
CONFIG_LSM6DSL_ACCEL_FS=16
CONFIG_LSM6DSL_GYRO_FS=1000
CONFIG_LSM6DSL_GYRO_ODR=8
CONFIG_LSM6DSL_ENABLE_TEMP=y
CONFIG_LSM6DSL_TRIGGER_GLOBAL_THREAD=y
CONFIG_CBPRINTF_FP_SUPPORT=y

CONFIG_BT=y
CONFIG_LOG=y
CONFIG_BT_SMP=y
CONFIG_BT_DEBUG_LOG=y
CONFIG_BT_MAX_CONN=1
CONFIG_BT_GATT_CLIENT=y
CONFIG_BT_L2CAP_TX_MTU=247
CONFIG_BT_L2CAP_TX_BUF_COUNT=5
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME="ixi"
CONFIG_BT_DEVICE_APPEARANCE=962

CONFIG_HEAP_MEM_POOL_SIZE=2048

# This example requires more workqueue stack
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048

#USB
CONFIG_USB_DEVICE_STACK=y
CONFIG_USB_DEVICE_PRODUCT="IXI Sample"
CONFIG_USB_DEVICE_PID=0x0004

CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=n
CONFIG_USB_DRIVER_LOG_LEVEL_ERR=y
CONFIG_USB_DEVICE_LOG_LEVEL_ERR=y

CONFIG_SERIAL=y
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
CONFIG_UART_LINE_CTRL=y
/*********************************/
The issue that I am facing is that no events and no data from the IMU is either launched or read. The only way I could read data was when I use the 
trig.type = SENSOR_TRIG_DATA_READY.
So I am not sure what I am doing wrong or if more events have been developed in Zephyr. If so, somebody that has used other events could help me to configure it?

/*********************************/

Thanks beforehand, sorry for the inconveniences and looking forward to hearing from you.

Kind regards.

Parents Reply Children
No Data
Related