Skip to main content
Associate
July 9, 2023
Solved

VL53L8xx SPI & daisy-chain support

  • July 9, 2023
  • 2 replies
  • 2394 views

Hi!

I’d like to know if the Vl53L8xx product series support “SPI daisy-chaining” ?

For a project, I’ll need few of those, either “straight” along a line segment ( +/- like Neonode’s ZForce sensor bar ), as a “grid”, or as an “arc section” ( that is, a curved line segment ), and I’d like to maximize speed while minimize the needed pins to control the whole set of n sensors.

Regarding my choice among the whole “VL53L” product lineup, it seems it’s the only one that supports SPI, which is one of the main needs for the project, the others being the smallest amount of processing needed on the “controller” uC, and a precise-enough detection of multiplemfingers up to 10cm from the sensor in a reliable manner.

From what I can read in the datasheet, it does some “auto-incrementing” stuff when begin given more than the expected 15+8 bits, which may get in the way or even prevent some tricks I had in mind totally ( I guess, wrongly ? )

This being said, I could also be cool repurposing the GPIO1 of other VL53Lxx sensors to control the next chain sensor’s xshut pin to give them different I2C addresses, but SPI and daisy-chain would be top (..)

Looking forward to reading from interested individual(s) :)

Best answer by John E KVAM

you are right that the L8 is the only one that supports the SPI.

And unfortunately SPI daisy-chaining is not supported.

Although the datasheet calls that GPIO1 that pin is dedicated for something else.

Sorry about that.

 

2 replies

John E KVAM
John E KVAMBest answer
ST Employee
July 12, 2023

you are right that the L8 is the only one that supports the SPI.

And unfortunately SPI daisy-chaining is not supported.

Although the datasheet calls that GPIO1 that pin is dedicated for something else.

Sorry about that.

 

Associate
November 25, 2023

Dear John,

I have tried to use SPI and converted I2C platform to SPI platform but I stopped on "WrMulti" function

 

int8_t WrMulti(
		VL53L7CX_Platform *p_platform,
		uint16_t RegisterAdress,
		uint8_t *p_values,
		uint32_t size)
{
	uint8_t status = HAL_I2C_Mem_Write(&hi2c1, p_platform->address, RegisterAdress,
									I2C_MEMADD_SIZE_16BIT, p_values, size, 65535);
	return status;
}

 

Is it correct way to convert to SPI for others functions? Below example:

 

uint8_t RdByte(
		VL53L8CX_Platform *p_platform,
		uint16_t RegisterAdress,
		uint8_t *p_value)
{
	uint8_t status = 0;
	uint8_t data_write[2];
	uint8_t data_read[1];

	data_write[0] = (RegisterAdress >> & 0xFF;
	data_write[1] = RegisterAdress & 0xFF;
	status = HAL_SPI_Transmit(&hspi3, data_write, 2, 100);
	status = HAL_SPI_Receive(&hspi3, data_read, 1, 100);
	*p_value = data_read[0];
	/* Need to be implemented by customer. This function returns 0 if OK */

	return status;
}

 

 

 

 

Anne BIGOT
Technical Moderator
November 27, 2023

Hello 

We do have an example code working under Cube IDE using the SPI communication.
It will be integrated in the next revision of the driver.
Meanwhile, it can be sent by email on-demand if it can help.

Regards

Anne

 

Our community relies on fruitful exchanges and good quality content. You can thank and reward helpful and positive contributions by marking them as 'Accept as Solution'. When marking a solution, make sure it answers your original question or issue that you raised. ST Employees that act as moderators have the right to accept the solution, judging by their expertise. This helps other community members identify useful discussions and refrain from raising the same question. If you notice any false behavior or abuse of the action, do not hesitate to 'Report Inappropriate Content'
Associate
July 14, 2023

Hi there !
Don’t you be sorry & big thanks for the fast answer :)
Understood for SPI only on L8 & GPIO not usable for such need :\

Possibly expecting what you informed me, I am now considering implementing a”pseudo” ring buffer using some D-type latches, to iterate over CS lines in a loop [ and then all low if using I2C and capable of setting the addresses by using ”Xshut” ( or another if not present for a particular IC ) ].

I’ll be digging & comparing more of that product line’s datasheets, but should I already be aware of some limitations of the above approach ? ( aside from the not-as-speedy-as-could-be side of things )

looking forward to reading about that, thanks again