2025-02-08 06:20 AM
static const uint8_t VL53L4CD_DEFAULT_CONFIGURATION[] = {
#ifdef VL53L4CD_I2C_FAST_MODE_PLUS
0x12, /* 0x2d : set bit 2 and 5 to 1 for fast plus mode (1MHz I2C),
else don't touch */
#else
0x00, /* 0x2d : set bit 2 and 5 to 1 for fast plus mode (1MHz I2C),
else don't touch */
#endif
0x00, /* 0x2e : bit 0 if I2C pulled up at 1.8V, else set bit 0 to 1
(pull up at AVDD) */
0x00, /* 0x2f : bit 0 if GPIO pulled up at 1.8V, else set bit 0 to 1
(pull up at AVDD) */
0x11, /* 0x30 : set bit 4 to 0 for active high interrupt and 1 for active low
(bits 3:0 must be 0x1), use SetInterruptPolarity() */
Above is the default configuration for the VL53L4CD (the beginning part anyway). When I first started testing with the VL53L4CD readings were static. Meaning, they never changed. The first reading was the only reading it would ever give out. However, comparing the Configuration I had for the VL53L1X I noticed that 0x11 (interrupt above) was instead 0x01. So, I tried 0x01 and everything worked as expected for the VL53L4CD. Readings changed.
What is going on here with the defaults? Can you help me understand what this configuration settings is all about exactly?
Thanks,
Will
Solved! Go to Solution.
2025-02-10 07:27 AM
When we invented the sensor, we had several hundred registers to play with. By the time we got it working the way we wanted the vast majority of them were left at default, and we had to change a few to make things work. That's the 40 or 50 that are set in the initialization code.
Some of the registers (like Timing Budget and Inter-measurement Period) we expect you to change as you see fit. For these, we wrote functions in the API.
Setting the 0x10 bit changes the polarity of the interrupt (1 be active high)
Setting the lower 4 bits tells the sensor on what conditions to interrupt. 0x1 being 'interrupt on result or error', and it's what you REALLY want. The other settings were for us to debug the sensor. Don't change those bits. It will only make a mess.
"However, comparing the Configuration I had for the VL53L1X I noticed that 0x11 (interrupt above) was instead 0x01."
With this setting, you are going to get active low interrupts, and if that is what you want, it works that way. But it has to be aligned with how your MCU accepts interrupts.
I have no idea how that could be getting changed - unless you somehow reset the sensor. (Dropping or glitching Xshut would do it.)
It's all I can think of.
- john
2025-02-10 07:27 AM
When we invented the sensor, we had several hundred registers to play with. By the time we got it working the way we wanted the vast majority of them were left at default, and we had to change a few to make things work. That's the 40 or 50 that are set in the initialization code.
Some of the registers (like Timing Budget and Inter-measurement Period) we expect you to change as you see fit. For these, we wrote functions in the API.
Setting the 0x10 bit changes the polarity of the interrupt (1 be active high)
Setting the lower 4 bits tells the sensor on what conditions to interrupt. 0x1 being 'interrupt on result or error', and it's what you REALLY want. The other settings were for us to debug the sensor. Don't change those bits. It will only make a mess.
"However, comparing the Configuration I had for the VL53L1X I noticed that 0x11 (interrupt above) was instead 0x01."
With this setting, you are going to get active low interrupts, and if that is what you want, it works that way. But it has to be aligned with how your MCU accepts interrupts.
I have no idea how that could be getting changed - unless you somehow reset the sensor. (Dropping or glitching Xshut would do it.)
It's all I can think of.
- john