Cyclic Redundancy Check Drivers (CRC)
Overview
This sample demonstrates how to use the CRC driver API. It computes a single CRC variant selected via sample Kconfig and logs the computed result. Optionally, it verifies against an expected value.
Configuration
Select the CRC variant to run using the sample’s Kconfig:
SAMPLE_CRC_VARIANT_CRC8SAMPLE_CRC_VARIANT_CRC16_CCITTSAMPLE_CRC_VARIANT_CRC32_IEEESAMPLE_CRC_VARIANT_CRC32_C
The sample performs a build-time capability check and will emit a compile error if the selected variant is not supported by the target driver/platform.
Building and Running
Building and Running for Renesas RA8M1
The sample can be built and executed for the RA8M1 Evaluation Kit as follows:
west build -b ek_ra8m1 samples/drivers/crc
west flash
To build for another board, change “ek_ra8m1” above to that board’s name.
Sample Output
The console logs the selected variant and the computed value. If an expected value is provided, the sample verifies and logs the outcome.
crc_example: CRC8 result: 0x000000b2
crc_example: CRC8 verification succeeded (expected 0x000000b2)
Note
If the selected CRC variant is not supported by the target, the build will fail with an error message describing the mismatch.
Expected Behavior
When the sample runs, it should:
Compute the selected CRC variant for predefined data.
Log the computed CRC value.
If an expected value is configured, verify it and log success/failure.