262
MC96F6432S
ABOV Semiconductor Co., Ltd.
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.
NOTE
) On flash memory erase and write, it should be disabled the RXE bit of USInCR2 register.
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 MC96F6432S Series
Page 15: ...15 MC96F6432S ABOV Semiconductor Co Ltd 4 Package Diagram Figure 4 1 44 Pin MQFP Package...
Page 16: ...16 MC96F6432S ABOV Semiconductor Co Ltd Figure 4 2 32 Pin LQFP Package...
Page 17: ...17 MC96F6432S ABOV Semiconductor Co Ltd Figure 4 3 32 Pin SOP Package...
Page 18: ...18 MC96F6432S ABOV Semiconductor Co Ltd Figure 4 4 28 Pin SOP Package...
Page 19: ...19 MC96F6432S ABOV Semiconductor Co Ltd Figure 4 5 28 Pin TSSOP Package...