MC96F6432
June 22, 2018 Ver. 2.9
313
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 RXE0/1 bit of USI0CR2/USI1CR2 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 MC96F6432 Series
Page 24: ...MC96F6432 24 June 22 2018 Ver 2 9 4 Package Diagram Figure 4 1 48 Pin LQFP 0707 Package...
Page 25: ...MC96F6432 June 22 2018 Ver 2 9 25 Figure 4 2 44 Pin MQFP Package...
Page 26: ...MC96F6432 26 June 22 2018 Ver 2 9 Figure 4 3 32 Pin LQFP Package...
Page 27: ...MC96F6432 June 22 2018 Ver 2 9 27 Figure 4 4 32 Pin SOP Package...
Page 28: ...MC96F6432 28 June 22 2018 Ver 2 9 Figure 4 5 28 Pin SOP Package...