博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
STM32 CRC-32 Calculator Unit
阅读量:5279 次
发布时间:2019-06-14

本文共 1914 字,大约阅读时间需要 6 分钟。

At start up, the algorithm sets CRC to the Initial_Crc XOR with the Input_Data.

Once CRC MSB is equal to one, the algorithm shifts CRC one bit to the left and XORs it with the POLY.

Otherwise, it only shifts CRC one bit to the left.

Figure 3 shows the step-by-step algorithm execution for the following conditions:

– Input_Data = 0xC1

– POLY = 0xCB

– Initial_Crc = 0xFF

All STM32 devices implement a CRC peripheral as described in Section 1.1.

The CRC calculation unit has a single 32-bit read/write data register (CRC_DR).

It is used to input new data (write access) and hold the result of the previous CRC calculation (read access).

Each write operation to the data register creates a combination of the previous CRC value (stored in CRC_DR) and the new one.

Figure 4. CRC calculation unit block diagram

To compute a CRC of any supported data, you must follow these steps:

1. Enable the CRC peripheral clock via the RCC peripheral.

2. Set the CRC Data Register to the initial CRC value by configuring the Initial CRC value register (CRC_INIT).(a)

3. Set the I/O reverse bit order through the REV_IN[1:0] and REV_OUT bits respectively in CRC Control register (CRC_CR).(a)

4. Set the polynomial size and coefficients through the POLYSIZE[1:0] bits in CRC Control register (CRC_CR)

and CRC Polynomial register (CRC_POL) respectively.(b)

5. Reset the CRC peripheral through the Reset bit in CRC Control register (CRC_CR).

6. Set the data to the CRC Data register.

7. Read the content of the CRC Data register.

8. Disable the CRC peripheral clock.

In firmware package, the CRC_usage example runs the CRC checksum code computing an array data (DataBuffer) of 256 supported data type.

For a full description, please refer to the file Readme.txt in the CRC_usage folder.

a. Applicable only for STM32F0xx and STM32F3xx devices

b. Applicable only for STM32F3xx devices

 

转载于:https://www.cnblogs.com/shangdawei/p/4606428.html

你可能感兴趣的文章
java实用类
查看>>
smarty模板自定义变量
查看>>
研究称90%的癌症由非健康生活习惯导致
查看>>
命令行启动Win7系统操作部分功能
查看>>
排序sort (一)
查看>>
Parrot虚拟机
查看>>
Teamcenter10 step-by-step installation in Linux env-Oracle Server Patch
查看>>
Struts2学习(三)
查看>>
Callable和Runnable和FutureTask
查看>>
GitHub 多人协作开发 三种方式:
查看>>
文本域添加编辑器
查看>>
Yum安装MySQL以及相关目录路径和修改目录
查看>>
java获取hostIp和hostName
查看>>
关于web服务器和数据库的各种说法(搜集到的)
查看>>
C# Stream 和 byte[] 之间的转换
查看>>
OMG: daily scrum nine
查看>>
redis与spring结合错误情况
查看>>
第六章 字节码执行方式--解释执行和JIT
查看>>
字符串方法title()、istitle()
查看>>
yield语句
查看>>