Support – VL53L8CX SPI Linux Driver Integration on NXP i.MX8MP EVK
- 0 replies
- 27 views
Hello Team,
I am integrating the VL53L8CX ToF sensor over SPI with an NXP i.MX8MP LPDDR4 EVK running Yocto Linux with kernel 6.18.20.
I have created a Linux SPI driver based on the VL53L8CX communication requirements and added the sensor as an SPI device through the Device Tree.
The SPI bus itself appears to be configured correctly, and the driver is being loaded. However, I am currently unable to successfully read the VL53L8CX device ID/registers from the sensor.
Hardware:
- NXP i.MX8MP LPDDR4 EVK
- VL53L8CX sensor/module
- SPI interface
- SPI controller: ECSPI2
- Chip Select: GPIO5_IO13
- SPI device:
spi1.0
Device Tree configuration:
&ecspi2 {
#address-cells = <1>;
#size-cells = <0>;
pinctrl-0 = <&pinctrl_ecspi2 &pinctrl_ecspi2_cs>;
cs-gpios = <&gpio5 13 GPIO_ACTIVE_LOW>;
status = "okay";
vl53l8cx@0 {
compatible = "st,stmvl53l8cx";
reg = <0>;
spi-max-frequency = <1000000>;
};
};The driver is successfully loaded and the SPI device is visible as:
/sys/bus/spi/devices/spi1.0The modalias is:
spi:stmvl53l8cxHowever, the sensor does not return the expected device ID when I try to read its registers.
According to the VL53L8CX documentation, the device ID register is 0x0000 and the expected device ID is 0xF0. The register access also requires the appropriate SPI read/write bit handling and register page selection.
I would appreciate your assistance with the following:
- Could you please provide or point me to the official/latest Linux SPI driver for VL53L8CX?
- Could you confirm the correct SPI register read/write sequence for VL53L8CX?
- Could you provide a minimal example of reading the device ID (
0x0000) over SPI? - Are there any required initialization steps, delays, LPn/RESET handling, or GPIO configuration that must be performed before the first SPI register access?
- Could you review the attached driver source and logs and let me know if there is anything incorrect in my SPI implementation?
I have attached the following for reference:
- Current VL53L8CX Linux driver source
- Device Tree configuration
- Kernel logs (
dmesg) - VL53L8CX module purchase/reference link - https://robu.in/product/vl53l8cx-laser-ranging-module-vl53l8-cover-film/
This issue is currently blocking the SPI integration, so any guidance regarding the correct low-level SPI communication sequence would be greatly appreciated.I have attached logs module link and driver file
Thank you for your support.
Best regards,
Yogiraj
