#I2C error on RP2

1 messages · Page 1 of 1 (latest)

craggy ivy
#

Example:

import board, busio

i2c = busio.I2C(board.GP21, board.GP20)

assert i2c.try_lock()

print(i2c.scan())
# prints: [32, 80, 104]

buff = bytearray(4)
i2c.readfrom_into(32, buff)
# OSError: [Errno 19] No such device
#

I2C error on RP2

craggy ivy
#

According to a comment in the RP2 port,

// The RP2040 I2C peripheral will not perform 0 byte writes.
// So use bitbangio.I2C to do the write.

Since the scan uses 0-byte writes, that means the scan is not using the i2c_write_timeout_us SDK call.

hushed mica
#

Do you have three devices on your I2C bus? Have you successfully used I2C with the other devices?

craggy ivy
#

I have not yet successfully used I2C with any of the devices. I expect to see at least 2, and the address 32 is one of them.

hushed mica
#

I believe i2c.scan is done with bit-banging

craggy ivy
#

Yes 3 makes sense actually. RTC, EEPROM, and GPIO expander.

hushed mica
#

I would try reducing the problem space by removing the other devices from the bus. Also do you have pull-up resistors on SDA & SCL?

craggy ivy
#

Removing other devices is difficult. Yes there are pullup resistors.

#

Two of the addresses belong to the same PCF8575 chip, the other is the RTC which might conceivably be removable.

hushed mica
craggy ivy
#

Yes I am using that and so I peeled away the outer layers to trigger the bug just with busio

hushed mica
#

ah

#

maybe try only reading 2 bytes instead of 4?

craggy ivy
#

No difference. Tried also communicating with the other devices without success. Also tried with bitbangio since it seems to be ok for scanning.

#

Guess I'll need to get a scope set up

#

Annoyingly the Pico SDK has two error paths that return PICO_ERROR_GENERIC and mask an internal error flag.