VL6180X with Optical Window Calibration Issue and MicroPython

Application: measuring fluid level distance

Attempting cross talk calibration procedure outlined in DocID026571 Rev 1 section 5.1.1 fails after basic offset calibration in section 4.1.1. In addition, using VL6180X cross talk compensation implementation DT0032 Rev 1 procedure does not work.
ST, in their attempt to complicate things, describe their Format 9.7 as:
9 integer bits + 7 fractional bits (stored over 2 bytes) For example, the value 4.2 is multiplied by 128, rounded and stored as 537 decimal. To decode, divide 537 by 128 = 4.19

Cross talk calibration data (reading from registers 0x0066 and 0x0064 result in the following:
Raw Range Return Sig
43 20
43 20
42 21
43 20
43 21
44 20
42 20
42 20
45 20
45 21

Reading and writing format 9.7 to registers may be the issue. Return signal read from register 0x0066 is not similar to examples in the documentation. In addition, it’s not clear how the format 9.7 should be written to the YSRANGE__CROSSTALK_COMPENSATION_RATE at register 0x001E.

The optical window is 3mm thick with no coatings and is 2mm away from the IR emitter.
My VL6180X MicroPython driver is HERE

Following are the registers and values being written to initiate the VL6180X
(0x0207, 0x01)
(0x0208, 0x01)
(0x0096, 0x00)
(0x0097, 0xfd)
(0x00e3, 0x00)
(0x00e4, 0x04)
(0x00e5, 0x02)
(0x00e6, 0x01)
(0x00e7, 0x03)
(0x00f5, 0x02)
(0x00d9, 0x05)
(0x00db, 0xce)
(0x00dc, 0x03)
(0x00dd, 0xf8)
(0x009f, 0x00)
(0x00a3, 0x3c)
(0x00b7, 0x00)
(0x00bb, 0x3c)
(0x00b2, 0x09)
(0x00ca, 0x09)
(0x0198, 0x01)
(0x01b0, 0x17)
(0x01ad, 0x00)
(0x00ff, 0x05)
(0x0100, 0x05)
(0x0199, 0x05)
(0x01a6, 0x1b)
(0x01ac, 0x3e)
(0x01a7, 0x1f)
(0x0030, 0x00)
(0x002D, 0x01)
(0x0026, 0x01)
(0x001E, 0x04)
(0x0024, 0x00)
(0x0024, 0x33)
(0x0016, 0x00)
(0x0024, 0xFD)
(0x0011, 0x10)
(0x010A, 0x30)
(0x003f, 0x46)
(0x0031, 0xFF)
(0x0040, 0x63)
(0x002E, 0x01)
(0x001B, 0x09)
(0x003E, 0x0A)
(0x0014, 0x24)
(0x001C, 0x32)
(0x002D, 0x10 | 0x01)
(0x0022, 0x7B)
(0x0120, 0x01)

With the optical window, readings are roughly ok up to 50mm, over 50mm results in incorrect readings.

Without the optical window, results are acceptable up to 75mm, over that readings result in out of range, 255.

I appreciate any assistance.


I am sorry you are having trouble implementing the cross talk compensation feature of the VL6180X, however, we have not tried using that feature and do not have any information about it beyond what is in the datasheet and documentation. I recommend contacting ST Microelectronics directly for additional assistance. If you get that working, we would love to hear more about it.

- Amanda