Hello,
I am using the vl53l5cx TOF sensor and implementing the ULD using zephyr. My setup is a bl654 board using zephyr on sdk 1.9.1. However I am running into an issue, since the sensor is RAM based in the init() it's required to upload ~82kB of firmware over the I2C connection into the sensor. Writing and reading single bytes are not a problem for me, but looping the I2C function continue to give me NACK on the I2C line and I cannot even transfer the internal register address to read or write from. Any ideas on how I can implement this. Here is an example of my multi-write function:
uint8_t WrMulti(
VL53L5CX_Platform *p_platform,
uint16_t RegisterAddress,
uint8_t *p_values,
uint32_t size)
{
uint8_t status = 255;
int offset = 0;
uint8_t writeBuf[MAX_TX_BUFFER];
while(size > 0){
writeBuf[0] = RegisterAddress>>8;
writeBuf[1] = RegisterAddress & 0xff;
memcpy(&(writeBuf[2]), &(p_values[offset]), MAX_TX_BUFFER - 2);
if (size >= 256){
status = i2c_write(p_platform->i2c_dev, writeBuf, MAX_TX_BUFFER, p_platform->address);
if (status)
{
printk("%d\n", size);
}
offset += 256;
size -= 256;
} else{
status = i2c_write(p_platform->i2c_dev, writeBuf, size, p_platform->address);
if (status)
{
printk("%d\n", size);
}
}
}
return status;
}
Thanks,
Jacob