cancel
Showing results for 
Search instead for 
Did you mean: 

How does the Error Correction Code(ECC) for FLASH memory work?

IJo.1
Associate III

Hi! all experts in Community ST,

I have been working on the embedded flash memory of STM32G474RE and the whole programming process of the flash memory has been successful.

However, I do not understand how the Error Correction Code works.

Referring to the reference manual,

8-bit ECC code is calculated and added per double word(64 bits).

0693W00000YAmzXQAT.png 

If I interpreted correctly, 

when 64-bit or 8 bytes data is programmed at some address, the 8-bit ECC code is calculated automatically and is stored in flash memory, following the data. Is it correct?

Here is the memory map of my test case:

0693W00000YAn2MQAT.pngData: 0x1111111122222222

Addr: 0x0807F808

As you can see, the data has been successfully stored in the designated address but I can't find where the ECC is.

It is quite confusing for me.

If I want to store new data after the data which I already write, should I leave 8-bit for the ECC Code? or should I just write right after where the previous data ends?

I think I am not on the right track :'(

Where the ECC Code stores in the flash memory?

Please help me out and thank you in advanced!

1 ACCEPTED SOLUTION

Accepted Solutions

The ECC data is stored in bits which are not visible to you. You will only see the 64-bits of user data in the Flash line stored in the array. From a user perspective you'll see contiguous blocks of 8-bytes as you wrote them.​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

View solution in original post

3 REPLIES 3

The ECC data is stored in bits which are not visible to you. You will only see the 64-bits of user data in the Flash line stored in the array. From a user perspective you'll see contiguous blocks of 8-bytes as you wrote them.​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Thank you! I am finally able to move forward :))

By the way, shouldn't the ECC data be in the flash memory somehow? 

how can they be invisible although I can access almost every memory address?

I cant find any mention about that in the reference manual and other documents I can search.

Is it in the memory which is marked as "Reserved"? is that correct?

Hmm.. 

Billy OWEN
ST Employee

Hi @IJo.1​ 

The forum moderator had marked your post as needing a little more investigation and direct support. An online support case has been created on your behalf, please stand by for just a moment and you will hear from us.

Regards,

Billy