Closed Kidney-Miller closed 1 year ago
Hmm, not sure why that would be. As far as I know, all vl53l0x should return 0xEE when reading register 0xC0. Have you tried reading any of the other registers suggested by the datasheet?
Also you may try increasing the delay here at delay_cycles, I guess you do something analogous to wait in your code?
static bool init_address(vl53l0x_idx_t idx)
{
set_hardware_standby(idx, false);
i2c_set_slave_address(VL53L0X_DEFAULT_ADDRESS);
/* The datasheet doesn't say how long we must wait to leave hw standby,
* but using the same delay as vl6180x seems to work fine. */
__delay_cycles(400);
Sorry for my delayed response. I tried the 3 eight bit registers (C1-3), they only return 0xFF. I also tried increasing the delay in the __delay_cycles(), but that did not seem to solve it. Could I missing a function call to boot/initialize the sensor?
It should boot up automatically, no function call required. Do you also see 0xFF on the I2C data line when you logic analyze? Do you have an Arduino you can try with (just to rule out faulty sensor)? Do you toggle xshut?
I confirmed it was working with an Arduino and the suggested library from your article. For xshut I am connecting a GPIO pin that's configured to a pull-up resistor so I could shut down the sensor when needed. As for the logic analyzer it just shows "ERROR" instead of register names and start/RD/WD.
Ok good then you have a working sensor at least. What do you mean by that the logic analyzer shows "error"? Does the clock look OK and is there traffic going back and forth?
Sorry for the late reply, I managed to figure it out. I was not using the xshut pin correctly. Thank you for taking the time to respond and help with my issue. I really appreciate it!
Hi, I'm not sure if this is a problem with my vl53l0x tof sensor or the driver. I'm using or your driver, but I'm running into issues with the device_is_booted() function during my call of init_addresses().
I'm using a frdm-kl25z microcontroller, when I use your driver to initialize the sensor, tells me the device is not booted. Everything else seems to work, the I2C clk and data look good on my Analog Discovery, but the 0xC0 register on my tof sensor only returns 0xFF when I call device_is_booted().