i2c not detecting sht85 sensor

Hello everyone! :)

I'm having trouble detecting the sht85 sensor using the nrf9151dk. The wiring is good, since I tried connecting the sensor to the Arduino Uno and it works without a problem, however, with the nrf the sensor address is not detected at all.

I tried the same implementation for the bmp180 sensor, and the nrf detected it correctly and was able to get the measurement data.

I leave you my .overlay file as well as a simple main which tries to scan the addresses.

Thanks!

&i2c2 {
    compatible = "nordic,nrf-twim";
    status = "okay";
    clock-frequency = <I2C_BITRATE_STANDARD>;

    sht85: sht85@44 {  
        compatible = "i2c-device";
        reg = < 0x44 >;
        label = "SHT85";
    };
};



#include <zephyr/kernel.h>
#include "sensors/bmp180/bmp180.h"
#include <zephyr/logging/log.h>
#include "sensors/sht85/sht85.h"

LOG_MODULE_REGISTER(MAIN, LOG_LEVEL_INF);
#define I2C_NODE DT_NODELABEL(sht85)

static void i2c_scan(const struct device *dev) {
    for (uint8_t i = 1; i < 127; i++) {
        uint8_t tx_buffer = 0;
        int ret = i2c_write(dev, &tx_buffer, sizeof(tx_buffer), i);
        if (ret == 0) {
            printk("I2C device found at address 0x%02X\n", i);
        }
    }
}
int main(void) {

    static const struct i2c_dt_spec dev_i2c = I2C_DT_SPEC_GET(I2C_NODE);
    // const struct device *i2c_dev = DEVICE_DT_GET(DT_NODELABEL(i2c2));

    if (!device_is_ready(dev_i2c.bus)) {
        printk("I2C bus %s is not ready!\n", dev_i2c.bus->name);
        return -1;
    }

    i2c_scan(dev_i2c.bus);
 
    return 1;
}
Parents Reply Children
No Data
Related