AN4187 - Using the CRC peripheral in the STM32 family

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

STM32 CRC-32 Calculator Unit的更多相关文章

  1. CRC32 of Ether FCS with STM32

    Everyone knows that STM32F1xx, STM32F2xx, STM32F4xx have a hardware unit with a polynomial CRC32 0x0 ...

  2. STM32的CRC32 软件实现代码

    对于STM32的32位CRC,如果假定它的一个主要目的是为了校验往内部FLASH存储数据的可靠性,那么(余数)初值是全1当然是比较合理的.由于STM32的32位CRC是纯32位,即每次必须输入32位的 ...

  3. 如何在IAR中配置CRC参数(转)

    源:如何在IAR中配置CRC参数 前言 STM32全系列产品都具有CRC外设,对CRC的计算提供硬件支持,为应用程序节省了代码空间.CRC校验值可以用于数据传输中的数据正确性的验证,也可用于数据存储时 ...

  4. CRC循环冗余校验码总结(转)

    转自 http://blog.csdn.net/u012993936/article/details/45337069 一.CRC简介 先在此说明下什么是CRC:循环冗余码校验 英文名称为Cyclic ...

  5. CRC编码

    一.循环冗余码校验英文名称为Cyclical Redundancy Check,简称CRC. 它是利用除法及余数的原理来作错误侦测(Error Detecting)的.实际应用时,发送装置计算出CRC ...

  6. STM32 使用 printf 发送数据配置方法 -- 串口 UART, JTAG SWO, JLINK RTT

    STM32串口通信中使用printf发送数据配置方法(开发环境 Keil RVMDK) http://home.eeworld.com.cn/my/space-uid-338727-blogid-47 ...

  7. STM32 IAP 在线升级详解(转)

    源:http://blog.csdn.net/yx_l128125/article/details/12992773 (扩展-IAP主要用于产品出厂后应用程序的更新作用,考虑到出厂时要先烧写IAP   ...

  8. STM32的CRC32 测试代码

    // STM32 CRC32 Test App - sourcer32@gmail.com #include <windows.h> #include <stdio.h> DW ...

  9. 关于STM32位带操作随笔

    以前在学习STM32时候关注过STM32的位带操作,那时候只是知道位带是啥,用来干嘛用,说句心里话,并没有深入去学习,知其然而不知其所以然.但一直在心中存在疑惑,故今日便仔细看了一下,写下心得供日后参 ...

随机推荐

  1. 第12月第30天 love2d

    1. Linux On Linux, you can use one of these command lines: love /home/path/to/gamedir/ love /home/pa ...

  2. netty学习总结(一)

    netty是一个nio框架,将java的nio进行了一个封装,形成了一个高性能,高可用的网络编程框架,很多的框架都是基于netty的,所以学好netty是很有用的,而且netty本身的代码结构设计,以 ...

  3. ListView position

    在使用listview的时候,我们经常会在listview的监听事件中,例如OnItemClickListener(onItemClick)中,或listview的adapter中(getView.g ...

  4. Hacking Using Beef-Xss

    1.环境 hacker:192.168.133.128 os:Kali victims:192.168.133.1    os:win8 2.前期配置 首先进入beef-xss主目录,编辑配置文件,将 ...

  5. df -h执行卡住不动问题解决【转】

    昨天生产环境报日志写不进去了,因此 登陆线上环境后,习惯用df -h命令查看空间使用情况,结果发现该命令执行半天也没有返回. 因此使用mount命令查看该机器上的目录: [conversant@swi ...

  6. 移动端点击300ms延迟

    转载自:http://www.jianshu.com/p/6e2b68a93c88 一.移动端300ms点击延迟 一般情况下,如果没有经过特殊处理,移动端浏览器在派发点击事件的时候,通常会出现300m ...

  7. MySQL自定义函数和存储过程的区别:

    自定义函数和存储过程的区别: 1)一般来说,存储过程实现的功能要复杂一点,而函数的实现的功能针对性比较强.存储过程,功能强大,可以执行包括修改表等一系列数据库操作:用户定义函数不能用于执行一组修改全局 ...

  8. activiti helloworld

    activiti helloworld activiti的入门实践文章,重点在于动手做,要解决的是怎么做的问题.只有知道了怎么做后,才具有实际动手能力,才算对这门技术有一个初步掌握:至于更深入细化的知 ...

  9. 《python源码剖析》,看看

    这书高级了,有点超出理解能力. 但走出舒适区,不是大家都在说的么?:) 看完了些章节,还是很有收获的, 截图存照.

  10. 这可能是最全的禁用win10自动更新了

    https://jingyan.baidu.com/article/647f0115e5dbbf7f2148a834.html 本电脑系统版本:Windows 10 专业版 1607 本电脑问题:某天 ...