Skip to main content
Visitor II
September 29, 2026
Question

Support – VL53L8CX SPI Linux Driver Integration on NXP i.MX8MP EVK

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.0

The modalias is:

spi:stmvl53l8cx

However, 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:

  1. Could you please provide or point me to the official/latest Linux SPI driver for VL53L8CX?
  2. Could you confirm the correct SPI register read/write sequence for VL53L8CX?
  3. Could you provide a minimal example of reading the device ID (0x0000) over SPI?
  4. Are there any required initialization steps, delays, LPn/RESET handling, or GPIO configuration that must be performed before the first SPI register access?
  5. 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:

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

    ST Technical Moderator
    October 13, 2026

    Hi:

    Here is a link STSW-IMG042 | Product - STMicroelectronics that is VL53L8CX official Linux driver guide for I2C and SPI. But it’s based on Raspberry Pi. it supplies 2 compilation methods: user space and kernel. I have tried several times before and both works well.

    As I am not familiar with the NXP platform, but I believe that porting this Linux driver to NXP is feasible, just follow the steps.

    Hope to hear good news from your side.

    Best Regards,

    Bin FAN

     

     

    In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.