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

本文共 1860 字,大约阅读时间需要 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

 

转载地址:http://wcjto.baihongyu.com/

你可能感兴趣的文章
IOS逆向-砸壳笔记
查看>>
从需求到产品-系统的分解与集成
查看>>
Git操作GitHub时的Proxy配置
查看>>
微软.NET经典架构例程Duwamish 7.0分析
查看>>
软件包管理 之 Freshrpms.net 资源介绍,及apt 和yum 的应用
查看>>
R tips
查看>>
Sending Content to Other Apps
查看>>
http://www.tangible-engineering.com/tangible_t4editor.html
查看>>
[收藏学习]Ubuntu Git入门学习
查看>>
PySide 路在何方?
查看>>
Android进阶2之新浪微博采用Oauth发送图片和文字
查看>>
监听的instance status blocked分析
查看>>
老年人冬季皮肤瘙痒讨论(中医2群)
查看>>
Java中怎样由枚举常量的ordinal值获得枚举常量对象
查看>>
食积咳嗽的特点
查看>>
Java将视频转为缩略图--ffmpeg
查看>>
我的第一个Servlet
查看>>
IOS开发之微博的设计与实现
查看>>
基因组组装结果质量评估
查看>>
Maven整合SSM框架——详细整合教程(Spring+SpringMVC+MyBatis)
查看>>