This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2745R10-Q1: Power off during erasing or writing to flash memory

Part Number: CC2745R10-Q1

Tool/software:

Hello,

I am using TI\simplelink_lowpower_lowpower_f3_sdk_8_30_00_11_ea_examples\rtos\LP_EM_CC2745R10_Q1\ble5stack\basic_ble.
If the power is turned off while erasing a sector of flash memory, what will happen to the sector that was in the process of being erased?
I am assuming the following.
- The sector is erased from the first address of the sector, and is filled with 0xFF in order from the top, and the data before erasure remains thereafter.

If the power is turned off while the flash memory is being written, what will happen to the sector that was in the middle of being written?
I am assuming the following.
- The data is written from the first address of the sector to be written, and the data after that is filled with 0xFF.

  • Hello,

    I've pinged the R&D team to get some more information. 

    In the meantime, are you trying to implement something specific?

    Best,

    Nima Behmanesh

  • Thank you. Looking forward to hearing from you.

    >In the meantime, are you trying to implement something specific?

    I want to move data between sectors of a flash memory.

    Processing image
    ① Write the same data as sector A to sector B
    ② Erase sector A

    As a recovery process in case the power is turned off during process ① or ②,
    I am thinking of a mechanism to detect if the data in the sector is incomplete.

  • Hello!

    Thank you for reply on what you're trying to implement! So I did get a response from the R&D team:

    Erasing

    The state of flash may be partially erased. There's no guarantee on the contents or what portion will be erased. 

    The reason for this is because, from ROM's perspective, erasing is an all or nothing type of operation. Flash will only tell us when the operation was done, but not how much was done. This is more of a hardware behavior than it is a software/ROM behavior.

    Flashing

    Some of the flash will be partially programmed and the rest will not. There's no guarantee on the contents on what portion will be flashed. The flash API writes one flash word at a time, so if power loss occurs, then the remainder of the loop will never have been written.

    In summary, flashing works the way you mentioned in your first post, but erasing is a little more unclear since we don't know how much of the operation actually completed. 

    I want to move data between sectors of a flash memory.

    Processing image
    ① Write the same data as sector A to sector B
    ② Erase sector A

    As a recovery process in case the power is turned off during process ① or ②,
    I am thinking of a mechanism to detect if the data in the sector is incomplete.

    Maybe not needed, but a suggestion on how to implement this considering what we know of flashing would be calculating the hash of the new data to be written before it's written. Then if the writing completes or not you can compare hashes. 

    Hope that helps!

    Best,

    Nima Behmanesh

  • Hello!
    Thank you for your reply. I understand now.
    I will try to create it based on your suggestions.