30.4.1 Initialization

  1. Select the SPI mode for host or client operation using the Operating Mode bit field in the Control A register (CTRLA.MODE).
  2. Select the transfer mode by configuring the Clock Polarity and Clock Phase bits in the Control A register (CTRLA.CPOL and CTRLA.CPHA).
  3. Configure the Frame Format bit field in the Control A register (CTRLA.FORM).
  4. Configure the Data In Pinout bit field in the Control A register (CTRLA.DIPO) to select SERCOM pads for the receiver.
  5. Configure the Data Out Pinout bit field in the Control A register (CTRLA.DOPO) to select SERCOM pads for the transmitter.
  6. If the SPI is used in Host mode:
    1. Select the desired baud rate by writing to the Baud register (BAUD).
    2. If Hardware SS control is required, write ’1’ to the Host SPI Select Enable bit in the CTRLB register (CTRLB.MSSEN).
  7. Enable the receiver by writing a ’1’ to the Receiver Enable bit in the Control B register (CTRLB.RXEN).
  8. Enable the module by writing a ’1’ to the Enable bit in the Control A register (CTRLA.ENABLE)