Microchip® Advanced Software Framework

Quickstart guide for SAM PDCA driver

This is the quickstart guide for the SAM PDCA 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 PDCA module and channel are configured for:

  • Select USART2 as peripheral
  • Interrupt-based handling

Prerequisites

  1. System Clock Management (Sysclock)

Setup steps

Example code

Add to application C-file:

void pdca_callback(void)
{
//Get PDCA RX channel status and check if PDCA transfer complete
if (status == PDCA_CH_TRANSFER_COMPLETED) {
}
}
void pdca_setup(void)
{
pdca_enable(PDCA);
pdca_channel_write_config(PDCA_RX_CHANNEL, &PDCA_RX_CONFIGS);
pdca_channel_write_config(PDCA_TX_CHANNEL, &PDCA_TX_CONFIGS);
}

Workflow

  1. Define the interrupt callback function in the application:
  2. Enable PDCA module:
    • pdca_enable(PDCA);
    • Note
      Including enable module clock and lock sleep mode.
  3. Configure PDCA channel with specified mode:
  4. Set the PDCA callback function and enable PDCA interrupt.
  5. Enable PDCA channel: