Microchip® Advanced Software Framework

Quick Start Guide for the PARC driver

This is the quick start guide for the SAM4L Parallel Capture (PARC) Driver, with step-by-step instructions on how to configure and use the driver for a specific use case.

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.

Use Cases

PARC Basic Use Case

This use case demonstrates how to use the PARC module on SAM4L. In this use case the PARC module is configured as:

  • Capture every byte
  • Sample the data bus on the rising edge of the PCCK input clock
  • Sample data regardless of the levels of PCEN1 and PCEN2
  • 8-bit data width

Setup Steps

Prerequisites

This module requires the following service:

Setup Code Example

Add the following to the main loop or a setup function:

// Get default configuration
// Initialize PARC.
// Enable the PARC
// Start capture.

Basic Setup Workflow

  1. Initialize and configure PARC:
    // Get default configuration
    // Initialize PARC.
  2. Enable the PARC module and start capture:
    // Enable the PARC
    // Start capture.

PARC Basic Usage

Basic Usage Code

We can poll the data ready status and then read it once capture has finished:

 uint32_t captured_data;

 while (!parc_is_data_ready(&module_inst)) {
     }
 parc_read(&module_inst, &captured_data); 

We can enable the data ready interrupt and install a callback function to perform a custom task:

 parc_register_callback(&module_inst,
     (parc_callback_t)parc_complete_callback, PARC_CALLBACK_DATA_READY);
 parc_enable_interrupts(&module_inst, PARC_INTERRUPT_DRDY);
 parc_enable_callback(&module_inst, PARC_CALLBACK_DATA_READY);
 parc_start_capture(&module_inst);

 // The callback function example.
 static void parc_complete_callback(
     struct parc_module *const module)
 {
   callback_data_ready = true;
   parc_read(module, &captured_data);
 }