- Adapted from
samples/drivers/i2c/custom_target
example - Tested on
Adafruit KB2040
- I2C pins
SDA
=2
SCL
=3
- UART pins
TX
=A2
RX
=A3
west build -p always -b adafruit_kb2040 kb2040_i2c_target
Just copy the zephyr.uf2
build artifact to RPI-RP2
bootloder folder.
From an attached board running CircuitPython:
Adafruit CircuitPython 9.2.8 on 2025-05-28; Adafruit QT Py RP2040 with rp2040
>>> import board
>>> i2c = board.STEMMA_I2C()
>>> i2c.try_lock()
True
>>> i2c.scan()
[96]
>>> buf = bytearray(4)
>>> i2c.readfrom_into(96, buf)
>>> [hex(b) for b in buf]
['0x42', '0x42', '0x42', '0x42']
>>>