See Table 6-1 in the SAMD datasheet linked above for all possible pin configurations on the SAMD51 microcontrollers.
Column 6 is the pad name that spans across all the different variations of SAMD51 microcontrollers. These are the pins you can specify using:
import microcontroller
pinNum5 = microcontroller.pin.PB04
as opposed to the more-typical "SAM32" name:
import board
pinNum5 = board.AIN7
These are two ways to address the same pin. Use the SAM32 Pinout to see the options.
Let's say we want UART hardware-enabled communication but have already used the default Tx and Rx pins on the board for something else.
Table 6-1 can seem daunting at first, so here's an example of how to read it.
Checking the datasheet (Table 34-1), we know UART pins need to have PAD[0],PAD[1],PAD[2] listed in the 14th and/or 15th column in Table 6-1. The screenshot above shows two other pins that we should be able to use for UART. Pins #17 and #18 (PA08 and PA09) are the default I2C pins on the SAM32 board, but we should still be able to use them!
<aside> 📢 Note: Table 6-1 shows that we can also use PA08 and PA09 as analog-input pins as well.
</aside>
To demonstrate, we'll use a SAM32 and connect to it over REPL:
Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 4.1.0-beta; SAM32v2a with samd51j20
>>> import board
>>> import busio
>>> uart = busio.UART(board.SDA,board.SCL)
>>>
It works! 🎉
We can also use microcontroller
to get the exact same result and reduce confusion in our coding syntax. (note: reboot the board between experiments to reset the configurations)
>>> import microcontroller
>>> import busio
>>> uart = busio.UART(microcontroller.pin.PA08, microcontroller.pin.PA09)
>>>