FRDM -F64K Flash over-write from 1 to 0

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

FRDM -F64K Flash over-write from 1 to 0

Jump to solution
720 Views
sandeepkamath
Contributor I


Hi,

I am facing a strange problem while writing the contents into Flash of MK64FN1M0VLL12

I can erase, write and read block wise data(8 bytes) easily from the flash. But if i want to overwrite the bit from 1 to 0 without erasing, i face a strange problem.

(I know that writing  0 to 0 over stresses memory. But 1 to 0 can be easily over written without erasing as per the datasheet)

Here is one example:

case1:

Suppose i have already written this block of data in memory 0x000ed000

0              3 4          7

B8400D03 00000000

Now if i overwrite the value with 7FFFFFFF FFFFFFFF , the data will be written without any problem

38400D03 00000000

case2:

Suppose i have already written this block of data in memory 0x000ed000

0              3 4          7

B0400D03 00000000

Now if i overwrite the value with 7FFFFFFF FFFFFFFF , i will encounter a hard reset.

case3:

Suppose i have already written this block of data in memory 0x000ed000

0              3 4          7

C8400D03 00000000

Now if i overwrite the value with 7FFFFFFF FFFFFFFF , i will encounter a hard reset

case4:

Suppose i have already written this block of data in memory 0x000ed000

0              3 4          7

D8400D03 00000000

Now if i overwrite the value with 7FFFFFFF FFFFFFFF , the data will be written without any problem

58400D03 00000000

Looks like there is a pattern for this while over writing into the memory. Strange!!

Can anyone help me with this.

Thanks in advance!

Best Regards,

Sandeep

Labels (1)
0 Kudos
1 Solution
520 Views
mjbcswitzerland
Specialist V

Hi Sandeep

What you are doing is an "accumulative write" which is not allowed.
Some Flash types support this (that is, it is allowed by the manufacturer) but others don't (eg. Kinetsi Flash). It may work (as you have seen), it may damage the chip (stress and failure at some random point in time) or it may fail (as you have seen).

However, as the manufaturer very clearly states that it is not allowed, you MUST avoid doing it if you want your products to be able to be reliable, even if a workaround can be found to allow it to work sometimes. The rule is simple - a single write to a phase is allowed and any further write to it requires the sector (in which is is located) to be erased before doing it (irrespective of the values written).

Regards

Mark

View solution in original post

0 Kudos
4 Replies
520 Views
sandeepkamath
Contributor I

Hi Mark,

Thanks a lot for your fast reply.

In the datasheet it was mentioned as 1 to 0 was possible to write

pastedImage_0.png

And if you see the above example, i am just trying to set only 1 bit (rest i am masking with 1s- 7FFFFFFF FFFFFFFF)

B8400D03 00000000

to

38400D03 00000000

So only one time it will write from 1 to 0, rest bits it will treat as 1 to 1 or 0 to 1 which in any case not be considered.

Will this be considered as cumulative overwrite?

Best Regards,

Sandeep

0 Kudos
521 Views
mjbcswitzerland
Specialist V

Hi Sandeep

What you are doing is an "accumulative write" which is not allowed.
Some Flash types support this (that is, it is allowed by the manufacturer) but others don't (eg. Kinetsi Flash). It may work (as you have seen), it may damage the chip (stress and failure at some random point in time) or it may fail (as you have seen).

However, as the manufaturer very clearly states that it is not allowed, you MUST avoid doing it if you want your products to be able to be reliable, even if a workaround can be found to allow it to work sometimes. The rule is simple - a single write to a phase is allowed and any further write to it requires the sector (in which is is located) to be erased before doing it (irrespective of the values written).

Regards

Mark

0 Kudos
520 Views
mjbcswitzerland
Specialist V

Hi

You are doing something that the manufacturer has clearly told you is not allowed, therefore you should not attempt to do it:

pastedImage_0.png

A possible explanation of the actual behavior is that there is a CRC over the programmed phase which allows the Flash controller to correct bit errors (this is speculation because it is not described anywhere, but is commonly used in such Flash). When you program a phrase a CRC is also saved and when you then change bits (the originall saved CRC can't be changed) you may be luck that it matches and the phrase can be read or it may cause the CRC to no longer be correct and then the phase is marked as damaged and any reads from it will cause a hard fault.

Therefore it may be interesting to try (for fun) but you need to avoid doing anything like this for real work.

Regards

Mark

0 Kudos
520 Views
sandeepkamath
Contributor I

Update: Please Note that i am using built in SDK flash1 component to write ("SSD_FTFx.h")

uint32_t SIZE_OPTIMIZATION FlashProgram(PFLASH_SSD_CONFIG pSSDConfig, \

                                   uint32_t dest, \

                                   uint32_t size, \

                                   uint8_t* pData, \

                                   pFLASHCOMMANDSEQUENCE pFlashCommandSequence)

0 Kudos