Microchip® Advanced Software Framework

Quick start guide for CRC driver

This is the quick start guide for the CRC driver, with step-by-step instructions on how to configure and use the drivers 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 use case, the CRC module is configured for:

  • Performing CRC on I/O interface
  • Using CRC-32

Setup steps

Prerequisites

For the setup code of this use case to work, the following must be added to the project:

  1. The common Clock service.
  2. A uint8_t array of data with at least 5 entries to perform CRC on.

Example code

Add to application initialization:

Workflow

  1. Initialize system clock:

Usage steps

Example code

Add to application C-file:

uint32_t checksum;
checksum = crc_io_checksum((void*)data, 5, CRC_32BIT);

Workflow

  1. Calculate the checksum of the data array and store it in the checksum variable:

Advanced use cases

For more advanced use of the CRC driver, see the following use cases: