HI!, I am currently working with the VL6180X sensors and in this case, I have been using them with the ESP32 and it works correctly for the application that I am designing. It reads accurately, sets up interrupts well, and the proposed configurations are working properly. But now I want to do the same thing but with an ATmega328PB integrated circuit using the Pololu AVR programmer, but in this case, it does not read the sensor. Therefore, I opted to read the sensor directly using the Wire.h library for AVR. I can read all the registers correctly, but the only thing I cannot do is to correctly read the registers related to distance and ambient light, as it always returns 0. I have checked the sensor and swapped it out for new ones several times, checked the power supply and everything is in order, but reading those registers does not work. I activated the register for continuous reading and it still did not work, so I would like to know what could be causing this issue.
Reviewing, although it works with the ESP32, I have noticed that several libraries including the Pololu library for the VL6180X configure the following registers, which are not specified in the provider’s datasheet. Therefore, I would like to know what each one refers to and how I can understand this configuration. Thank you very much, and I am attentive to any solution or contribution.
if (readReg(SYSTEM__FRESH_OUT_OF_RESET) == 1)
{
scaling = 1;
writeReg(0x207, 0x01);
writeReg(0x208, 0x01);
writeReg(0x096, 0x00);
writeReg(0x097, 0xFD);
writeReg(0x0E3, 0x01);
writeReg(0x0E4, 0x03);
writeReg(0x0E5, 0x02);
writeReg(0x0E6, 0x01);
writeReg(0x0E7, 0x03);
writeReg(0x0F5, 0x02);
writeReg(0x0D9, 0x05);
writeReg(0x0DB, 0xCE);
writeReg(0x0DC, 0x03);
writeReg(0x0DD, 0xF8);
writeReg(0x09F, 0x00);
writeReg(0x0A3, 0x3C);
writeReg(0x0B7, 0x00);
writeReg(0x0BB, 0x3C);
writeReg(0x0B2, 0x09);
writeReg(0x0CA, 0x09);
writeReg(0x198, 0x01);
writeReg(0x1B0, 0x17);
writeReg(0x1AD, 0x00);
writeReg(0x0FF, 0x05);
writeReg(0x100, 0x05);
writeReg(0x199, 0x05);
writeReg(0x1A6, 0x1B);
writeReg(0x1AC, 0x3E);
writeReg(0x1A7, 0x1F);
writeReg(0x030, 0x00);
writeReg(SYSTEM__FRESH_OUT_OF_RESET, 0);
}