Microchip® Advanced Software Framework

Quickstart guide for SAM SPI driver

This is the quickstart guide for the SAM SPI driver, with step-by-step instructions on how to configure and use the driver in a selection of use cases.

The use cases contain several code fragments. The code fragments in the steps for setup can be copied into a custom initialization function, while the steps for usage can be copied into, e.g.the main application function.

Basic use case

In this basic use case, the SPI module are configured for:

  • Master mode
  • Interrupt-based handling

Prerequisites

  1. System Clock Management (Sysclock)

Setup steps

Example code

Add to application C-file:

Workflow

  1. Initialize the SPI in master mode:
  2. Set up an SPI device:
  3. Enable SPI module: