Working with VL6189X TOF sensor that times out randomly.
I want to capture the error codes described in:
1 - Is the returned register, 8 16 or 32 bit?
2 - What does bits[7:4] represent?
Does the register start with 0 if so this would be bit numbers 7 through 10? ( in other words it is bits 8 through 11 if counting the first bit as 1 )
It looks like you’re talking about the VL6180X; I edited your topic title accordingly. All of the VL6180X’s registers are 8 bits wide. “Bits [7:4]” means “bits 7 through 4”, as in the upper 4 bits of that register (ranges of bits are usually specified counting down from most-significant to least-significant).
You can see a detailed description of the RESULT__RANGE_STATUS register in the VL6180X datasheet (specifically section 6.2.37).
Thank you for the information.
Learning that [7:4] means the upper or last 4 bits of the register helps tremendously.
I have determined that the Time Out error seems to be in how the sensor is powered up. I am using an Arduino Mega with several steppers and sensors. To power everything there are two DC power supplies.
If i upload the sketch powering the Mega with just the USB cable ( giving enough power to load up the sketch ), then turn on the two power supplies i randomly get the Time Out.
If I upload the sketch, then disconnect from the PC (USB) and power up through the two power supplies ( one power supply is feeding the Mega through a buck converter ) everything seems to work correctly.
Moving forward now… Thought I would post my findings if anyone may find it helpful.