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
Solved! Go to Solution.
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
Hi Mark,
Thanks a lot for your fast reply.
In the datasheet it was mentioned as 1 to 0 was possible to write
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
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
Hi
You are doing something that the manufacturer has clearly told you is not allowed, therefore you should not attempt to do it:
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
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)