TXZ Family
Flash Memory
2018-06-05
63 / 120
Rev. 2.0
4.1.8. Memory Swap Function
When application program reprogramming on the code flash is suspended, the power may become off after the
program code is erased, and application program reprogramming may not be continued. To avoid such case, use this
memory swap function to save your program.
4.1.8.1. Memory Swap Setting
A swap region starts from Address 0 and the same size next region. A swap size is determined by
[FCSWPSR]
<SIZE>. To change the size, set “1” to
[FCSWPSR]
<SIZE>
with the automatic memory swap
programming command.
To perform memory swap, set “1” to
[FCSWPSR]
<SWP[0]>
with the automatic memory swap programming
command. To release the swap condition, set “1” to
[FCSWPSR]
<SWP[1]>
with the automatic memory swap
command or execute the automatic memory swap erasing command. A swap condition can be checked with
[FCSWPSR]
<SWP>.
For details of the automatic memory swap command, refer to “4.1.3.12Automatic Memory Swap”.
4.1.8.2. Memory Swap Operation
This section explains the basic operation flow of the memory swap. For the concrete example of the memory swap
operation, refer to “6.8How to Reprogramming User Boot Program”.
Release the protection function temporarily, when the protection function is valid.
For details of the protection function temporary release, refer to “4.1.6.3Protection Temporary Release Function”. If
the protection function is not temporarily released, command execution is not performed in the procedure.
1.
Check whether the next area (next to the area starting from Address 0) is blank. (Hereafter the area
starting from 0 is called Page 0, and the next area is called Page 1.) If not, erase the area.
Page0: Old original data
Page1: Blank
2.
Program the original data starting from Address 0 to the next region. (Both regions have the same
data.)
Page0: Old original data
Page1: Copied data (old original data)
3.
Perform memory swap.
Page0: Copied data (old original data)
Page1: Old original data
4.
Erase old original data to be blank.
Page0: Copied data (Old original data)
Page1: Blank