Description
CircuitPython version
Adafruit CircuitPython 8.0.5 on 2023-03-31; Adafruit Feather RP2040 with rp2040
>>>
Code/REPL
import time
import board
i2c = board.I2C()
i2c.try_lock()
i2c.writeto(82, b"")
time.sleep(0.1)
i2c.writeto(82, b"")
Behavior
Code runs fine without any errors. The issue is seen in the scope trace of the resulting traffic. See below.
Description
This behavior seems to be benign in most cases. However, it is potentially the underlying cause of the issue that drove this change:
adafruit/Adafruit_CircuitPython_Nunchuk#34
See that nunchuk PR for a specific example of an actual issue with exception message, etc. However, this issue is being opened generically, mainly to raise awareness of this RP2040 specific behavior in case it is also potentially affecting other use cases.
Additional information
The underlying issue is seen via scope traces of the I2C traffic.
The first writeto
looks like this:
The second writeto
looks like this:
The issue being this large gap seen in the first call:
As noted by @jepler , the RP2040 does not use the I2C peripheral for 0 byte writes. Instead, it falls back to bitbanging. This may be a clue to what is driving this behavior. See ports/raspberrypi/common-hal/busio/I2C.c
.
Activity