• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..--

boards/29-Dec-2025-51

src/29-Dec-2025-11891

CMakeLists.txtD29-Dec-2025200 85

KconfigD29-Dec-2025493 2919

README.rstD29-Dec-20251.8 KiB6746

prj.confD29-Dec-202526 32

sample.yamlD29-Dec-2025228 1413

README.rst

1.. zephyr:code-sample:: crc_drivers
2   :name: Cyclic Redundancy Check Drivers (CRC)
3   :relevant-api: crc_interface
4
5   Compute and verify a CRC checksum using the CRC driver API.
6
7Overview
8********
9
10This sample demonstrates how to use the :ref:`CRC driver API <crc_api>`.
11It computes a single CRC variant selected via sample Kconfig and logs
12the computed result. Optionally, it verifies against an expected value.
13
14Configuration
15*************
16
17Select the CRC variant to run using the sample's Kconfig:
18
19- ``SAMPLE_CRC_VARIANT_CRC8``
20- ``SAMPLE_CRC_VARIANT_CRC16_CCITT``
21- ``SAMPLE_CRC_VARIANT_CRC32_IEEE``
22- ``SAMPLE_CRC_VARIANT_CRC32_C``
23
24The sample performs a build-time capability check and will emit a
25compile error if the selected variant is not supported by the target
26driver/platform.
27
28Building and Running
29********************
30
31Building and Running for Renesas RA8M1
32======================================
33
34The sample can be built and executed for the
35:zephyr:board:`ek_ra8m1` as follows:
36
37.. zephyr-app-commands::
38   :zephyr-app: samples/drivers/crc
39   :board: ek_ra8m1
40   :goals: build flash
41   :compact:
42
43To build for another board, change "ek_ra8m1" above to that board's name.
44
45Sample Output
46=============
47
48The console logs the selected variant and the computed value. If an
49expected value is provided, the sample verifies and logs the outcome.
50
51.. code-block:: console
52
53   crc_example: CRC8 result: 0x000000b2
54   crc_example: CRC8 verification succeeded (expected 0x000000b2)
55
56.. note:: If the selected CRC variant is not supported by the target,
57   the build will fail with an error message describing the mismatch.
58
59Expected Behavior
60*****************
61
62When the sample runs, it should:
63
641. Compute the selected CRC variant for predefined data.
652. Log the computed CRC value.
663. If an expected value is configured, verify it and log success/failure.
67