Facing issue in connecting SHT40 with Circuitdojo_feather_nrf9151

Hi,
I have purchase a circuitdojo_feather_nrf9151 board it has LIS2DH12 and npm1300 on i2c2 i also want to connect SHT40 but facing issue this sensor is not detecting on i2c pins. I have tested this sensor with other controller like esp32 it is working

i am getting following logs

[00:00:05.199,737] <inf> sensors: Scanning I2C2 bus...
[00:00:05.203,948] <inf> sensors: Found: 0x19
[00:00:05.222,747] <inf> sensors: Found: 0x6B
[00:00:05.225,524] <inf> sensors: Sensors: modem ready
[00:00:05.231,231] <err> SHT4X: Invalid CRC for RH.
[00:00:05.231,231] <err> SHT4X: Failed to fetch data.
[00:00:05.231,262] <wrn> sensors: SHT40 fetch failed: -5
[00:00:05.231,262] <wrn> sensors: SHT40 unavailable, falling back to modem temperature

#if DT_HAS_ALIAS(sht40)
static const struct device *sht40_dev = DEVICE_DT_GET(DT_ALIAS(sht40));
#else
static const struct device *sht40_dev = NULL;
#endif   
   
    
    static bool read_sht40(int16_t *temp_c_x10, uint8_t *humidity_pct)
{
    if (!sht40_dev || !device_is_ready(sht40_dev)) {
        LOG_WRN("SHT40 not ready");
        return false;
    }

    int err = sensor_sample_fetch(sht40_dev);
    if (err) {
        LOG_WRN("SHT40 fetch failed: %d", err);
        return false;
    }

    struct sensor_value temp, hum;

    err = sensor_channel_get(sht40_dev, SENSOR_CHAN_AMBIENT_TEMP, &temp);
    if (err) {
        LOG_WRN("SHT40 temp get failed: %d", err);
        return false;
    }

    err = sensor_channel_get(sht40_dev, SENSOR_CHAN_HUMIDITY, &hum);
    if (err) {
        LOG_WRN("SHT40 humidity get failed: %d", err);
        return false;
    }

    /*
     * sensor_value { int32_t val1; int32_t val2; }
     * val1 = integer part, val2 = fractional part (millionths).
     * We store temperature × 10 for 0.1 °C resolution.
     *
     * Example: 23.56 °C → val1=23, val2=560000 → temp_c_x10 = 235
     */
    *temp_c_x10 = (int16_t)(temp.val1 * 10 + temp.val2 / 100000);

    /*
     * Humidity: clamp to 0–100 %, rounding to nearest integer.
     */
    int32_t hum_int = hum.val1;
    if (hum_int < 0)   hum_int = 0;
    if (hum_int > 100) hum_int = 100;
    *humidity_pct = (uint8_t)hum_int;

    LOG_INF("SHT40: temp=%d.%d °C  hum=%u %%",
            *temp_c_x10 / 10, abs(*temp_c_x10 % 10), *humidity_pct);

    return true;
}
    
    
    
    if (sht40_dev && device_is_ready(sht40_dev)) {
        LOG_INF("SHT40 ready on I2C — using as primary temperature source");
    } else {
        LOG_WRN("SHT40 not found — falling back to modem AT%%XTEMP?");
    }    

    /* Temporary — remove after confirming SHT40 is found */
    const struct device *i2c2_bus = DEVICE_DT_GET(DT_NODELABEL(i2c2));
    if (device_is_ready(i2c2_bus)) {
        LOG_INF("Scanning I2C2 bus...");
        for (uint8_t addr = 0x08; addr < 0x78; addr++) {
            uint8_t dummy;
            if (i2c_read(i2c2_bus, &dummy, 1, addr) == 0) {
                LOG_INF("  Found: 0x%02X", addr);
            }
        }
    } else {
        LOG_ERR("I2C2 bus not ready!");
    }
    
    
    
    my overlay
    
    
    / {
    aliases {
        uart-bridge = &uart1;
        sht40 = &sht40;
    };
};

&uart1 {
    status = "okay";
    current-speed = <115200>;
};

&i2c2 {
    clock-frequency = <I2C_BITRATE_STANDARD>;
	npm1300_pmic: pmic@6b {
		compatible = "nordic,npm1300";
		reg = <0x6b>;

		npm1300_leds: leds {
			compatible = "nordic,npm1300-led";
			nordic,led0-mode = "host";
			nordic,led1-mode = "host";
			nordic,led2-mode = "host";
		};

	};
    sht40: sht40@44 {
        compatible = "sensirion,sht4x";
        reg = <0x44>;
        repeatability = <1>;
    };
};


in prj.conf
CONFIG_I2C=y
CONFIG_SENSOR=y
CONFIG_LIS2DH=y
CONFIG_SHT4X=y

Related