AnsweredAssumed Answered

LPC11U6X Flash Signature

Question asked by Giona Imperatori on Dec 11, 2016
Latest reply on Dec 14, 2016 by jeremyzhou

Hi,

 

since a while I'm struggling with this topic.

My goal is to be able to generate the Flash signature in FW and in SW.

 

Here is the simple FW piece of code:

const char dummyData1[] __attribute__((aligned (0x1000))) = {
0xFF, 0x00, 0xFF, 0x11, 0xFF, 0x22, 0xFF, 0x33, 0xFF, 0x44, 0xFF, 0x55, 0xFF, 0x66, 0xFF, 0x77,
0xFF, 0x00, 0xFF, 0x11, 0x55, 0x22, 0xFF, 0x33, 0xFF, 0x44, 0xFF, 0x55, 0xFF, 0x66, 0xFF, 0x77,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
};

UInt32 ComputeFlashSignature(void)
{

//Chip_FMC_ClearSignatureBusy();
LPC_FMC->FMSSTOP &= ~FMC_FLASHSIG_BUSY;

UInt32 start = (UInt32)dummyData1;
UInt32 stop = start + 32 -1;

Chip_FMC_ComputeSignature(start, stop);

while(Chip_FMC_IsSignatureBusy());

volatile UInt32 sign = Chip_FMC_GetSignature(0);

return sign;

}

Assumed that dummyData is placed at 0x1000, I'm calculating the signature from 0x1000 to 0x101F.

Since the HW block is ignoring the 4 LSBs, it results in:

  • start: 0x100 => 0x1000
  • stop: 0x101 => 0x1010

This should sum up to 16B being used for the signature calculation.

The HW block seams to behave differently, if I change any of the bytes from #16 to #19 the signatures changes. It does not if I change any of the bytes after the byte #19.

So in total the HW block calculates the CRC on 20B, not 16 as some would expect.

This leads to my first question.

How is it possible to calculate the signature of the entire flash? My MCU has 256KB flash, address ranging from 0x0 to 0x3FFFF.

If I set this range it would result in:

  • start: 0x0 => 0x0
  • stop: 0x3FFF => 0x3FFF0 (+ the 4 mysterious addition bytes)

This is not the entire range, since some bytes at the end are skipped.

If I set the range 0x0, 0x40000:

  • start: 0x0 => 0x0
  • stop: 0x4000 => 0x40000 (+ the 4 mysterious addition bytes)

Here the mysterious bytes will be out of range/wrapped around on the first 4 bytes at address 0.

So, I'm completely misunderstanding something, or there is something which is not clear in the documentation?

 

Additionally, I'm trying to calculate this signature in SW, unsuccessfully. The pseudo code in the manual seams to to produce the same signature that is generated in HW.

Any hint?

 

Thank you in advance.

Outcomes