Flash Behavior Understanding

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
User16280
Level 1
Level 1
Hello Guys,
I am working on a TC23x device. There is query with Flash write\erase.

Problem Statement:
• Attempt of writing 0x100 bytes causing memory corruption.

Scenario:

• There is no content in the memory. Attempt of write into memory is successful and any attempt of reading this flash is causing exception.
• Attempt of write after erasing the particular sector is fine and any read attempt is also successful without any exception.
• Attempting a write into any other address in the same sector is successful, but read of that particular memory is causing an exception.

Understanding:
• Memory erase is always mandatory before writing the empty space of a particular sector. In this case we need to take the backup of the written memory followed by erase and then write the complete memory.

Please let me know if my understanding is correct.

Thanks in advance!

Regards
VVSS
0 Likes
1 Reply
NeMa_4793301
Level 6
Level 6
10 likes received 10 solutions authored 5 solutions authored
Hi VVSS. For PFLASH, the erased state (all 0s) always causes an uncorrectable ECC read error.

An erase is only necessary before a write if the destination is not already erased.

For example: you can erase PF0 (0xA0000000-0xA01FFFFF), write 0xA0000000-0xA00000FF, and then write 0xA0001000-0xA00010FF without erasing. But if you want to rewrite 0xA0000000, you need to preserve everything else in S0 (0xA0000000-0xA0003FFF), erase S0, and then rewrite the sector (or at least, the populated parts of the sector).
0 Likes