Running the LSM6DLS (IMU) zephyr example with nrf52840 based Xiao BLE Sense

Hi all,

I've been trying to get the samples/sensor/lsm6dsl example working with the nrf52840-based Xiao BLE Sense and have had no luck.

I guess that it's due to the power line for the sensor being connected to the P1.08

I dug into the xiao_ble_sense.dts and I can indeed see:

However no matter how I try and drive it from the code the sensor refuses to initialize with the console output:

My code to run is based of the sample code for the sensor with the lsm6ds3tr_c_en modifications:



And my prj.conf:

I am trying to drive this the proper way but am I missing something obvious?

Should I just ignore the config and drive P1.08 manually?

Thanks for taking a look!
I'm using nRF Connect SDK v2.6.0 (latest available at the time of posting)

Parents
  • After much confusion and life interruptions it would seem that I do have this working, via the LSM6DSL sample out of the box, or so I think.

    I was having much trouble with different things, in one case the app would crash without writing to the UART unless I stepped through the initialization with the debugger, in another case it would not flash due to some obscure overflow error.

    So, maybe this is all just a figment of my imagination.

    My setup is:
    - running within a Docker image
    - using VSCode via its remote container connected to the Docker image
    - nRFConnect VSCode extension
    - Xiao board on a Seeed Xiao expansion board
    - Uploading via Segger J-Link EDU
    - On Linux

    At the time of the above weirdness I had changed the nrfConnect tools version number, for some silly reason, from 2.5.2 to 2.6.0.
    I don't know if that's when things fell apart or not. But, I did hear on a webcast today that the presenter was having some issues with the later 2.6.0 version of the tools, so perhaps it did have some impact??

    At the same time I was trying to implement a version of LSM6DS3 as seen here: https://iwasz.pl/electronics/2021-06-18-out-of-tree-zephyr-module.md/     Got nowhere except the above debug problem.

    Then I changed the nRFConnect tool version back to 2.5.2 and went way for a few days, then things started working, don't ask why though. (Perhaps the local total eclipse fixed it)

    The versions I believe I'm currently using, and were I found the version info:

    Seeed Xiao bootloader: (double click Xiao reset button)
    ------------------------
    UF2 Bootloader 0.6.1 lib/nrfx (v2.0.0) lib/tinyusb (0.10.1-293-gaf8e5a90) lib/uf2 (remotes/origin/configupdate-9-gadbb8c7)
    Model: Seeed XIAO nRF52840
    Board-ID: Seeed_XIAO_nRF52840_Sense
    SoftDevice: S140 version 7.3.0
    Date: Nov 12 2021

    OS/SDKs
    ----------
    Zephyr
    --------
    source: github.com/.../sdk-zephyr
    3.4.99.0 (VERSION file) A Nordic downstream version I'm pretty sure
    git HEAD: 2e2523efe52a7ac89f0567b8798fd857b1e71ae3"


    nRF Connect SDK
    ----------------
    source: github.com/.../sdk-nrf
    2.5.0 (VERSION file)
    git HEAD: 1fae141fc6713dd331b797fc96c90dc84552242d

    nRFX Common Libraries (nRFxlib)
    ---------------------------------
    github.com/.../sdk-nrfxlib
    2.5.0 (.git/FETCH_HEAD)
    git HEAD: 78cc07ed7c9f168c3d6316db5af969ac5f7c977a

    nRF Tool Chain
    ---------------
    loaded via VSCode nRFConnect extension
    nRFConnect SDK ToolChain: 2.5.20231017.513615545433 (From build output)


    Versions reported from build output:
    ------------------------------------------
    -- CMake version: 3.20.5
    -- Using NCS Toolchain 2.5.20231017.513615545433 for building.
    -- Found Python3: ~/ncs/toolchains/7795df4459/usr/local/bin/python3 (found suitable version "3.8.2")
    -- Found west (found suitable version "1.1.0")
    -- Board: xiao_ble_sense
    -- Found host-tools: zephyr 0.16.1 (~/ncs/toolchains/7795df4459/opt/zephyr-sdk)
    -- Found toolchain: zephyr 0.16.1 (~/ncs/toolchains/7795df4459/opt/zephyr-sdk)
    -- Found Dtc: ~/ncs/toolchains/7795df4459/usr/local/bin/dtc (found suitable version "1.4.7", minimum required is "1.4.6")
    -- Found BOARD.dts: ~/ncs/v2.5.0/zephyr/boards/arm/xiao_ble/xiao_ble_sense.dts
    -- The C compiler identification is GNU 12.2.0
    -- The CXX compiler identification is GNU 12.2.0
    -- The ASM compiler identification is GNU
    -- Found assembler: ~/ncs/toolchains/7795df4459/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
    -- Zephyr version: 3.4.99 (~/ncs/v2.5.0/zephyr), build: 2e2523efe52a

    I suppose when the moon comes around again it will fall apart again...

  • Thank you for your input !

    This is wild, what do you think is causing this shaky operation?

    Oh and I also followed the out of tree zephyr module repo but then I realized that all that changes is the I2C address and that is defined in the configuration in the recent versions of Zephyr.

  • I have the exact same error and my device is not ready during init. I followed this sample for reference but unable to fix the issue. Would be great if you can share the working code and config.

    The lsm6ds3tr_c_en is ready but lsm6dsl_dev is not ready.

    I am on the inverted side of earth so the eclipse may take a while to clear out :)

    main.c:

    prf.conf:

  •   I've built the code you posted, the main.c and prj.conf in my environment with both the 2.5.2 and 2.6.0 toolchains (at least I'm pretty sure). In both cases the code seems to run just fine on "my machine" ( yeah, I know, what else hidden is different).

    Have you checked your tool/SDK/cmake/Zephyr etc versions against what I posted? 

    Again, I'm running Linux/VSCode/NCS extension/ in a Docker container.

    Also I have the Xiao installed in an expansion board if that matters, which I suppose it might if there are pullups and such on the expansion board that may come into play. (I have no clue on that)

    I also have the Xiao 3.3 volt pin disconnected from the expansion board due to issues I ran into with other expansion boards, I suppose a voltage fluctuation/difference could in theory come into play.

    And for more completeness am using a Segger JLink EDU to upload/run the app.

    I you want to drop your built .elf and .hex files out on a Google drive or some such, I can upload it to my board to see if it works there??

  • Hey   can I take you up on this?
    If this works then we can eliminate an issue with the Zephyr environment vs the XIAO Sense board.

  • Ughh, my message to you has been marked as spam by the mods, can you please help at least with un-marking the message as spam, thank you!

Reply Children