As per Discord Chat.
Hi,
I noticed on my ItsyBitsy M4 (SAMD21G19A) that CircuitPython seems to allow a huge number of non-compliant combinations for I2C and UART configurations for SAMD51.
I was just wondering if the datasheet for the SAMD51 is wrong or CircuitPython.
EG: D3 (PB23) and MOSI (PB22) is said to be supported uart but really you cannot use the TX pin. (not on PAD[0])
EG: MOSI (PA00) and SCK (PA01) is said to be a valid I2C connection but doesn't work at all. (Not supported by SAMD51 - see datasheet).
Attached is what the test script outputs.
CircuitPython code.py
import board
import busio
from microcontroller import Pin
def is_hardware_I2C(scl, sda):
try:
p = busio.I2C(scl, sda)
p.deinit()
return True
except ValueError:
return False
except RuntimeError:
return True
def get_unique_pins():
exclude = ['NEOPIXEL', 'APA102_MOSI', 'APA102_SCK']
pins = [pin for pin in [
getattr(board, p) for p in dir(board) if p not in exclude]
if isinstance(pin, Pin)]
unique = []
for p in pins:
if p not in unique:
unique.append(p)
return unique
for scl_pin in get_unique_pins():
for sda_pin in get_unique_pins():
if scl_pin is sda_pin:
continue
else:
if is_hardware_I2C(scl_pin, sda_pin):
print("SCL pin:", scl_pin, "\t SDA pin:", sda_pin)
else:
pass
It looks like busio.I2C doesn't do it's checks correctly. Same goes for busio.UART.
SAMD51 Datasheet.

d51-i2c.txt
d51-uart.txt
As per Discord Chat.
Hi,
I noticed on my ItsyBitsy M4 (SAMD21G19A) that CircuitPython seems to allow a huge number of non-compliant combinations for I2C and UART configurations for SAMD51.
I was just wondering if the datasheet for the SAMD51 is wrong or CircuitPython.
EG: D3 (PB23) and MOSI (PB22) is said to be supported uart but really you cannot use the TX pin. (not on PAD[0])
EG: MOSI (PA00) and SCK (PA01) is said to be a valid I2C connection but doesn't work at all. (Not supported by SAMD51 - see datasheet).
Attached is what the test script outputs.
CircuitPython code.py
It looks like busio.I2C doesn't do it's checks correctly. Same goes for busio.UART.
SAMD51 Datasheet.

d51-i2c.txt
d51-uart.txt