Skip to main content
Vbala.1
Associate II
March 25, 2025
Question

Intefacing stmvl53l8cx with Cypress Cx3 controller

  • March 25, 2025
  • 1 reply
  • 616 views

Hi @John E KVAM ,

I am planning to interface stmvl53l8cx with cypress cx3 controller. I did not find any Register Reference for it to access the TOF registers. Instead I find  en.STSW-IMG042.zip SDK for raspberry pi . Should I port this SDK to my microcontroller ? Is there any protocol document for communicating with the MCU inside stmvl53l8cx ?

 

Can I have a simpler c program for communicating with the MCU inside stmvl53l8cx , instead of having kernel and user space layers ?

 

Regards,

Vikaash.K.B

1 reply

John E KVAM
ST Employee
March 25, 2025

The VL53L8CX is a pretty complex sensor. During the Init phase, the host downloads some 80K of firmware. So creating a driver much smaller than the ones we supply is not realistic. 

We have two Linux drivers. The kernel driver is for those designs where normal users simply cannot be granted access to the I2C bus. (Think cell phones. One simply cannot allow downloadable apps access to the eeproms and other stuff connected to the I2C bus.) In this arrangement the application asks the kernel to access the I2c bus and return the result. 

But if your project does not involve downloadable apps, the User-level driver is easier to use. In this driver, the user code simply communicates with the sensor over I2C direct reads and writes. 

please note that one uses either the kernel code or the user code. You don't need both. 

I'd start with the ST driver you choose and get your project running. I'm pretty sure that code is about as efficient as we can make it. 

- john

 

Vbala.1
Vbala.1Author
Associate II
March 26, 2025

Hi @John E KVAM ,

Thank you very much for your response.

I am not asking to optimize the existing code. I am seeking your help to get a similar SDK for cypress cx3 controller.

So, I have to port the user-level code( user/examples/Example_1_ranging_basic.c ) to cypress cx3 firmware.Is my understanding correct ?

 

Regards,

Vikaash.K.B

John E KVAM
ST Employee
March 26, 2025

The user code by ST is written in 'c' and is reasonably straight forward. Your effort consists in ensuring the code in the file platform.c works for you. 

Big endian vs Little endian can be an issue. But there is a good chance it just works. 

Take our package. 

run the makefile and see if runs. There's a good chance it will. 

Then evaluate the dozen or so examples and see which one is closest to your application. 

Modify that as you like.

Have a look at platform.h. 

The sensor is capable of sending potentially lots of data. You can cut that down by uncommenting some of the following:

// #define VL53L8CX_DISABLE_AMBIENT_PER_SPAD
// #define VL53L8CX_DISABLE_NB_SPADS_ENABLED
// #define VL53L8CX_DISABLE_NB_TARGET_DETECTED
// #define VL53L8CX_DISABLE_SIGNAL_PER_SPAD
// #define VL53L8CX_DISABLE_RANGE_SIGMA_MM
// #define VL53L8CX_DISABLE_DISTANCE_MM
// #define VL53L8CX_DISABLE_REFLECTANCE_PERCENT
// #define VL53L8CX_DISABLE_TARGET_STATUS
// #define VL53L8CX_DISABLE_MOTION_INDICATOR

 

You need status, distance, and number of targets. Signal is nice to have, but the others are optional. 

Just try it.