Microchip® Advanced Software Framework

Quick Start Guide for PDC - Basic

This is the quickstart guide for SAM3A/3N/3S/3U/3X/4E/4N/4S/G Peripheral DMA Controller (PDC) Driver with step-by-step instructions on how to configure and use the driver.

A handler is required for the interrupt, below is a simple example:

{
/* Get UART status and check if PDC receive buffer is full */
if ((uart_get_status(CONSOLE_UART) & UART_SR_RXBUFF) == UART_SR_RXBUFF) {
/* Configure PDC for data transfer (RX and TX) */
}
}

First initialise the board:

Now setup the PDC registers:

/* Get pointer to UART PDC register base */
/* Initialize PDC data packet for transfer */
/* Configure PDC for data receive */
/* Enable PDC transfers */
pdc_enable_transfer(g_p_uart_pdc, PERIPH_PTCR_RXTEN | PERIPH_PTCR_TXTEN);

Enable UART IRQ:

uart_enable_interrupt(CONSOLE_UART, UART_IER_RXBUFF);

Enable UART interrupt

NVIC_EnableIRQ(CONSOLE_UART_IRQn);

Once the required number of bytes have been transferred, an interrupt is triggered and the handler will run. The main program may execute other code or be busy-waiting:

while (1) {
}