2015-05-25 05:57 AM
Hi,
I'm working on the stm32f4discovery board, with the last version of keil µvision. I used library from stm32Cube. I have problem with CRC peripheral : I can't get a right result. My initialize code, before my infinite loop :hcrc.Instance = CRC;
HAL_CRC_Init(&hcrc);
__HAL_RCC_CRC_CLK_ENABLE();
When i use CRC :
uint8_t data[64];
/*for test only*/
data[0]=0x1a;
data[1]=0x03;
data[2]=0x31;
data[3]=0x32;
data[4]=0x33;
__HAL_CRC_DR_RESET(&hcrc);
CRCvalue = HAL_CRC_Calculate(&hcrc, (uint32_t*) data, 5);
When I execute this code, i'm waiting CRCvalue = 89CE6D10 (value calculate by crc online tools, and i have the same result on my computer with my own program) but the value of my calculate CRC is :CRCvalue = 909801CA
What am I doing wrong ?
Thanks for your help,
2015-05-25 07:10 AM
What am I doing wrong ?
Probably by a) assuming the online calculators model the STM32 hardware, b) not understanding the capabilities of the STM32F4 CRC hardware. The STM32F4 CRC is 32-bit wide, operates on 32-bit values (not 8-bit ones), and have an endian/shift that are not really compatible with each other. I've covered this before here several times..2015-05-25 09:34 AM