Grove Vision AI V2 timeouts (Grove-I2C)

The problem is not the voltage, my micropython code works perfect when I use the Cytron Maker Nano RP2040 comnected to the Grove Vision V2. But when I use the same code on the Arduino Alvik (Arduino Nano ESP32S3) I am getting the timeouts. This is my code:

from machine import I2C,Pin,SoftI2C
import utime
import sys
I2CADDRESS = 0x62
wait_delay=150
MAX_PL_LEN = 250


scl = 1
sda = 0

i2c = I2C(0,scl=Pin(scl),sda=Pin(sda),freq=104900)

print (i2c)

print()
print('Scan i2c bus...')
print()

devices = i2c.scan()

if len(devices) == 0:
    print("No i2c device !")
else:
    print('i2c devices found:',len(devices))
print()

for device in devices:
    print("Decimal address: ",device," | Hexa address: ",hex(device))

utime.sleep_ms(wait_delay)


while True:
    arr = bytes([0x10,0x06])
    try:
        i2c.writeto(I2CADDRESS,arr)
    except OSError as exc:
        print ("Reset error: " + str(exc))
        continue
    utime.sleep_ms(wait_delay)
    command = "AT+ID?"
    data ='{}\r\n'.format(command).encode('utf-8')
    print(data)
    size=len(data)
    utime.sleep_ms(wait_delay)
    arr = bytes([0x10,0x02,size >> 8,size & 0xFF]) + data
    try:
        i2c.writeto(I2CADDRESS,arr)
    except OSError as exc:
        print ("Write error: " + str(exc))
        continue   
    utime.sleep_ms(wait_delay)

    i2c.writeto(I2CADDRESS,bytearray([0x10,0x03]))
    buf = bytearray(2)
    utime.sleep_ms(wait_delay)
    try:
        i2c.readfrom_into(I2CADDRESS,buf)
    except OSError as exc:
        print ("Read avail error: " + str(exc))
        continue    
    utime.sleep_ms(wait_delay)
    length = (buf[0] << 8) | buf[1]

    print ("Length:" + str(length))
    stread = bytearray()
    i2c.writeto(I2CADDRESS,bytearray([0x10,0x01,length >> 8,length & 0xFF,0x00,0x00]))
    utime.sleep_ms(wait_delay)
    buf = bytearray(length)
    i2c.readfrom_into(I2CADDRESS, buf)
    stread.extend(buf)
    utime.sleep_ms(wait_delay)
    print(f'buffer: {stread}.')

The output of the code executed on the Cytron Maker Nano RP2040:

I2C(0, freq=104865, scl=1, sda=0, timeout=50000)

Scan i2c bus...

i2c devices found: 2

Decimal address:  40  | Hexa address:  0x28
Decimal address:  98  | Hexa address:  0x62
b'AT+ID?\r\n'
Length:59
buffer: bytearray(b'\r{"type": 0, "name": "ID?", "code": 0, "data": "48b3ac23"}\n').
b'AT+ID?\r\n'
Length:59
buffer: bytearray(b'\r{"type": 0, "name": "ID?", "code": 0, "data": "48b3ac23"}\n').
b'AT+ID?\r\n'
Length:59

And this is the output of the same code running on the Arduino Alvik (changing only the pins):

MicroPython v1.25.0 on 2025-04-15; Arduino Nano ESP32 with ESP32S3
Type "help()" for more information.
>>> 
raw REPL; CTRL-B to exit
>OKI2C(0, scl=12, sda=11, freq=105263)

Scan i2c bus...

i2c devices found: 3

Decimal address:  40  | Hexa address:  0x28
Decimal address:  43  | Hexa address:  0x2b
Decimal address:  98  | Hexa address:  0x62
b'AT+ID?\r\n'
Read avail error: [Errno 116] ETIMEDOUT
Reset error: [Errno 116] ETIMEDOUT
Reset error: [Errno 116] ETIMEDOUT
Reset error: [Errno 116] ETIMEDOUT

I will keep investigating what is the cause of the timeouts.

Thanks!

1 Like