📄Microchip SAMD Datasheet

SAM32 Pinout Diagram

See Table 6-1 in the SAMD datasheet linked above for all possible pin configurations on the SAMD51 microcontrollers.

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/76c1f389-0fec-4a13-b2b4-38583b551634/Untitled.png

Example

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.

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/cb0db5df-9136-48f5-acf1-ee3d9b155815/Untitled.png

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)
>>>