2010-01-05 08:59 PM
Hardware CRC Calculation of FLASH.
2011-05-17 04:36 AM
I am using HARDWARE CRC to calculate 32bit CRC of the data contents in flash memory, which i will verify with precalculated version.
Controller Locks up when i try to execute block crc function from the stm library. folowing is the code snippet. u32 iCRC; u32 *iTempAddress; u32 iBlockLen; iTempAddress= (u32*)0x8010800; iBlockLen =0xE800; iCRC = CRC_CalcBlockCRC(iTempAddress,iBlockLen); DisplayOnSerial(iCRC);//diplays u32 as ASCII. i believe that iCRC should now contain a CRC for the block starting from 0x8010800 with length of 0xE800. my controller locks before DisplayOnSerial. the code runs perfectly if i declare const u32 buffer as per the example. the flash block is not from which the code is being executed. i believe the datasheets says about this very application of CRC unit. i am unable to find out the problem. i dont have a debugger so, i am unable to give information of what exactly is happening. if anyone can who has tried this function, let me know what am i missing. regards pavan karmarkar2011-05-17 04:36 AM
Problem Identified.
iBlockLen is the problem. i failed to realise that i was processing 32bits at a time, hence block length(8bit) had to be scaled by 4. i feel some sort exception must have been generated when the CRC unit tried to access Flash memory that didnot exist! Now i wonder whether this problem could have been easily identified if i had a debugger?? thank you for pondering over my doubt. regards pavan k karmarkar [ This message was edited by: pavan.karmarkar on 06-01-2010 10:22 ]2011-05-17 04:36 AM
Yes, reading from non-existing memory causes a 'hard fault' interrupt.