I hooked it up to the hardware I2C pins 4 and 5 of my PICO, without pull-up resistors, and after a i2c.scan(), the module shows up with ID 96=0x60, as expected.
➝ Wiring seems ok, communication is possible.
According to the VISHAY VCNL spec sheet, page 7, the register #1 at address 0x81 contains a constant byte value representing the version. This was 33=0x21 when the spec sheet was released, it should be the same or higher by now. But: By reading this address, I receive the value 0x00.
➝ What do I miss here? Any help appreciated.
BTW: no matter which address I request, I always receive two bytes 0x00, and re following bytes 0xFF.
Code: Select all
>>> from machine import Pin,I2C
i2c = I2C(0, scl= Pin(5), sda=Pin(4), freq=100000)
print("scan result:",i2c.scan() )
vcnl4040 = i2c.scan()[0] # 96 = 0x60
# according to the spec sheet, register #1 at address 0x81
# contains the chip version, which is 0x21 or higher (read only)
# https://cdn-shop.adafruit.com/product-files/466/vcnl4010.pdf#page=7
print("expected version byte: b'\\x21' or higher")
print("version byte received:",i2c.readfrom_mem(vcnl4040,0x81,1))
scan result: [96]
expected version byte: b'\x21' or higher
version byte received: b'\x00'