Datasheet

Section 22 Flash Memory
Rev. 3.00 Sep. 28, 2009 Page 727 of 910
REJ09B0350-0300
22.10 Switching between User MAT and User Boot MAT
It is possible to switch between the user MAT and user boot MAT. However, the following
procedure is required because both of these MATs are allocated to address 0.
(Switching to the user boot MAT disables programming and erasing. Programming of the user
boot MAT should take place in boot mode or programmer mode.)
1. MAT switching by FMATS should always be executed from the on-chip RAM.
2. To ensure that switching has finished and access is made to the newly switched MAT, execute
four NOP instructions in the same on-chip RAM immediately after writing to FMATS (this
prevents access to the flash memory during MAT switching).
3. If an interrupt has occurred during switching, there is no guarantee of which memory MAT is
being accessed.
Always mask the maskable interrupts before switching between MATs. In addition, configure
the system so that NMI interrupts do not occur during MAT switching.
4. After the MATs have been switched, take care because the interrupt vector table will also have
been switched.
5. Memory sizes of the user MAT and user boot MAT are different. Do not access a user boot
MAT in a space of 8 kbytes or more. If access goes beyond the 8-kbyte space, the values read
are undefined.
<User MAT> <On-chip RAM> <User boot MAT>
Procedure for
switching to
user boot MAT
Procedure for
switching to
user MAT
Procedure for switching to user boot MAT:
Procedure for switching to user MAT:
1. Disable interrupts (mask).
2. Write H'AA to FMATS.
3. Execute four NOP instructions before accessing the user boot MAT.
1. Disable interrupts (mask).
2. Write a value other than H'AA to FMATS.
3. Execute four NOP instructions before accessing the user MAT.
Figure 22.17 Switching between User MAT and User Boot MAT