SAB 88C166(W)
Semiconductor Group
21
G
Perform Program-Verify operation and compare with source data
in order to check whether
a programming operation was performed correctly. PVM reading consists of two identical Flash
read instructions with 4
μ
s delay in between. This example uses CMP instructions to access the
Flash memory. In case of a mismatch the programming routine repeats the programming cycle
provided that the maximum number of attempts was not yet reached. PVM reading and data
comparison must be performed on both words of the double word to be tested.
CMP
DATAWR1, [FLASH_PTR]
CALL
cc_UC, WAIT_4
CMP
DATAWR1, [FLASH_PTR]
JMP
cc_NZ, PROG_FAILED
MOV
R15, FLASH_PTR
ADD
R15, #0002H
CMP
DATAWR2, [R15]
CALL
cc_UC, WAIT_4
CMP
DATAWR2, [R15]
JMP
cc_NZ, PROG_FAILED
. . .
; 1st step of PVM read (low word)
; Delay for 4
μ
s
; 2nd step of PVM read (low word)
; Reprogram on mismatch, if (PCOUNT) > 0
; Auxiliary pointer to upper word of doubleword
; 1st step of PVM read (high word)
; Delay for 4
μ
s
; 2nd step of PVM read (high word)
; Reprogram on mismatch, if (PCOUNT) > 0
; Programming was OK. Go on with next step.
G
Check number of programming attempts
to decide, if another programming attempt is
allowed. PCOUNT is decremented by ‘1’ upon each unsuccessful programming attempt. If it
expires, the failing Flash cells are classified as unprogrammable and should be left out. This
failure is very unlikely to occur. However, it should be checked for safe programming.
Note:
This step is taken only in case of a program verify mismatch.
G
Check for last doubleword and increment pointers
to decide, if another programming cycle is
required. The auxiliary counter DWCOUNT is decremented by ‘1’ after each successful double
word programming. If it expires, the complete data block is programmed and the programming
routine is exited successfully. Otherwise source and target pointers (SRC_PTR and
FLASH_PTR) are incremented to the next doubleword to be programmed.
G
Disable Flash programming operations and exit routine
, when the Flash memory block was
programmed successfully or when a failure occurred. In either case bit FWE of the FCR is reset
to ‘0’ and the programming routine is exited. This means that the Flash non-verify mode is
entered again, where the FCR stays accessible but Flash memory locations can be read
normally again using indirect addressing. For returning to the Flash standard mode, bit FWMSET
of the FCR must be reset to ‘0’ by the calling routine. The programming routine may return an exit
code that indicates correct programming or identifies the type of error.