MC96FM204/FM214
160
April 7, 2016 Ver. 1.8
15.1.10 Protection for Invalid Erase/Write
It should be taken care to the flash erase/write programming in code.
You must make preparations for invalid jump to the flash erase/write code by malfunction, noise, and
power off.
Note) For more information, please refer to the appendix
“Flash Protection for Invalid Erase/Write”.
1. User ID check routine for the flash erase/write code.
ErWt_rtn:
---
MOV
FIDR,#10100101B ;ID Code
MOV
A,#ID_DATA_1 ;Ex) ID_DATA_1: 93H, ID_DATA_2: 85H, ID_DATA_3: 5AH
CJNE A,UserID1,No_WriteErase
MOV
A,#ID_DATA_2
CJNE A,UserID2,No_WriteErase
MOV
A,#ID_DATA_3
CJNE A,UserID3,No_WriteErase
MOV
FMCR,#0x?? ;0x03 if write, 0x02 if erase
---
---
RET
No_WriteErase:
MOV
FIDR,#00H
MOV
UserID1,#00H
MOV
UserID2,#00H
MOV
UserID3,#00H
MOV
Flash_flag,#00H
RET
If code is like the above lines, an invalid flash erase/write can be avoided.
2. It is important where the UserID1/2/3 is written. It will be remain the invalid flash erase/write
problem if the UserID1/2/3 is written at the above line of the instruction “MOV
FIDR,#10100101B”. So. It had better writing the UserID1/2/3 in another routine after return.
Decide_ErWt:
---
MOV
Flash_flag1,#38H ;Random value for example, in case of erase/write needs
MOV
FSADRL,#20H ;Here 20H is example,
MOV
Flash_flag2,#75H
RET
Summary of Contents for MC96FM204
Page 17: ...MC96FM204 FM214 April 7 2016 Ver 1 8 17 4 Package Diagram Figure 4 1 20 Pin SOP Package ...
Page 18: ...MC96FM204 FM214 18 April 7 2016 Ver 1 8 Figure 4 2 20 Pin TSSOP Package ...
Page 19: ...MC96FM204 FM214 April 7 2016 Ver 1 8 19 Figure 4 3 16 Pin SOP Package ...
Page 20: ...MC96FM204 FM214 20 April 7 2016 Ver 1 8 Figure 4 4 16 Pin TSSOP Package ...