embeded/Cortex-M3 STM2025. 12. 9. 23:03

하드웨어로 구현된거라 소프트웨어로 루프돌리는것 보다 빠르다는게 장점인데 대충(?) 60배 빠르다고 한다.

[링크 : https://www.st.com/resource/en/application_note/an4187-using-the-crc-peripheral-on-stm32-microcontrollers-stmicroelectronics.pdf]

 

hcrc 라는 핸들이 선언되어 있고

HAL_CRC_Calcuate() 함수를 이용해서 바로 리턴을 받는 구조인 듯.

/* Private variables ---------------------------------------------------------*/
CRC_HandleTypeDef hcrc;

uint32_t HAL_CRC_Calculate(CRC_HandleTypeDef *hcrc, uint32_t pBuffer[], uint32_t BufferLength)
{
  uint32_t index;      /* CRC input data buffer index */
  uint32_t temp = 0U;  /* CRC output (read from hcrc->Instance->DR register) */

  /* Change CRC peripheral state */
  hcrc->State = HAL_CRC_STATE_BUSY;

  /* Reset CRC Calculation Unit (hcrc->Instance->INIT is
  *  written in hcrc->Instance->DR) */
  __HAL_CRC_DR_RESET(hcrc);

  /* Enter 32-bit input data to the CRC calculator */
  for (index = 0U; index < BufferLength; index++)
  {
    hcrc->Instance->DR = pBuffer[index];
  }
  temp = hcrc->Instance->DR;

  /* Change CRC peripheral state */
  hcrc->State = HAL_CRC_STATE_READY;

  /* Return the CRC computed value */
  return temp;
}

[링크 : https://cpattern.tistory.com/218]

[링크 : https://m.blog.naver.com/sheld2/222346016827] crc32 와 동일하게 나오게 하려면 수정 필요

[링크 : https://blog.naver.com/eziya76/221507312819]

 

[링크 : https://community.st.com/t5/stm32-mcus/crc-computation-in-stm32-mcus-and-post-build-creation/ta-p/49710]

 

CRC calculation unit, 96-bit unique ID

2.3.3 CRC (cyclic redundancy check) calculation unit
The CRC (cyclic redundancy check) calculation unit is used to get a CRC code from a 32-bit data word and a fixed generator polynomial.
Among other applications, CRC-based techniques are used to verify data transmission or storage integrity. In the scope of the EN/IEC 60335-1 standard, they offer a means of verifying the Flash memory integrity. The CRC calculation unit helps compute a signature of the software during runtime, to be compared with a reference signature generated at linktime and stored at a given memory location.

[링크 : https://www.st.com/resource/en/datasheet/stm32f103rc.pdf]

'embeded > Cortex-M3 STM' 카테고리의 다른 글

stm32f103ret middleware - usb  (0) 2025.12.09
stm32f103ret connectivity - usb  (0) 2025.12.09
STSW-STM32084 / usb demo  (0) 2025.12.09
stlink v2 클론 도착!  (0) 2025.11.26
stm32 cubeide git commit hash  (0) 2025.11.24
Posted by 구차니