Error in compiling samples/sensor/lps22hh on nRF52840 DK

Hello,

I am trying to build the sample/sensor/lps22hh project on nRF52840 DK and STEVAL-MKI220V1, but receive errors in build.

I have added an overlay file as in boards/nrf52840dk_nrf52840.overlay below: (the sensor CS pin is high, and SA0 is 0)

&i2c0 {
    status = "okay";
    pinctrl-0 = <&i2c0_default>;
    pinctrl-1 = <&i2c0_sleep>;
    pinctrl-names = "default", "sleep";
    mysensor: lps22hh@5C{
        compatible = "st,lps22hh";
        status = "okay";
        reg = < 0x5C >;
    };
};

&pinctrl {
    i2c0_default: i2c0_default {
        group1  {
            psels = <NRF_PSEL(TWIM_SCL, 0, 27)>,
                        <NRF_PSEL(TWIM_SDA, 0, 26)>;
        };
    };

    i2c0_sleep: i2c0_sleep {
        group1  {
            psels = <NRF_PSEL(TWIM_SCL, 0, 27)>,
                        <NRF_PSEL(TWIM_SDA, 0, 26)>;
            low-power-enable;
        };
    };
};

&ppi {
    status = "disabled";
};

&clock {
    status = "disabled";
};
I have added the following include in main.c:
#include <zephyr/devicetree.h>
Also, modified line 54 in main.c to:
const struct device *const dev = DEVICE_DT_GET(DT_NODELABEL(mysensor));
I am receiving the following warning and error in the log:
-- Found assembler: C:/ncs/toolchains/0b393f9e1b/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc.exe
CMake Warning at C:/ncs/v3.0.2/zephyr/CMakeLists.txt:1002 (message):
No SOURCES given to Zephyr library: drivers__clock_control

Excluding target from build.


-- Configuring done
-- Generating done
-- Build files have been written to: C:/nordic_apps/lps22hh/build_1/lps22hh
-- Configuring done
-- Generating done
-- Build files have been written to: C:/nordic_apps/lps22hh/build_1
-- west build: building application
[4/158] Generating include/generated/zephyr/version.h
-- Zephyr version: 4.0.99 (C:/ncs/v3.0.2/zephyr), build: v4.0.99-ncs1-2
[107/158] Building C object zephyr/drivers/sensor/nordic/temp/CMakeFiles/drivers__sensor__nordic__temp.dir/temp_nrf5.c.obj
FAILED: zephyr/drivers/sensor/nordic/temp/CMakeFiles/drivers__sensor__nordic__temp.dir/temp_nrf5.c.obj
I appreciate your help in resolving this problem.
Thanks,
Parents
  • Hello,

    I would like to update this case since I corrected the overlay file by removing the ppi and clock disabling lines; also in sample.yaml file added:

    common:
      sysbuild: true
      build_only: true
      integration_platforms:
        - nrf52840dk/nrf52840

    Now the code builds correctly, but I assume there is a problem with the device tree. I ran the code on nRF52840 DK and received:

    *** Booting nRF Connect SDK v3.0.2-89ba1294ac9b ***
    *** Using Zephyr OS v4.0.99-f791c49f492c ***
    sensor: device not ready.

    regarding the first lines in main():

        const struct device *const dev = DEVICE_DT_GET(DT_NODELABEL(mysensor));

        if (!device_is_ready(dev)) {
            printk("sensor: device not ready.\n");
            return 0;
        }

    Can you please help resolve this issue?

    Thanks

  • Hi Roya,

    A device might not be ready for several reasons, such as:

    • Initialization failure
    • The devicetree node not being enabled (status not "okay")
    • The driver not being built in or the correct Kconfig option missing

    If you’d like, you can upload a zip of your project and I’ll take a look. I can also make the ticket private if you prefer not to share your code publicly.

    Best regards,
    Benjamin

Reply
  • Hi Roya,

    A device might not be ready for several reasons, such as:

    • Initialization failure
    • The devicetree node not being enabled (status not "okay")
    • The driver not being built in or the correct Kconfig option missing

    If you’d like, you can upload a zip of your project and I’ll take a look. I can also make the ticket private if you prefer not to share your code publicly.

    Best regards,
    Benjamin

Children
Related