-
stm32f05xx CRCEmbedded/펌웨어? 2019. 4. 16. 14:12
내부 CRC 사용
CRC32/MPEG-2 방식
소스)
- 함수
uint32_t crc_compute(uint32_t * start_addr, uint32_t size)
{
uint32_t crc_code;
uint32_t i = 0;
// Enable CRC
__HAL_RCC_CRC_CLK_ENABLE();
CRC->CR |= CRC_CR_RESET;
while(i < size)
{
CRC->DR = start_addr[i];
i++;
}
crc_code = CRC->DR;
// Disable CRC
__HAL_RCC_CRC_CLK_DISABLE();
return crc_code;
}
- 사용
uint32_t tbuf[2] = {0x1A2B3C4D, 0x1A2B3C4D};
tempp = crc_compute(&tbuf, 2);
-->tempp 값 = 0xF7461111
'Embedded > 펌웨어?' 카테고리의 다른 글
ST-link v2 readout protection (RDP) 설정 (0) 2022.12.05 USBISP-MK2 Manual (0) 2020.06.16 C 예제) AES-128 ECB (1) 2019.06.10