STM32F1 CRC

Started by tha, October 28, 2020, 07:38:48 AM

Previous topic - Next topic

tha

4 CRC calculation unit
Low-density devices are STM32F101xx, STM32F102xx and STM32F103xx
microcontrollers where the Flash memory density ranges between 16 and 32 Kbytes.
Medium-density devices are STM32F101xx, STM32F102xx and STM32F103xx
microcontrollers where the Flash memory density ranges between 64 and 128 Kbytes.
High-density devices are STM32F101xx and STM32F103xx microcontrollers where the
Flash memory density ranges between 256 and 512 Kbytes.
XL-density devices are STM32F101xx and STM32F103xx microcontrollers where the
Flash memory density ranges between 768 Kbytes and 1 Mbyte.
Connectivity line devices are STM32F105xx and STM32F107xx microcontrollers.

4.1 CRC introduction
The CRC (cyclic redundancy check) calculation unit ถูกใช้เพื่อให้รับ a CRC code จาก a 32-bit data word และ a fixed generator polynomial.

ในบรรดา applications อื่น, CRC-based techniques ถูกใช้เพื่อตรวจสอบ data transmission หรือ storage integrity. ใน the scope ของ the EN/IEC 60335-1 standard, เขาเสนอวิธีการการตรวจสอบ the Flash memory integrity. The CRC calculation unit ช่วยคำนวณ a signature ของ the software ในระหว่าง runtime, เพื่อถูกเปรียบเทียบกับ a reference signature ที่สร้างขึ้นที่ linktime และเก็บไว้ที่ a given memory location.

4.2 CRC main features
• Uses CRC-32 (Ethernet) polynomial: 0x4C11DB7
– X32 + X26 + X23 + X22 + X16 + X12 + X11 + X10 +X8 + X7 + X5 + X4 + X2+ X + 1
• Single input/output 32-bit data register
• CRC computation กระทำใน 4 AHB clock cycles (HCLK)
• General-purpose 8-bit register (สามารถถูกใช้สำหรับเป็นที่เก็บชั่วคราว)
The block diagram ถูกแสดงใน Figure 3.



ปล. ไม่เคยใช้นะ ท่านใดเคยใช้ ก็อธิบายเสริมมาได้ครับ

tha

4.3 CRC functional description
The CRC calculation unit โดยหลักแล้วประกอบด้วย a single 32-bit data register, ซึ่ง:
• ถูกใช้เป็น an input register เพื่อนำเข้า new data ใน the CRC calculator (เมื่อเขียนลงใน the register นี้)
• เก็บผลลัพธ์ของ the previous CRC calculation (เมื่ออ่าน the register นี้)

แต่ละ write operation ลงใน the data register สร้างการรวมกันของ the previous CRC value และค่าใหม่ (the new one) (CRC computation ถูกกระทำบน the whole 32-bit data word, และไม่ใช่ byte per byte).

The write operation จะถูกหยุดไว้ก่อนจนกระทั่งการสิ้นสุดของ the CRC computation, ดังนั้นจึงยอมให้ write accesses อย่างต่อเนื่องหรือ write และ read accesses ติดต่อกัน.

The CRC calculator สามารถถูก reset เป็น 0xFFFF FFFF ด้วย the RESET control bit ใน the CRC_CR register. การทำงานนี้ไม่มีผลกระทบข้อมูลที่อยู่ภายในของ the CRC_IDR register.

tha

4.4 CRC registers
The CRC calculation unit ประกอบด้วย 2 data registers และ a control register.
The CRC registers ต้องถูกเข้าถึงโดย words (32 bits).



Bits 31:0 Data register bits
     ใช้เป็น an input register เมื่อเขียน new data ลงใน the CRC calculator.
     เก็บ the previous CRC calculation result เมื่อมันถูกอ่าน.


tha



Bits 31:8 Reserved, must be kept at reset value.
Bits 7:0 General-purpose 8-bit data register bits
     สามารถถูกใช้เป็น a temporary storage location สำหรับ one byte.
     register นี้ไม่ได้รับผลกระทบโดย CRC resets ที่สร้างขึ้นโดย the RESET bit ใน the CRC_CR register.

tha



Bits 31:1 Reserved, must be kept at reset value.
Bit 0 RESET bit
     รีเซ็ต the CRC calculation unit และเซ็ต the data register เป็น 0xFFFF FFFF.
     บิตนี้สามารถถูกเซ็ตได้เพียงอย่างเดียว, มันจะถูกเคลียร์โดยอัตโนมัติโดย hardware.

tha

4.4.4 CRC register map
ตารางดังต่อไปนี้จัดให้มี the CRC register map และ reset values