using imu sensor with nrf52840 based Xiao BLE Sense

hi,i wanna read the imu sensor  lsm6ds3 on board of nrf52840 based Xiao BLE Sense

so i used the code in samples /sensor/lsm6dsl 

first i didn't know if i do have to create an overlay file since the  imu is build in and eventually i created this overlay file" xioa-ble-nrf52840-sense.overlay":

/*
 * Copyright (c) 2022-2023 Marcin Niestroj
 *
 * SPDX-License-Identifier: Apache-2.0
 */

 
 / {
     model = "Seeed XIAO BLE Sense";
     compatible = "seeed,xiao-ble", "seeed,xiao-ble-sense";
 

     lsm6ds3tr-c-en {
         compatible = "regulator-fixed-sync", "regulator-fixed";
         enable-gpios = <&gpio1 8 (NRF_GPIO_DRIVE_S0H1 | GPIO_ACTIVE_HIGH)>;
         regulator-name = "LSM6DS3TR_C_EN";
         regulator-boot-on;
         startup-delay-us = <3000>;
     };
 };
 
 &i2c0 {
     compatible = "nordic,nrf-twim";
     /* Cannot be used together with spi0. */
     status = "okay";
     pinctrl-0 = <&i2c0_default>;
     pinctrl-1 = <&i2c0_sleep>;
     pinctrl-names = "default", "sleep";
     clock-frequency = <I2C_BITRATE_FAST>;
 
     lsm6ds3tr_c: lsm6ds3tr-c@6a {
         compatible = "st,lsm6dsl";
         reg = <0x6a>;
         irq-gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>;
         status = "okay";
     };
 };
which is paracticlly the same in  xioa-ble-nrf52840-sense.dts 
plus i didn't know if i need to make changes in the originall code of lsm6dsl
so when i build i got error involve this line 
  const struct device *const lsm6dsl_dev = DEVICE_DT_GET_ONE(st_lsm6dsl); and it seems they are using xiao-ble.dts and not xiao-ble_nrf52840_sense.dst  so can you help me
Parents Reply Children
  • Hi there,

    SO the Schematic shows you some stuff , Like the power to the IMU can be controlled by Port P1.08 also,

    in arduino it is set like this 

    LSM6DS3 IMU(I2C_MODE, 0x6A);  //I2C device address 0x6A  // IMU
    #define int2Pin PIN_LSM6DS3TR_C_INT1

    The I2C address for the IMU is 0x6A configuration and registers to read the data from as well as the INT1 is the only Interrupt pin wired to it and the config registers are set to route everything through INT1 if that makes sense.

    my .02 

    HTH

    GL :-) PJ 

Related