English
Language : 

SAB88C166 Datasheet, PDF (25/58 Pages) Siemens Semiconductor Group – 16-Bit CMOS Single-Chip Microcontrollers with/without oscillator prescaler with 32 KByte Flash EPROM
SAB 88C166(W)
q Enter writing mode via unlock sequence (prerequisite for any programming or erase
operation).
MOV
MOV
CALL
FCR, Rwn
[Rwn], Rwn
cc_UC, WAIT_10
; Dummy write to the FCR
; Both operands use the same GPR
; Delay for 10 µs
q Program the FCR register with a value that selects erase mode. Note that this does not yet start
the erase operation itself.
MOV
MOV
R15, #1000 00XX 0110 0011B
; #xxxx xxxx xxxx xxx1: FWE=’1’:
; #xxxx xxxx xxxx xx1x: FEE=’1’:
; #xxxx xxxx x11x xxxx: CKCTL=’11’:
; #xxxx xxXX xxxx xxxx: BE=’xx’:
; #1xxx xxxx xxxx xxxx: FWMSET=’1’:
DPP1:pof FCR, R15
Enable Flash write operations
Select erase mode
10 ms erase pulse (fCPU = 20 MHz)
Select the desired bank (3...0)
Stay in writing mode
; Write Value to the FCR using 16-bit access
q Initialize target pointer with the start address of the selected Flash memory bank. The Flash
memory must be accessed indirectly and uses the pointer FLASH_PTR. This pointer will apply
to DPP0 or DPP1, which are expected to select data pages 4 or 5, respectively.
q Test for correct VPP margin at pin VPP/EBC1 before an erase operation is started. If bit
VPPREV reads ‘1’, the erase voltage is correct and the algorithm can be continued. Otherwise,
the erase routine could wait in Flash writing mode until VPP reaches its correct value and resume
erasing then, or it could exit writing mode.
MOV R15, DPP1:pof FCR
JB
R15.4, Vpp_OK2
…
Vpp_OK2:
; Read FCR contents using 16-bit access
; Test VPP via bit VPPREV (= FCR.4)
; VPPREV=’0’: Exit erase procedure
; VPPREV=’1’: Test Okay! Continue
q Initialize loop counter (PCOUNT) with the maximum number of erase trials (ENmax) to be
performed before exiting the routine with a failure. Each trial means applying a pulse of 10 ms to
the selected Flash memory bank. According to the maximum cumulated erase time of 30 s
allowed per cell, ENmax must be ‘3000’ here.
q Erase selected Flash memory bank by writing to a Flash memory location using the target
address as write data.
MOV [FLASH_PTR], FLASH_PTR
; Write address to Flash, starts erasing
q Wait until erase time elapsed, which depends on bit field CKCTL in the FCR register and on the
CPU clock frequency (10 ms in this example). End of erasing is detected by polling the FBUSY
flag in the FCR register. The Flash memory switches to EVM mode automatically.
Semiconductor Group
24