We are trying to integrate an ST VL53L8CX ToF (Time-of-Flight) sensor over SPI on an NXP i.MX8MP LPDDR4 EVK using Yocto Linux.
The objective is initially to achieve basic SPI communication and successfully detect the VL53L8CX device from a custom Linux kernel driver. Full ranging functionality is not required at this stage.
The device-tree configuration currently uses:
&ecspi2 {
pinctrl-0 = <&pinctrl_ecspi2 &pinctrl_ecspi2_cs>;
cs-gpios = <&gpio5 13 GPIO_ACTIVE_LOW>;
status = "okay";
stmvl53l8cx: spi@0 {
reg = <0>;
compatible = "st,stmvl53l8cx";
spi-max-frequency = <1000000>;
};
};The SPI device is successfully created:
root@imx8mp-lpddr4-evk:~# ls -l /sys/bus/spi/devices/
spi0.0
spi1.0The custom driver is also registered:
root@imx8mp-lpddr4-evk:~# ls -l /sys/bus/spi/drivers/
stmvl53l8cxThe driver probe() function is being called successfully.
Could someone please advise what we should verify on the i.MX8MP EVK ECSPI2/J21 hardware and Device Tree configuration to make sure the VL53L8CX is communicating correctly over SPI?
In particular, we would like to confirm:
We have also attached our custom driver.c driver and kernel logs for reference.
Any guidance on the correct i.MX8MP EVK + J21 + ECSPI2 + VL53L8CX SPI configuration would be appreciated.
I have attached custom driver file driver.c
also I have attached logs
Thank you.
Hello @Manuel_Salas
Thank you for your response.
We tried reading the device ID before proceeding with any further configuration. However, we are not able to read the device ID successfully.
Our SPI driver is probing correctly, but the register read for the chip ID does not return the expected value. Because of this, we are unable to verify communication with the VL53L8CX and cannot proceed with the sensor initialization.
We are currently checking our SPI configuration, device tree, and hardware connections to identify the issue.
We will also attach our driver, logs and module image so you can review it. If you have any suggestions on what else we should verify for basic SPI communication with the VL53L8CX, we would greatly appreciate your guidance.
Best regards,
yogi96
Hello @yogi96
Hope you are doing very well.
In general, all your steps looks good.
The next step what yocan try is read any register of the sensor, for example, in your probe() function, read the ID from the chip.
If ID is correct read, continue with the configuration.
Also, I could not saw the driver attached.
Please attach is possible.
Best regards,
Salas.