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

Parents
  • Hi

    Can you upload your overlay and your prj.conf? I would also recommend to verify the address of the sensor so we can be sure it is one of the sensors you found during scanning. 

    Regards

    Runar

  • Hi,

    Thanks for reply my sensor address is 0x44h and my device tree and overlay is

    /dts-v1/;
    
    / {
    	#address-cells = < 0x1 >;
    	#size-cells = < 0x1 >;
    	model = "Circuit Dojo nRF9151 Feather";
    	compatible = "circuitdojo,feather-nrf9151";
    	chosen {
    		zephyr,entropy = &psa_rng;
    		zephyr,flash-controller = &flash_controller;
    		zephyr,console = &uart0;
    		zephyr,shell-uart = &uart0;
    		zephyr,uart-mcumgr = &uart0;
    		nordic,modem-trace-uart = &uart1;
    		nordic,pm-ext-flash = &w25q128jv;
    		zephyr,flash = &flash0;
    		zephyr,sram = &sram0_ns;
    		zephyr,code-partition = &slot0_ns_partition;
    	};
    	aliases {
    		sw0 = &button0;
    		mcuboot-button0 = &button0;
    		watchdog0 = &wdt0;
    		spi-flash0 = &w25q128jv;
    		accel0 = &lis2dh;
    		ext-flash = &w25q128jv;
    		uart-bridge = &uart1;
    		sht40 = &sht40;
    	};
    	soc {
    		#address-cells = < 0x1 >;
    		#size-cells = < 0x1 >;
    		compatible = "nordic,nrf9151-laca", "nordic,nrf9120", "nordic,nrf91", "simple-bus";
    		interrupt-parent = < &nvic >;
    		ranges;
    		nvic: interrupt-controller@e000e100 {
    			#address-cells = < 0x1 >;
    			compatible = "arm,v8m-nvic";
    			reg = < 0xe000e100 0xc00 >;
    			interrupt-controller;
    			#interrupt-cells = < 0x2 >;
    			arm,num-irq-priority-bits = < 0x3 >;
    			phandle = < 0x1 >;
    		};
    		systick: timer@e000e010 {
    			compatible = "arm,armv8m-systick";
    			reg = < 0xe000e010 0x10 >;
    			status = "disabled";
    		};
    		sram0: memory@20000000 {
    			compatible = "mmio-sram";
    			reg = < 0x20000000 0x40000 >;
    		};
    		peripheral@40000000 {
    			#address-cells = < 0x1 >;
    			#size-cells = < 0x1 >;
    			ranges = < 0x0 0x40000000 0x10000000 >;
    			flash_controller: flash-controller@39000 {
    				compatible = "nordic,nrf91-flash-controller";
    				reg = < 0x39000 0x1000 >;
    				partial-erase;
    				#address-cells = < 0x1 >;
    				#size-cells = < 0x1 >;
    				flash0: flash@0 {
    					compatible = "soc-nv-flash";
    					erase-block-size = < 0x1000 >;
    					write-block-size = < 0x4 >;
    					reg = < 0x0 0x100000 >;
    					partitions {
    						compatible = "fixed-partitions";
    						#address-cells = < 0x1 >;
    						#size-cells = < 0x1 >;
    						boot_partition: partition@0 {
    							label = "mcuboot";
    							reg = < 0x0 0x10000 >;
    						};
    						slot0_partition: partition@10000 {
    							label = "image-0";
    							reg = < 0x10000 0x40000 >;
    						};
    						slot0_ns_partition: partition@50000 {
    							label = "image-0-nonsecure";
    							reg = < 0x50000 0x35000 >;
    						};
    						slot1_partition: partition@85000 {
    							label = "image-1";
    							reg = < 0x85000 0x40000 >;
    						};
    						slot1_ns_partition: partition@c5000 {
    							label = "image-1-nonsecure";
    							reg = < 0xc5000 0x35000 >;
    						};
    						storage_partition: partition@fa000 {
    							label = "storage";
    							reg = < 0xfa000 0x6000 >;
    						};
    					};
    				};
    			};
    			adc: adc@e000 {
    				compatible = "nordic,nrf-saadc";
    				reg = < 0xe000 0x1000 >;
    				interrupts = < 0xe 0x1 >;
    				status = "okay";
    				#io-channel-cells = < 0x1 >;
    				zephyr,pm-device-runtime-auto;
    			};
    			dppic0: dppic: dppic@17000 {
    				compatible = "nordic,nrf-dppic";
    				reg = < 0x17000 0x1000 >;
    				status = "okay";
    			};
    			egu0: egu@1b000 {
    				compatible = "nordic,nrf-egu";
    				reg = < 0x1b000 0x1000 >;
    				interrupts = < 0x1b 0x1 >;
    				status = "okay";
    			};
    			egu1: egu@1c000 {
    				compatible = "nordic,nrf-egu";
    				reg = < 0x1c000 0x1000 >;
    				interrupts = < 0x1c 0x1 >;
    				status = "okay";
    			};
    			egu2: egu@1d000 {
    				compatible = "nordic,nrf-egu";
    				reg = < 0x1d000 0x1000 >;
    				interrupts = < 0x1d 0x1 >;
    				status = "okay";
    			};
    			egu3: egu@1e000 {
    				compatible = "nordic,nrf-egu";
    				reg = < 0x1e000 0x1000 >;
    				interrupts = < 0x1e 0x1 >;
    				status = "okay";
    			};
    			egu4: egu@1f000 {
    				compatible = "nordic,nrf-egu";
    				reg = < 0x1f000 0x1000 >;
    				interrupts = < 0x1f 0x1 >;
    				status = "okay";
    			};
    			egu5: egu@20000 {
    				compatible = "nordic,nrf-egu";
    				reg = < 0x20000 0x1000 >;
    				interrupts = < 0x20 0x1 >;
    				status = "okay";
    			};
    			ipc: ipc@2a000 {
    				compatible = "nordic,nrf-ipc";
    				reg = < 0x2a000 0x1000 >;
    				interrupts = < 0x2a 0x1 >;
    				status = "okay";
    			};
    			i2s0: i2s@28000 {
    				compatible = "nordic,nrf-i2s";
    				#address-cells = < 0x1 >;
    				#size-cells = < 0x0 >;
    				reg = < 0x28000 0x1000 >;
    				interrupts = < 0x28 0x1 >;
    				status = "disabled";
    			};
    			kmu: kmu@39000 {
    				compatible = "nordic,nrf-kmu";
    				reg = < 0x39000 0x1000 >;
    				interrupts = < 0x39 0x1 >;
    				status = "okay";
    			};
    			pdm0: pdm@26000 {
    				compatible = "nordic,nrf-pdm";
    				reg = < 0x26000 0x1000 >;
    				interrupts = < 0x26 0x1 >;
    				status = "disabled";
    			};
    			regulators: regulator@4000 {
    				compatible = "nordic,nrf91x-regulators";
    				reg = < 0x4000 0x1000 >;
    				status = "okay";
    			};
    			vmc: vmc@3a000 {
    				compatible = "nordic,nrf-vmc";
    				reg = < 0x3a000 0x1000 >;
    				status = "okay";
    			};
    			uart0: uart@8000 {
    				compatible = "nordic,nrf-uarte";
    				reg = < 0x8000 0x1000 >;
    				interrupts = < 0x8 0x1 >;
    				status = "okay";
    				current-speed = < 0x1c200 >;
    				pinctrl-0 = < &uart0_default >;
    				pinctrl-1 = < &uart0_sleep >;
    				pinctrl-names = "default", "sleep";
    			};
    			uart1: uart@9000 {
    				compatible = "nordic,nrf-uarte";
    				reg = < 0x9000 0x1000 >;
    				interrupts = < 0x9 0x1 >;
    				status = "okay";
    				current-speed = < 0x1c200 >;
    				pinctrl-0 = < &uart1_default >;
    				pinctrl-1 = < &uart1_sleep >;
    				pinctrl-names = "default", "sleep";
    			};
    			uart2: uart@a000 {
    				compatible = "nordic,nrf-uarte";
    				reg = < 0xa000 0x1000 >;
    				interrupts = < 0xa 0x1 >;
    				status = "disabled";
    			};
    			uart3: uart@b000 {
    				compatible = "nordic,nrf-uarte";
    				reg = < 0xb000 0x1000 >;
    				interrupts = < 0xb 0x1 >;
    				status = "disabled";
    			};
    			i2c0: i2c@8000 {
    				compatible = "nordic,nrf-twim";
    				#address-cells = < 0x1 >;
    				#size-cells = < 0x0 >;
    				reg = < 0x8000 0x1000 >;
    				interrupts = < 0x8 0x1 >;
    				easydma-maxcnt-bits = < 0xd >;
    				status = "disabled";
    				zephyr,pm-device-runtime-auto;
    			};
    			i2c1: i2c@9000 {
    				compatible = "nordic,nrf-twim";
    				#address-cells = < 0x1 >;
    				#size-cells = < 0x0 >;
    				reg = < 0x9000 0x1000 >;
    				interrupts = < 0x9 0x1 >;
    				easydma-maxcnt-bits = < 0xd >;
    				status = "disabled";
    				zephyr,pm-device-runtime-auto;
    			};
    			i2c2: i2c@a000 {
    				compatible = "nordic,nrf-twim";
    				#address-cells = < 0x1 >;
    				#size-cells = < 0x0 >;
    				reg = < 0xa000 0x1000 >;
    				interrupts = < 0xa 0x1 >;
    				easydma-maxcnt-bits = < 0xd >;
    				status = "okay";
    				zephyr,pm-device-runtime-auto;
    				pinctrl-0 = < &i2c2_default >;
    				pinctrl-1 = < &i2c2_sleep >;
    				pinctrl-names = "default", "sleep";
    				clock-frequency = < 0x61a80 >;
    				lis2dh: lis2dh@19 {
    					compatible = "st,lis2dh";
    					reg = < 0x19 >;
    					irq-gpios = < &gpio0 0x13 0x0 >, < &gpio0 0xc 0x0 >;
    				};
    				npm1300_pmic: pmic@6b {
    					compatible = "nordic,npm1300";
    					host-int-gpios = < &gpio0 0x8 0x0 >;
    					pmic-int-pin = < 0x1 >;
    					reg = < 0x6b >;
    					npm1300_gpio: gpio-controller {
    						compatible = "nordic,npm1300-gpio";
    						gpio-controller;
    						#gpio-cells = < 0x2 >;
    						ngpios = < 0x5 >;
    					};
    					npm1300_leds: leds {
    						compatible = "nordic,npm1300-led";
    						nordic,led0-mode = "host";
    						nordic,led1-mode = "host";
    						nordic,led2-mode = "host";
    					};
    					npm1300_charger: charger {
    						compatible = "nordic,npm1300-charger";
    						term-microvolt = < 0x3f52f0 >;
    						term-warm-microvolt = < 0x3d0900 >;
    						current-microamp = < 0xafc80 >;
    						dischg-limit-microamp = < 0xf4240 >;
    						vbus-limit-microamp = < 0xf4240 >;
    						thermistor-ohms = < 0x2710 >;
    						thermistor-beta = < 0xd34 >;
    						charging-enable;
    					};
    					npm1300_regulators: regulators {
    						compatible = "nordic,npm1300-regulator";
    						npm1300_buck1: BUCK1 {
    							regulator-min-microvolt = < 0x325aa0 >;
    							regulator-max-microvolt = < 0x325aa0 >;
    							regulator-always-on;
    						};
    						npm1300_buck2: BUCK2 {
    							regulator-min-microvolt = < 0x325aa0 >;
    							regulator-max-microvolt = < 0x325aa0 >;
    						};
    					};
    				};
    				sht40: sht40@44 {
    					compatible = "sensirion,sht4x";
    					reg = < 0x44 >;
    					repeatability = < 0x2 >;
    				};
    			};
    			i2c3: i2c@b000 {
    				compatible = "nordic,nrf-twim";
    				#address-cells = < 0x1 >;
    				#size-cells = < 0x0 >;
    				reg = < 0xb000 0x1000 >;
    				interrupts = < 0xb 0x1 >;
    				easydma-maxcnt-bits = < 0xd >;
    				status = "disabled";
    				zephyr,pm-device-runtime-auto;
    			};
    			spi0: spi@8000 {
    				compatible = "nordic,nrf-spim";
    				#address-cells = < 0x1 >;
    				#size-cells = < 0x0 >;
    				reg = < 0x8000 0x1000 >;
    				interrupts = < 0x8 0x1 >;
    				max-frequency = < 0x7a1200 >;
    				easydma-maxcnt-bits = < 0xd >;
    				status = "disabled";
    			};
    			spi1: spi@9000 {
    				compatible = "nordic,nrf-spim";
    				#address-cells = < 0x1 >;
    				#size-cells = < 0x0 >;
    				reg = < 0x9000 0x1000 >;
    				interrupts = < 0x9 0x1 >;
    				max-frequency = < 0x7a1200 >;
    				easydma-maxcnt-bits = < 0xd >;
    				status = "disabled";
    			};
    			spi2: spi@a000 {
    				compatible = "nordic,nrf-spim";
    				#address-cells = < 0x1 >;
    				#size-cells = < 0x0 >;
    				reg = < 0xa000 0x1000 >;
    				interrupts = < 0xa 0x1 >;
    				max-frequency = < 0x7a1200 >;
    				easydma-maxcnt-bits = < 0xd >;
    				status = "disabled";
    			};
    			spi3: spi@b000 {
    				compatible = "nordic,nrf-spim";
    				#address-cells = < 0x1 >;
    				#size-cells = < 0x0 >;
    				reg = < 0xb000 0x1000 >;
    				interrupts = < 0xb 0x1 >;
    				max-frequency = < 0x7a1200 >;
    				easydma-maxcnt-bits = < 0xd >;
    				status = "okay";
    				cs-gpios = < &gpio0 0x4 0x1 >;
    				pinctrl-0 = < &spi3_default >;
    				pinctrl-1 = < &spi3_sleep >;
    				pinctrl-names = "default", "sleep";
    				w25q128jv: w25q128jv@0 {
    					compatible = "jedec,spi-nor";
    					reg = < 0x0 >;
    					spi-max-frequency = < 0x7ed6b40 >;
    					size = < 0x1000000 >;
    					has-dpd;
    					t-enter-dpd = < 0x7530 >;
    					t-exit-dpd = < 0x7530 >;
    					jedec-id = [ EF 40 18 ];
    					partitions {
    						compatible = "fixed-partitions";
    						#address-cells = < 0x1 >;
    						#size-cells = < 0x1 >;
    						lfs_partition: partition@0 {
    							label = "lfs_partition";
    							reg = < 0x0 0xc00000 >;
    							phandle = < 0xf >;
    						};
    					};
    				};
    			};
    			pwm0: pwm@21000 {
    				compatible = "nordic,nrf-pwm";
    				reg = < 0x21000 0x1000 >;
    				interrupts = < 0x21 0x1 >;
    				status = "okay";
    				#pwm-cells = < 0x3 >;
    				pinctrl-0 = < &pwm0_default >;
    				pinctrl-1 = < &pwm0_sleep >;
    				pinctrl-names = "default", "sleep";
    			};
    			pwm1: pwm@22000 {
    				compatible = "nordic,nrf-pwm";
    				reg = < 0x22000 0x1000 >;
    				interrupts = < 0x22 0x1 >;
    				status = "disabled";
    				#pwm-cells = < 0x3 >;
    			};
    			pwm2: pwm@23000 {
    				compatible = "nordic,nrf-pwm";
    				reg = < 0x23000 0x1000 >;
    				interrupts = < 0x23 0x1 >;
    				status = "disabled";
    				#pwm-cells = < 0x3 >;
    			};
    			pwm3: pwm@24000 {
    				compatible = "nordic,nrf-pwm";
    				reg = < 0x24000 0x1000 >;
    				interrupts = < 0x24 0x1 >;
    				status = "disabled";
    				#pwm-cells = < 0x3 >;
    			};
    			gpio0: gpio@842500 {
    				compatible = "nordic,nrf-gpio";
    				gpio-controller;
    				reg = < 0x842500 0x300 >;
    				#gpio-cells = < 0x2 >;
    				status = "okay";
    				port = < 0x0 >;
    				gpiote-instance = < &gpiote >;
    				sense-edge-mask = < 0xffff >;
    				phandle = < 0x8 >;
    			};
    			rtc0: rtc@14000 {
    				compatible = "nordic,nrf-rtc";
    				reg = < 0x14000 0x1000 >;
    				cc-num = < 0x4 >;
    				interrupts = < 0x14 0x1 >;
    				status = "disabled";
    				clock-frequency = < 0x8000 >;
    				prescaler = < 0x1 >;
    			};
    			rtc1: rtc@15000 {
    				compatible = "nordic,nrf-rtc";
    				reg = < 0x15000 0x1000 >;
    				cc-num = < 0x4 >;
    				interrupts = < 0x15 0x1 >;
    				status = "disabled";
    				clock-frequency = < 0x8000 >;
    				prescaler = < 0x1 >;
    			};
    			clock: clock@5000 {
    				compatible = "nordic,nrf-clock";
    				reg = < 0x5000 0x1000 >;
    				interrupts = < 0x5 0x1 >;
    				status = "okay";
    			};
    			power: power@5000 {
    				compatible = "nordic,nrf-power";
    				reg = < 0x5000 0x1000 >;
    				ranges = < 0x0 0x5000 0x1000 >;
    				interrupts = < 0x5 0x1 >;
    				status = "okay";
    				#address-cells = < 0x1 >;
    				#size-cells = < 0x1 >;
    				gpregret1: gpregret1@51c {
    					#address-cells = < 0x1 >;
    					#size-cells = < 0x1 >;
    					compatible = "nordic,nrf-gpregret";
    					reg = < 0x51c 0x1 >;
    					status = "okay";
    				};
    				gpregret2: gpregret2@520 {
    					#address-cells = < 0x1 >;
    					#size-cells = < 0x1 >;
    					compatible = "nordic,nrf-gpregret";
    					reg = < 0x520 0x1 >;
    					status = "okay";
    				};
    			};
    			wdt: wdt0: watchdog@18000 {
    				compatible = "nordic,nrf-wdt";
    				reg = < 0x18000 0x1000 >;
    				interrupts = < 0x18 0x1 >;
    				status = "okay";
    			};
    			timer0: timer@f000 {
    				compatible = "nordic,nrf-timer";
    				status = "disabled";
    				reg = < 0xf000 0x1000 >;
    				cc-num = < 0x6 >;
    				max-bit-width = < 0x20 >;
    				interrupts = < 0xf 0x1 >;
    				prescaler = < 0x0 >;
    			};
    			timer1: timer@10000 {
    				compatible = "nordic,nrf-timer";
    				status = "disabled";
    				reg = < 0x10000 0x1000 >;
    				cc-num = < 0x6 >;
    				max-bit-width = < 0x20 >;
    				interrupts = < 0x10 0x1 >;
    				prescaler = < 0x0 >;
    				phandle = < 0xe >;
    			};
    			timer2: timer@11000 {
    				compatible = "nordic,nrf-timer";
    				status = "disabled";
    				reg = < 0x11000 0x1000 >;
    				cc-num = < 0x6 >;
    				max-bit-width = < 0x20 >;
    				interrupts = < 0x11 0x1 >;
    				prescaler = < 0x0 >;
    			};
    		};
    		gpiote: gpiote1: gpiote@40031000 {
    			compatible = "nordic,nrf-gpiote";
    			reg = < 0x40031000 0x1000 >;
    			interrupts = < 0x31 0x5 >;
    			status = "okay";
    			instance = < 0x1 >;
    			phandle = < 0xd >;
    		};
    	};
    	pinctrl: pin-controller {
    		compatible = "nordic,nrf-pinctrl";
    		uart0_default: uart0_default {
    			phandle = < 0x2 >;
    			group1 {
    				psels = < 0xb >, < 0x100000a >;
    			};
    		};
    		uart0_sleep: uart0_sleep {
    			phandle = < 0x3 >;
    			group1 {
    				psels = < 0xb >, < 0x100000a >;
    				low-power-enable;
    			};
    		};
    		uart1_default: uart1_default {
    			phandle = < 0x4 >;
    			group1 {
    				psels = < 0x18 >, < 0x1000017 >;
    			};
    		};
    		uart1_sleep: uart1_sleep {
    			phandle = < 0x5 >;
    			group1 {
    				psels = < 0x18 >, < 0x1000017 >;
    				low-power-enable;
    			};
    		};
    		i2c2_default: i2c2_default {
    			phandle = < 0x6 >;
    			group1 {
    				psels = < 0xc000002 >, < 0xb000001 >;
    			};
    		};
    		i2c2_sleep: i2c2_sleep {
    			phandle = < 0x7 >;
    			group1 {
    				psels = < 0xc000002 >, < 0xb000001 >;
    				low-power-enable;
    			};
    		};
    		pwm0_default: pwm0_default {
    			phandle = < 0xb >;
    			group1 {
    				psels = < 0x16000019 >;
    			};
    		};
    		pwm0_sleep: pwm0_sleep {
    			phandle = < 0xc >;
    			group1 {
    				psels = < 0x16000019 >;
    				low-power-enable;
    			};
    		};
    		spi3_default: spi3_default {
    			phandle = < 0x9 >;
    			group1 {
    				psels = < 0x4000006 >, < 0x5000007 >, < 0x6000005 >;
    			};
    		};
    		spi3_sleep: spi3_sleep {
    			phandle = < 0xa >;
    			group1 {
    				psels = < 0x4000006 >, < 0x5000007 >, < 0x6000005 >;
    				low-power-enable;
    			};
    		};
    	};
    	rng_hci: entropy_bt_hci {
    		compatible = "zephyr,bt-hci-entropy";
    		status = "okay";
    	};
    	sw_pwm: sw-pwm {
    		compatible = "nordic,nrf-sw-pwm";
    		status = "disabled";
    		generator = < &timer1 >;
    		clock-prescaler = < 0x0 >;
    		#pwm-cells = < 0x3 >;
    	};
    	cpus {
    		#address-cells = < 0x1 >;
    		#size-cells = < 0x0 >;
    		cpu@0 {
    			device_type = "cpu";
    			compatible = "arm,cortex-m33f";
    			reg = < 0x0 >;
    			#address-cells = < 0x1 >;
    			#size-cells = < 0x1 >;
    			mpu: mpu@e000ed90 {
    				compatible = "arm,armv8m-mpu";
    				reg = < 0xe000ed90 0x40 >;
    			};
    		};
    	};
    	psa_rng: psa-rng {
    		compatible = "zephyr,psa-crypto-rng";
    		status = "okay";
    	};
    	buttons {
    		compatible = "gpio-keys";
    		button0: button_0 {
    			gpios = < &gpio0 0x3 0x0 >;
    			label = "Switch 1";
    			zephyr,code = < 0xb >;
    		};
    	};
    	fstab {
    		compatible = "zephyr,fstab";
    		lfs: lfs {
    			compatible = "zephyr,fstab,littlefs";
    			mount-point = "/lfs";
    			partition = < &lfs_partition >;
    			read-size = < 0x10 >;
    			prog-size = < 0x10 >;
    			cache-size = < 0x40 >;
    			lookahead-size = < 0x20 >;
    			block-cycles = < 0x200 >;
    			automount;
    		};
    	};
    	reserved-memory {
    		#address-cells = < 0x1 >;
    		#size-cells = < 0x1 >;
    		ranges;
    		sram0_s: image_s@20000000 {
    			reg = < 0x20000000 0x16000 >;
    		};
    		sram0_modem: image_modem@20016000 {
    			reg = < 0x20016000 0xa000 >;
    		};
    		sram0_ns: image_ns@20020000 {
    			reg = < 0x20020000 0x20000 >;
    		};
    	};
    };
    
    
    
    
    this is my overlay
    
    / {
        aliases {
            uart-bridge = &uart1;
            sht40 = &sht40;
        };
    };
    
    &uart1 {
        status = "okay";
        current-speed = <115200>;
    };
    
    
    &i2c2 {
        compatible = "nordic,nrf-twim";
        status = "okay";
        clock-frequency = <I2C_BITRATE_FAST>;
        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";
            };
    
            npm1300_regulators: regulators {
                compatible = "nordic,npm1300-regulator";
                npm1300_buck1: BUCK1 {
                    regulator-min-microvolt = <0x325aa0>;
                    regulator-max-microvolt = <0x325aa0>;
                    regulator-always-on;
                };
                npm1300_buck2: BUCK2 {
                    regulator-min-microvolt = <0x325aa0>;
                    regulator-max-microvolt = <0x325aa0>;
                };
            };
        };
    
        sht40: sht40@44 {
            compatible = "sensirion,sht4x";
            reg = <0x44>;
            repeatability = <2>;
        };
    };
    
    
    

  • Thanks. The overlay looks fine from what I can see. Can I also get the relevant parts of the prj.conf?
    I'm also wondering the following:
    1. is there any warnings in build log when you build your application?

    2. Can you verify the sensor is in the generated_devicetree file found in your build folder?

    3. If  possible check the lines with a logic analyzer, is there any traffic from the sensor? 
    Regards

    Runar

  • Hi,
    3223.Session 0.sal

    The attached file is the logic analyser session file in this i am not geting any traffic from SHT40 sensor but i am able to get data from LIS2dh and npm1300 you can see.

    This is my prj.conf file

    #
    # prj.conf — nRF9151 Feather IoT Lock Application
    #

    # ── General ───────────────────────────────────────────────────────────────────
    CONFIG_ASSERT=y
    CONFIG_REBOOT=y
    CONFIG_GRIT_FW_VERSION="1.0.0"

    # ── Logging ───────────────────────────────────────────────────────────────────
    CONFIG_LOG=y
    CONFIG_LOG_MODE_DEFERRED=y
    CONFIG_STDOUT_CONSOLE=y
    CONFIG_UART_INTERRUPT_DRIVEN=y
    CONFIG_LOG_BUFFER_SIZE=4096

    # ── Modem ─────────────────────────────────────────────────────────────────────
    CONFIG_NRF_MODEM_LIB=y
    CONFIG_MODEM_INFO=y
    CONFIG_MODEM_INFO_ADD_NETWORK=y

    # ── LTE Link Controller ───────────────────────────────────────────────────────
    CONFIG_LTE_LINK_CONTROL=y
    CONFIG_LTE_MODE_PREFERENCE_LTE_M=y
    CONFIG_LTE_LC_PSM_MODULE=y
    CONFIG_LTE_PSM_REQ=y
    CONFIG_LTE_LC_EDRX_MODULE=y

    # ── GNSS ──────────────────────────────────────────────────────────────────────
    CONFIG_GNSS=y
    CONFIG_FPU=y

    # ── Antenna / Coexistence ─────────────────────────────────────────────────────
    CONFIG_MODEM_ANTENNA=y
    CONFIG_MODEM_ANTENNA_AT_MAGPIO=""
    CONFIG_MODEM_ANTENNA_AT_COEX0="AT%XCOEX0=1,1,1574,1577"

    # ── Networking ────────────────────────────────────────────────────────────────
    CONFIG_NETWORKING=y
    CONFIG_NET_NATIVE=n
    CONFIG_NET_SOCKETS=y
    CONFIG_NET_SOCKETS_OFFLOAD=y
    CONFIG_NET_IPV4=y
    CONFIG_NET_IPV6=y
    CONFIG_NET_TCP=y
    CONFIG_PDN=y

    # ── MQTT (TLS on port 8883) ───────────────────────────────────────────────────
    CONFIG_MQTT_HELPER=y
    CONFIG_MQTT_CLEAN_SESSION=y
    CONFIG_MQTT_KEEPALIVE=60
    CONFIG_MQTT_HELPER_RX_TX_BUFFER_SIZE=2048
    CONFIG_MQTT_HELPER_PAYLOAD_BUFFER_LEN=1024
    CONFIG_MQTT_HELPER_SEC_TAG=1
    CONFIG_MQTT_LIB=y
    CONFIG_MQTT_LIB_TLS=y

    CONFIG_MODEM_KEY_MGMT=y

    # ── FOTA / Firmware Over The Air ──────────────────────────────────────────────
    # NCS v2.7: FOTA_DOWNLOAD depends on DOWNLOADER (not DOWNLOAD_CLIENT).
    # DOWNLOAD_CLIENT is the older deprecated API; DOWNLOADER is the replacement.
    CONFIG_DOWNLOADER=y
    CONFIG_DOWNLOADER_STACK_SIZE=4096
    CONFIG_FOTA_DOWNLOAD=y
    CONFIG_FOTA_DOWNLOAD_PROGRESS_EVT=y
    CONFIG_DFU_TARGET=y
    CONFIG_DFU_TARGET_MCUBOOT=y
    CONFIG_IMG_MANAGER=y
    CONFIG_BOOTLOADER_MCUBOOT=y
    # TLS for HTTPS firmware download uses the same CA cert tag as MQTT (tag 1).
    # To use a separate tag, set CONFIG_DOWNLOADER_TLS_SESSION_CACHE_ENTRIES and
    # pass the tag number directly to fota_download_start() in transport.c.

    # ── Hardware ID (IMEI as MQTT client ID) ──────────────────────────────────────
    CONFIG_HW_ID_LIBRARY=y
    CONFIG_HW_ID_LIBRARY_SOURCE_IMEI=y

    # ── ZBus ─────────────────────────────────────────────────────────────────────
    CONFIG_ZBUS=y

    # ── State Machine Framework ───────────────────────────────────────────────────
    CONFIG_SMF=y

    # ── Math library ──────────────────────────────────────────────────────────────
    CONFIG_NEWLIB_LIBC=y
    CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y

    # ── GPIO ──────────────────────────────────────────────────────────────────────
    CONFIG_GPIO=y
    CONFIG_GPIO_NRFX=y
    # ── I2C ───────────────────────────────────────────────────────────────────────
    CONFIG_I2C=y
    CONFIG_SENSOR=y

    # ── Accelerometer — LIS2DH12 on I2C2 (SCL=P0.01 SDA=P0.02) ──────────────────
    # INT1=P0.20 (shock/tamper)
    CONFIG_LIS2DH=y
    # Disable driver-managed trigger — we handle INT1 via raw GPIO ISR
    # (accel_int1_handler in sensors.c) and submit a k_work item.
    # Enabling TRIGGER_GLOBAL_THREAD here AND gpio_add_callback() on the
    # same pin causes double-firing of tamper events.
    CONFIG_LIS2DH_TRIGGER_NONE=y

    # ── npm1300 PMIC / Charger / Fuel gauge ───────────────────────────────────────
    # npm1300 charger exposes SENSOR_CHAN_GAUGE_VOLTAGE + GAUGE_STATE_OF_CHARGE.
    # Correct channel is SENSOR_CHAN_GAUGE_VOLTAGE (not SENSOR_CHAN_VOLTAGE).
    # CONFIG_REGULATOR=y is needed so the MFD subsystem fully initialises npm1300.
    CONFIG_MFD_NPM1300=y
    CONFIG_REGULATOR=y
    CONFIG_REGULATOR_NPM1300=y
    CONFIG_NPM1300_CHARGER=y
    # ── NVS — Non-Volatile Storage for event log persistence ─────────────────────
    CONFIG_NVS=y
    CONFIG_FLASH=y
    CONFIG_FLASH_PAGE_LAYOUT=y
    CONFIG_FLASH_MAP=y
    CONFIG_STREAM_FLASH=y

    # ── UART (nRF54L15 BLE bridge) ────────────────────────────────────────────────
    # uart3 pins (P0.26 TX / P0.27 RX) and sleep state already defined in board DTS.
    CONFIG_UART_BRIDGE_DEV="UART_3"

    # ── Memory ────────────────────────────────────────────────────────────────────
    CONFIG_HEAP_MEM_POOL_SIZE=57344
    CONFIG_MAIN_STACK_SIZE=4096
    CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096
    CONFIG_SYSTEM_WORKQUEUE_PRIORITY=5

    # ── AT monitor ────────────────────────────────────────────────────────────────
    CONFIG_AT_MONITOR=y
    CONFIG_AT_MONITOR_HEAP_SIZE=1024

    # ── APN ───────────────────────────────────────────────────────────────────────
    CONFIG_PDN_DEFAULTS_OVERRIDE=y
    CONFIG_PDN_DEFAULT_APN="airtelgprs.com"

    # ── Application config ────────────────────────────────────────────────────────
    CONFIG_TRIGGER_INTERVAL_S=30
    CONFIG_MQTT_BROKER_HOSTNAME="your-mqtt-broker.example.com"
    CONFIG_MQTT_BROKER_PORT=8883

    # ── Boot banner ───────────────────────────────────────────────────────────────
    CONFIG_BOOT_BANNER=n
    CONFIG_NCS_BOOT_BANNER=n

    # ── Memory diagnostics ────────────────────────────────────────────────────────
    CONFIG_THREAD_STACK_INFO=y
    CONFIG_THREAD_MONITOR=y
    CONFIG_THREAD_NAME=y
    CONFIG_SYS_HEAP_RUNTIME_STATS=y
    CONFIG_THREAD_ANALYZER=y

    # ── SHT40 Temperature & Humidity Sensor ──────────────────────────────────────
    CONFIG_SHT4X=y

    # Disable TF-M logging completely
    CONFIG_TFM_LOG_LEVEL_SILENCE=y





    this the device tree generated in build folder

                i2c2: i2c@a000 {
                    compatible = "nordic,nrf-twim";
                    #address-cells = < 0x1 >;
                    #size-cells = < 0x0 >;
                    reg = < 0xa000 0x1000 >;
                    interrupts = < 0xa 0x1 >;
                    easydma-maxcnt-bits = < 0xd >;
                    status = "okay";
                    zephyr,pm-device-runtime-auto;
                    pinctrl-0 = < &i2c2_default >;
                    pinctrl-1 = < &i2c2_sleep >;
                    pinctrl-names = "default", "sleep";
                    clock-frequency = < 0x61a80 >;
                    lis2dh: lis2dh@19 {
                        compatible = "st,lis2dh";
                        reg = < 0x19 >;
                        irq-gpios = < &gpio0 0x13 0x0 >, < &gpio0 0xc 0x0 >;
                    };
                    npm1300_pmic: pmic@6b {
                        compatible = "nordic,npm1300";
                        host-int-gpios = < &gpio0 0x8 0x0 >;
                        pmic-int-pin = < 0x1 >;
                        reg = < 0x6b >;
                        npm1300_gpio: gpio-controller {
                            compatible = "nordic,npm1300-gpio";
                            gpio-controller;
                            #gpio-cells = < 0x2 >;
                            ngpios = < 0x5 >;
                        };
                        npm1300_leds: leds {
                            compatible = "nordic,npm1300-led";
                            nordic,led0-mode = "host";
                            nordic,led1-mode = "host";
                            nordic,led2-mode = "host";
                        };
                        npm1300_charger: charger {
                            compatible = "nordic,npm1300-charger";
                            term-microvolt = < 0x3f52f0 >;
                            term-warm-microvolt = < 0x3d0900 >;
                            current-microamp = < 0xafc80 >;
                            dischg-limit-microamp = < 0xf4240 >;
                            vbus-limit-microamp = < 0xf4240 >;
                            thermistor-ohms = < 0x2710 >;
                            thermistor-beta = < 0xd34 >;
                            charging-enable;
                        };
                        npm1300_regulators: regulators {
                            compatible = "nordic,npm1300-regulator";
                            npm1300_buck1: BUCK1 {
                                regulator-min-microvolt = < 0x325aa0 >;
                                regulator-max-microvolt = < 0x325aa0 >;
                                regulator-always-on;
                            };
                            npm1300_buck2: BUCK2 {
                                regulator-min-microvolt = < 0x325aa0 >;
                                regulator-max-microvolt = < 0x325aa0 >;
                            };
                        };
                    };
                    sht40: sht40@44 {
                        compatible = "sensirion,sht4x";
                        reg = < 0x44 >;
                        repeatability = < 0x2 >;
                    };
                };


    I have also tested using BMA456 attached to the same I2C pins, but this also did not work. The voltage on the scl and sda pins is 3.3V. I have tested using a multimeter.
  • I can't see anything in your configs. Can you show me the wiring diagram and verify the voltage on the sensor?What board target are you using?
    Regards

    Runar

Reply Children
No Data
Related