VL53L3X interfacing problem with nrf52832

Hii , I am interfacing VL53L3X sensor with the nrf52832 , and using its given liberary which is in zephyr  for VL53L0X , as I think it should we work with also my sensor VL53L3x , I use the given liberary and connect my device and check on the logic analyser the graph is generated , its means the I2C communication is stabelist , but I got error  device not ready. ,


if any one done this interfacing give me the idea  or details,

This is my code which i am using 

main.c

/*
 * Copyright (c) 2017 STMicroelectronics
 *
 * SPDX-License-Identifier: Apache-2.0
 */

#include <zephyr/kernel.h>
#include <zephyr/device.h>
#include <zephyr/drivers/sensor.h>
#include <stdio.h>
#include <zephyr/sys/printk.h>
#include <zephyr/drivers/i2c.h>

#define I2C0_NODE DT_NODELABEL(st_vl53l0x)
int main(void)
{
    const struct device *const dev = DEVICE_DT_GET_ANY(st_vl53l0x);
    struct sensor_value value;
    int ret;

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

    while (1) {
        ret = sensor_sample_fetch(dev);
        if (ret) {
            printk("sensor_sample_fetch failed ret %d\n", ret);
            return 0;
        }

        ret = sensor_channel_get(dev, SENSOR_CHAN_PROX, &value);
        printk("prox is %d\n", value.val1);

        ret = sensor_channel_get(dev,
                     SENSOR_CHAN_DISTANCE,
                     &value);
        printf("distance is %.3fm\n", sensor_value_to_double(&value));

        k_sleep(K_MSEC(1000));
    }
    return 0;
}




.overlay

&pinctrl {
    i2c0_default: i2c0_default {
        group1 {

            psels = <NRF_PSEL(TWIM_SDA, 0, 26)>,
                    <NRF_PSEL(TWIM_SCL, 0, 27)>;
        };
    };

    i2c0_sleep: i2c0_sleep {
        group1 {

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

};

&i2c0 {
    compatible = "nordic,nrf-twim";
    status = "okay";
    clock-frequency = <I2C_BITRATE_FAST>;
    zephyr,concat-buf-size = <4096>;

    vl53l0x: vl53l0x@29 {
        compatible = "st,vl53l0x";
        reg = <0x29>;
        label = "VL53L3CX";
    };

};


.prj

CONFIG_STDOUT_CONSOLE=y
CONFIG_I2C=y
CONFIG_GPIO=y
CONFIG_SENSOR=y
CONFIG_VL53L0X_PROXIMITY_THRESHOLD=100
CONFIG_PRINTK=y
#debug
#CONFIG_DEBUG=y
#CONFIG_LOG=y
#CONFIG_SENSOR_LOG_LEVEL_DBG=y
CONFIG_CBPRINTF_FP_SUPPORT=y

 

Parents Reply Children
No Data
Related