cancel
Showing results for 
Search instead for 
Did you mean: 

Hardware CRC Calculation of FLASH.

pavan23
Associate II
Posted on January 06, 2010 at 05:59

Hardware CRC Calculation of FLASH.

3 REPLIES 3
pavan23
Associate II
Posted on May 17, 2011 at 13:36

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 karmarkar

pavan23
Associate II
Posted on May 17, 2011 at 13:36

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 ]

paulsmitton9
Associate III
Posted on May 17, 2011 at 13:36

Yes, reading from non-existing memory causes a 'hard fault' interrupt.