Help understanding Arduino Zero and/or M0 SPI setup parameters

Hi,
I's setting up my 1st SPI on an Arduino M0. I wish to use SERCOM1 (not alt). I've read table 7.1 from the Atmel datasheet and believe I understand it.

I think I understand all the SPI initialization/creation parameters except for "PAD_SPI_TX" and "PAD_SPI_RX"

I've read the SERCOM.h for this board and see the enums (shown below) but for the life of me I cannot extract the meaning of these parameters ( PAD_SPI_TX, PAD_SPI_RX) which makes it hard to select a value to initialize the SPI.

Any help would be appreciated.

Thanks
John

Example I found:

SPIClass::SPIClass(
SERCOM *p_sercom,
uint8_t uc_pinMISO,		(these appear to be the IC pin not the board pin)
uint8_t uc_pinSCK,
uint8_t uc_pinMOSI,
SercomSpiTXPad PadTx,
SercomRXPad PadRx)
 : settings(SPISettings(0, MSBFIRST, SPI_MODE0))

SPIClass SPI (&PERIPH_SPI,  PIN_SPI_MISO,  PIN_SPI_SCK,  PIN_SPI_MOSI,  PAD_SPI_TX,  PAD_SPI_RX);

#define PIN_SPI_MISO         (22u)
#define PIN_SPI_MOSI         (23u)
#define PIN_SPI_SCK            (24u)
#define PERIPH_SPI              sercom4
#define PAD_SPI_TX             SPI_PAD_2_SCK_3
#define PAD_SPI_RX             SERCOM_RX_PAD_0

SPIClass SPI (&sercom4, 22, 24, 23, SPI_PAD_2_SCK_3, SERCOM_RX_PAD_0);

from SERCOM.h

typedef enum
{
	SERCOM_RX_PAD_0 = 0,
	SERCOM_RX_PAD_1,
	SERCOM_RX_PAD_2,
	SERCOM_RX_PAD_3
} SercomRXPad;


typedef enum
{
	SPI_PAD_0_SCK_1 = 0,
	SPI_PAD_2_SCK_3,
	SPI_PAD_3_SCK_1,
	SPI_PAD_0_SCK_3
} SercomSpiTXPad;

It's in the SAMD21 datasheet. the values don't seem to have much sense to them, they're just "alternative pinouts", some of which don't seem to make much sense, and none of which have good names :frowning:

Thank you :slight_smile: With the table you referenced I was able to understand the parameters. However I've not yet been able to get the SPI to work.

John

**** UPDATE ****
Look at this post to see how I finally succeeded. Arduino M0 SPI code