![](http://datasheet.mmic.net.cn/390000/SAB88C166W-5M_datasheet_16832339/SAB88C166W-5M_17.png)
SAB 88C166(W)
Semiconductor Group
16
Flash Protection
If active, Flash protection prevents data operand accesses and program branches into the on-chip
Flash area from any location outside the Flash memory itself. Data operand accesses and branches
to Flash locations are exclusively allowed for instructions executed from the Flash memory itself.
Erasing and programming of the Flash memory is not possible while Flash protection is active.
Note:
A program running within the Flash memory may of course access any location outside the
Flash memory and even branch to a location outside.
However, there is no way back, if Flash protection is active.
Flash protection is controlled by two different bits:
The user-accessible write-only Protection Activation bit (RPROT) in register FCR and
The one-time-programmable Protection Enable bit (UPROG).
Bit UPROG is a ‘hidden’ one-time-programmable bit only accessible in a special mode, which can
be entered eg. via a Flash EPROM programming board. Once programmed to ‘1’, this bit is
unerasable, ie. it is not affected by the Flash Erase mechanism.
To activate Flash Protection
bit UPROG must have been programmed to ‘1’, and bit RPROT in
register FCR must be set to ‘1’. Both bits must be ‘1’ to activate Flash protection.
To deactivate Flash Protection
bit RPROT in register FCR must be cleared to ‘0’. If any of the two
bits (UPROG or RPROT) is ‘0’, Flash protection is deactivated.
Generally Flash protection will remain active all the time. If it has to be deactivated intermittently, eg.
to call an external routine or to reprogram the Flash memory, bit RPROT must be cleared to ‘0’.
To access bit RPROT
in register FCR, an instruction with a ‘mem, reg’ addressing mode must be
used, where the first operand has to represent the FCR address (any even address within the active
address space of the Flash memory) and the second operand must refer to a value which sets the
RPROT bit to ‘0’, eg.:
MOV
FCR, ZEROS
; Deactivate Flash Protection
RPROT is the only bit in the FCR which can be accessed in Flash standard mode without having to
enter the Flash writing mode. Other bits in the FCR are not affected by such a write operation.
However, this access requires an instruction executed out of the internal Flash memory itself.
After reset
bit RPROT is set to ’1’. For devices with protection disabled (UPROG=’0’) this has no
effect. For devices with protection enabled this ensures that program execution starts with Flash
protection active from the beginning.
Note:
In order to maintain uninterrupted Flash protection, be sure not to clear bit RPROT
unintentionally by FCR write operations. Otherwise the Flash protection is deactivated.