CRC signature value is different after flash write

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

CRC signature value is different after flash write

4,009 Views
boyeonkim
Contributor I

Hi,

I am developing on MPC5746C.

I referred a sample code in below answer and the CRC calculation itself works but I have no idea why the CRC value is different after flash write.

The problem is CRC#2 and CRC#8 is different even if the data is same.

I think the only difference is CSTAT(CRC Current Status) value when I had a look at peripheral register in trace32.

But, still I have no idea why it is different. 

The init_edma function is passed through but should I initialize something more?

Here is a current process.

---------------------------------------------------------------------

Let's say it is working on already.

1. A certain command for flash write is received.

2. Calculate CRC of all data in the structure except CRC field

3. Save the CRC value into the structure

   : The data structure includes other information and CRC.

      for example, 

      typedef struct st_data{

             uint8_t num;   //object to be checked from CRC

             uint32_t crc;

       }st_data

4. Write the data structure including CRC field into flash to store permanently.

5. target reset using trace32

6. Booting

7. Read data from flash and memcpy to the data structure on RAM

8. Calculate CRC data of the data structure (st_data) except CRC field

9. If the CRC value of #8 is same as "st_data.crc", it means no problem with flash read.

------------------------------------------------------------------------------- 

Thanks

Katie

Tags (2)
0 Kudos
6 Replies

1,386 Views
boyeonkim
Contributor I

Lukas, I have one more question.

Is there any register to be set or notification if Writing/Reading data itself from flash is failed?

I should prepare for those situation as well for safety.

Thanks in advance.

Katie

0 Kudos

1,386 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi Katie,

the flash implements ECC (Error Correcting Code) which repairs single bit errors and reports non-correctable errors. If you access corrupted data then, in case of single bit error, you will get correct(ed) data and, in case of non-correctable error, machine check exception is triggered.

There's an application note for MPC56xx devices:

http://www.nxp.com/assets/documents/data/en/application-notes/AN5200.pdf

http://www.nxp.com/assets/documents/data/en/application-notes-software/AN5200SW.zip

We plan to write something similar for MPC57xx in next months.

Regards,

Lukas

0 Kudos

1,386 Views
boyeonkim
Contributor I

I would like to catch the flash corruption.

Currently, our program is going to be stuck when it tried to read the corrupted flash with memcpy.

According to the application that you shared, there is a register to be set when the flash corruption is occurred.

Is there any updates on application note for MPC57xx ?

Please share the note if it is released.

0 Kudos

1,386 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

sorry for delay, I was not able to answer all updates...

There are two sample codes for MPC57xx:

Example MPC5777C-1b+2b_RAM_ECC_error_injection GHS614 

https://community.nxp.com/docs/DOC-333754 

The application note is not available yet due to high workload. I do not expect that it will be available sooner than at the end of this year.

Regards,

Lukas

0 Kudos

1,386 Views
boyeonkim
Contributor I

I initialized all related registers as same as your sample code.

Another problem was I put a wrong source address value (pointer's address) on SADDR register.

Then, it works!!

Please make sure your source address value is right with Trace32 if anyone has same problem with me.

Thank you very much, Lukas!

0 Kudos

1,386 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi Katie,

it is important to set the seed value in CRC_CSTAT before calculating CRC. If the seed value is different when calculating CRC of the same structure, the result will be also different.

pastedImage_1.png

By the way, I shared simple example here:

https://community.nxp.com/docs/DOC-332223 

Please let me know if this doesn't solve the problem.

Regards,

Lukas

0 Kudos