LIS2DH12 device is not ready issue

Hi,

I have added .overlay file as below mentioned 

&spi0 {
    status = "okay";   
    acc_lis2dh_spi: lis2dh@0 {
        compatible = "st,lis2dh";
        reg = <0>;
        spi-max-frequency = <10000000>;
        irq-gpios = <&gpio1 1 2>;
        label = "LIS2DH";
    };
};

And i have added my prj.config file as mentioned below.

CONFIG_STDOUT_CONSOLE=y
CONFIG_SPI=y
CONFIG_SENSOR=y
CONFIG_CBPRINTF_FP_SUPPORT=y
CONFIG_LIS2DH=y
CONFIG_LIS2DH_TRIGGER_GLOBAL_THREAD=y
CONFIG_PRINTK=y

And I am facing issue is
Device LIS2DH is not ready with nrf52840dk.

So, can you please, help me with it.

Thanks & Regards,

Shaik Jareena.

  • Hi,

    I forgot to mention that when I am adding like this below 

    &spi1 {
        status = "okay";
        compatible = "nordic,nrf-spi";
        sck-pin = <0x23>;
        mosi-pin = <0x24>;
        miso-pin = <0x25>;
        cs-gpios = <&gpio1 1 GPIO_ACTIVE_LOW>;
        
        acc_lis2dh_spi: lis2dh@0 {
            compatible = "st,lis2dh";
            reg = <0>;
            spi-max-frequency = <10000000>;
            irq-gpios = <&gpio1 2 1>;
            label = "LIS2DH";
        };
    };

    I am facing cmake errors and i am not able to build even 

    [{
    	"resource": "/c:/ncs/v2.5.1/zephyr/cmake/modules/dts.cmake",
    	"owner": "nrf-connect",
    	"severity": 8,
    	"message": "CMake Error at C:/ncs/v2.5.1/zephyr/cmake/modules/dts.cmake:279 (message):",
    	"source": "cmake",
    	"startLineNumber": 279,
    	"startColumn": 1,
    	"endLineNumber": 279,
    	"endColumn": 2147483647
    }]

    So, If i solve this only I can build my lis2dh12 application. So, can you please provide the correct .overlay file for nrf52840.

    Your help is more Appreciable.

    Thanks & Regards,

    Shaik Jareena.

  • What build error do you get?

    regards

    Jared 

  • Hi,

    I am facing below mentioned errors. Can you please, help me with it.

    Building lis2dh
    C:\Windows\system32\cmd.exe /d /s /c "west build --build-dir c:/ncs/v2.5.1/zephyr/samples/sensor/lis2dh/build c:/ncs/v2.5.1/zephyr/samples/sensor/lis2dh"

    [0/1] Re-running CMake...
    Loading Zephyr default modules (Zephyr base (cached)).
    -- Application: C:/ncs/v2.5.1/zephyr/samples/sensor/lis2dh
    -- CMake version: 3.20.5
    -- Cache files will be written to: C:/ncs/v2.5.1/zephyr/.cache
    -- Zephyr version: 3.4.99 (C:/ncs/v2.5.1/zephyr)
    -- Found west (found suitable version "1.1.0", minimum required is "0.14.0")
    -- Board: nrf52840dk_nrf52840
    -- Found host-tools: zephyr 0.16.1 (C:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk)
    -- Found toolchain: zephyr 0.16.1 (C:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk)
    -- Found BOARD.dts: C:/ncs/v2.5.1/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts
    -- Found devicetree overlay: C:/ncs/v2.5.1/zephyr/samples/sensor/lis2dh/nrf52840dk_nrf52840.overlay
    -- Found devicetree overlay: nrf52840dk_nrf52840.overlay
    devicetree error: 'sck-pin' appears in /soc/spi@40004000 in C:/ncs/v2.5.1/zephyr/samples/sensor/lis2dh/build/zephyr/zephyr.dts.pre, but is not declared in 'properties:' in C:/ncs/v2.5.1/zephyr/dts/bindings\spi\nordic,nrf-spi.yaml
    -- In: C:/ncs/v2.5.1/zephyr/samples/sensor/lis2dh/build/zephyr, command: C:/ncs/toolchains/c57af46cb7/opt/bin/python.exe;C:/ncs/v2.5.1/zephyr/scripts/dts/gen_defines.py;--dts;C:/ncs/v2.5.1/zephyr/samples/sensor/lis2dh/build/zephyr/zephyr.dts.pre;--dtc-flags;'-Wno-unique_unit_address_if_enabled';--bindings-dirs;C:/ncs/v2.5.1/nrf/dts/bindings;C:/ncs/v2.5.1/zephyr/dts/bindings;--header-out;C:/ncs/v2.5.1/zephyr/samples/sensor/lis2dh/build/zephyr/include/generated/devicetree_generated.h.new;--dts-out;C:/ncs/v2.5.1/zephyr/samples/sensor/lis2dh/build/zephyr/zephyr.dts.new;--edt-pickle-out;C:/ncs/v2.5.1/zephyr/samples/sensor/lis2dh/build/zephyr/edt.pickle;--vendor-prefixes;C:/ncs/v2.5.1/nrf/dts/bindings/vendor-prefixes.txt;--vendor-prefixes;C:/ncs/v2.5.1/zephyr/dts/bindings/vendor-prefixes.txt
    CMake Error at C:/ncs/v2.5.1/zephyr/cmake/modules/dts.cmake:279 (message):
    gen_defines.py failed with return code: 1
    Call Stack (most recent call first):
    C:/ncs/v2.5.1/zephyr/cmake/modules/zephyr_default.cmake:129 (include)
    C:/ncs/v2.5.1/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
    C:/ncs/v2.5.1/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:97 (include_boilerplate)
    CMakeLists.txt:8 (find_package)


    -- Configuring incomplete, errors occurred!
    See also "C:/ncs/v2.5.1/zephyr/samples/sensor/lis2dh/build/CMakeFiles/CMakeOutput.log".
    See also "C:/ncs/v2.5.1/zephyr/samples/sensor/lis2dh/build/CMakeFiles/CMakeError.log".
    ninja: error: rebuilding 'build.ninja': subcommand failed
    FAILED: build.ninja
    C:\ncs\toolchains\c57af46cb7\opt\bin\cmake.exe --regenerate-during-build -SC:\ncs\v2.5.1\zephyr\samples\sensor\lis2dh -BC:\ncs\v2.5.1\zephyr\samples\sensor\lis2dh\build
    FATAL ERROR: command exited with status 1: 'C:\ncs\toolchains\c57af46cb7\opt\bin\cmake.EXE' --build 'c:\ncs\v2.5.1\zephyr\samples\sensor\lis2dh\build'

    * The terminal process terminated with exit code: 1.
    * Terminal will be reused by tasks, press any key to close it.

    * Executing task: nRF Connect: Build [clean]: lis2dh/build (active)

    Building lis2dh
    C:\Windows\system32\cmd.exe /d /s /c "west build -t clean --build-dir c:/ncs/v2.5.1/zephyr/samples/sensor/lis2dh/build"

    -- west build: running target clean
    [0/1] Re-running CMake...
    Loading Zephyr default modules (Zephyr base (cached)).
    -- Application: C:/ncs/v2.5.1/zephyr/samples/sensor/lis2dh
    -- CMake version: 3.20.5
    -- Cache files will be written to: C:/ncs/v2.5.1/zephyr/.cache
    -- Zephyr version: 3.4.99 (C:/ncs/v2.5.1/zephyr)
    -- Found west (found suitable version "1.1.0", minimum required is "0.14.0")
    -- Board: nrf52840dk_nrf52840
    -- Found host-tools: zephyr 0.16.1 (C:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk)
    -- Found toolchain: zephyr 0.16.1 (C:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk)
    -- Found BOARD.dts: C:/ncs/v2.5.1/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts
    -- Found devicetree overlay: C:/ncs/v2.5.1/zephyr/samples/sensor/lis2dh/nrf52840dk_nrf52840.overlay
    -- Found devicetree overlay: nrf52840dk_nrf52840.overlay
    devicetree error: 'sck-pin' appears in /soc/spi@40004000 in C:/ncs/v2.5.1/zephyr/samples/sensor/lis2dh/build/zephyr/zephyr.dts.pre, but is not declared in 'properties:' in C:/ncs/v2.5.1/zephyr/dts/bindings\spi\nordic,nrf-spi.yaml
    -- In: C:/ncs/v2.5.1/zephyr/samples/sensor/lis2dh/build/zephyr, command: C:/ncs/toolchains/c57af46cb7/opt/bin/python.exe;C:/ncs/v2.5.1/zephyr/scripts/dts/gen_defines.py;--dts;C:/ncs/v2.5.1/zephyr/samples/sensor/lis2dh/build/zephyr/zephyr.dts.pre;--dtc-flags;'-Wno-unique_unit_address_if_enabled';--bindings-dirs;C:/ncs/v2.5.1/nrf/dts/bindings;C:/ncs/v2.5.1/zephyr/dts/bindings;--header-out;C:/ncs/v2.5.1/zephyr/samples/sensor/lis2dh/build/zephyr/include/generated/devicetree_generated.h.new;--dts-out;C:/ncs/v2.5.1/zephyr/samples/sensor/lis2dh/build/zephyr/zephyr.dts.new;--edt-pickle-out;C:/ncs/v2.5.1/zephyr/samples/sensor/lis2dh/build/zephyr/edt.pickle;--vendor-prefixes;C:/ncs/v2.5.1/nrf/dts/bindings/vendor-prefixes.txt;--vendor-prefixes;C:/ncs/v2.5.1/zephyr/dts/bindings/vendor-prefixes.txt
    CMake Error at C:/ncs/v2.5.1/zephyr/cmake/modules/dts.cmake:279 (message):
    gen_defines.py failed with return code: 1
    Call Stack (most recent call first):
    C:/ncs/v2.5.1/zephyr/cmake/modules/zephyr_default.cmake:129 (include)
    C:/ncs/v2.5.1/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
    C:/ncs/v2.5.1/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:97 (include_boilerplate)
    CMakeLists.txt:8 (find_package)


    -- Configuring incomplete, errors occurred!
    See also "C:/ncs/v2.5.1/zephyr/samples/sensor/lis2dh/build/CMakeFiles/CMakeOutput.log".
    See also "C:/ncs/v2.5.1/zephyr/samples/sensor/lis2dh/build/CMakeFiles/CMakeError.log".
    FAILED: build.ninja
    C:\ncs\toolchains\c57af46cb7\opt\bin\cmake.exe --regenerate-during-build -SC:\ncs\v2.5.1\zephyr\samples\sensor\lis2dh -BC:\ncs\v2.5.1\zephyr\samples\sensor\lis2dh\build
    ninja: error: rebuilding 'build.ninja': subcommand failed
    FATAL ERROR: command exited with status 1: 'C:\ncs\toolchains\c57af46cb7\opt\bin\cmake.EXE' --build 'c:\ncs\v2.5.1\zephyr\samples\sensor\lis2dh\build' --target clean

    * The terminal process terminated with exit code: 1.
    * Terminal will be reused by tasks, press any key to close it.

    * Executing task: nRF Connect: Build: lis2dh/build (active)

    Building lis2dh
    C:\Windows\system32\cmd.exe /d /s /c "west build --build-dir c:/ncs/v2.5.1/zephyr/samples/sensor/lis2dh/build c:/ncs/v2.5.1/zephyr/samples/sensor/lis2dh"

    [0/1] Re-running CMake...
    Loading Zephyr default modules (Zephyr base (cached)).
    -- Application: C:/ncs/v2.5.1/zephyr/samples/sensor/lis2dh
    -- CMake version: 3.20.5
    -- Cache files will be written to: C:/ncs/v2.5.1/zephyr/.cache
    -- Zephyr version: 3.4.99 (C:/ncs/v2.5.1/zephyr)
    -- Found west (found suitable version "1.1.0", minimum required is "0.14.0")
    -- Board: nrf52840dk_nrf52840
    -- Found host-tools: zephyr 0.16.1 (C:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk)
    -- Found toolchain: zephyr 0.16.1 (C:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk)
    -- Found BOARD.dts: C:/ncs/v2.5.1/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts
    -- Found devicetree overlay: C:/ncs/v2.5.1/zephyr/samples/sensor/lis2dh/nrf52840dk_nrf52840.overlay
    -- Found devicetree overlay: nrf52840dk_nrf52840.overlay
    devicetree error: 'sck-pin' appears in /soc/spi@40004000 in C:/ncs/v2.5.1/zephyr/samples/sensor/lis2dh/build/zephyr/zephyr.dts.pre, but is not declared in 'properties:' in C:/ncs/v2.5.1/zephyr/dts/bindings\spi\nordic,nrf-spi.yaml
    -- In: C:/ncs/v2.5.1/zephyr/samples/sensor/lis2dh/build/zephyr, command: C:/ncs/toolchains/c57af46cb7/opt/bin/python.exe;C:/ncs/v2.5.1/zephyr/scripts/dts/gen_defines.py;--dts;C:/ncs/v2.5.1/zephyr/samples/sensor/lis2dh/build/zephyr/zephyr.dts.pre;--dtc-flags;'-Wno-unique_unit_address_if_enabled';--bindings-dirs;C:/ncs/v2.5.1/nrf/dts/bindings;C:/ncs/v2.5.1/zephyr/dts/bindings;--header-out;C:/ncs/v2.5.1/zephyr/samples/sensor/lis2dh/build/zephyr/include/generated/devicetree_generated.h.new;--dts-out;C:/ncs/v2.5.1/zephyr/samples/sensor/lis2dh/build/zephyr/zephyr.dts.new;--edt-pickle-out;C:/ncs/v2.5.1/zephyr/samples/sensor/lis2dh/build/zephyr/edt.pickle;--vendor-prefixes;C:/ncs/v2.5.1/nrf/dts/bindings/vendor-prefixes.txt;--vendor-prefixes;C:/ncs/v2.5.1/zephyr/dts/bindings/vendor-prefixes.txt
    CMake Error at C:/ncs/v2.5.1/zephyr/cmake/modules/dts.cmake:279 (message):
    gen_defines.py failed with return code: 1
    Call Stack (most recent call first):
    C:/ncs/v2.5.1/zephyr/cmake/modules/zephyr_default.cmake:129 (include)
    C:/ncs/v2.5.1/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
    C:/ncs/v2.5.1/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:97 (include_boilerplate)
    CMakeLists.txt:8 (find_package)


    -- Configuring incomplete, errors occurred!
    See also "C:/ncs/v2.5.1/zephyr/samples/sensor/lis2dh/build/CMakeFiles/CMakeOutput.log".
    See also "C:/ncs/v2.5.1/zephyr/samples/sensor/lis2dh/build/CMakeFiles/CMakeError.log".
    FAILED: build.ninja
    C:\ncs\toolchains\c57af46cb7\opt\bin\cmake.exe --regenerate-during-build -SC:\ncs\v2.5.1\zephyr\samples\sensor\lis2dh -BC:\ncs\v2.5.1\zephyr\samples\sensor\lis2dh\build
    ninja: error: rebuilding 'build.ninja': subcommand failed
    FATAL ERROR: command exited with status 1: 'C:\ncs\toolchains\c57af46cb7\opt\bin\cmake.EXE' --build 'c:\ncs\v2.5.1\zephyr\samples\sensor\lis2dh\build'

    * The terminal process terminated with exit code: 1.
    * Terminal will be reused by tasks, press any key to close it.

    Thanks & Regards,

    Shaik Jareena.

  • Hi,

    You have to use pin ctrl when you add the pins, for example in the JESD216 sample:

    And the board file for nrf52840dk_nrf52840-pinctrl.dtsi

    regards

    Jared

  • Hi,

    Thank you for your response, I have one doubt about pin connections now I have to provide the pin connections according to the LIS2DH12 and nRF52840 pins. So, I have to change the pins If I am using JES2D16 reference sample but I do not have schematic of LIS2DH12+nRF52840 pin connections, I searched for it in Nordic website but i did not find it.

    If you have schematic of LIS2DH12+nRF52840 pin connections schematic, can you please, share with me.

    Thanks & Regards,

    Shaik Jareena.

Related