AN1836 Motorola / Freescale Semiconductor, AN1836 Datasheet - Page 19

no-image

AN1836

Manufacturer Part Number
AN1836
Description
FLASH Programming for Motorola MC68HC912 Microcontrollers
Manufacturer
Motorola / Freescale Semiconductor
Datasheet
;- Step 5 -
;- Step 6 -
;- Step 7 -
YesFlag:
;- Step 10 -
NoFlag:
SetMarginFlag:
Done:
;-----------------------------------------------------------------------
;-----------------
;-----------------------------------------------------------------------
ReadArray:
CheckLoop:
AN1836
MOTOROLA
Read and Verify Erase subroutine
JSR
BCLR
JSR
TST
BEQ
DEC
BNE
JSR
TST
BEQ
BCLR
BRA
INC
BSR
TST
BNE
LDAB
CMPB
BLS
BSR
INC
BRA
CLR
MOVB
MOVB
BRA
CLR
LDY
LDX
LDD
CPD
BNE
dly_10ms
FEECTL,ENPE
dly_10ms
MarginFlag
NoFlag
Nep
STEP4
ReadArray
ErasedFlag
Error
FEECTL,ERAS|LAT
Done
Nep
ReadArray
ErasedFlag
SetMarginFlag
Nep
#MaxNep
STEP4
Error
MarginFlag
STEP4
PORTA
#$FF,DDRA
#$02,PORTA
*
ErasedFlag
#BCFEEWords
#FEEStart
#$FFFF
2,X+
VerifyBad
;Delay time for erase pulse (Tepulse)
;Remove erase voltage (Clear ENPE)
;Delay for high voltage turn off (Tverase)
;Is margin flag set??
;
;If not, go bump counter and check data
;
;Decrement Nep - mod. Z bit in CCR for coming
; BNE branch
;If Nep not 0, go to Step 4
;Verify entire array is erased
;Is the array erased?
;
;If not, Erase failed, output an error
;
;Clear ERAS and LAT in FEECTL
;If so, quit.
;Increment number of erase pulses applied
;Verify entire array is erased
;Is it erased?
;
;If so, set margin flag
;
;Have we applied max number of pulses?
;If not, continue erasing
;If so, we have a problem
;Set Margin Flag
;Clear Port A
;Set DDRA to outputs
;Turn on PA1 to indicate complete
;(Turn off Vfp to board now)
; Always start with clear flag.
; Num of words to check in FLASH. (No boot
; block check)
; Index to the start of FLASH.
; Erased word value for comparison.
; Is word erased?
; If not, return without setting ErasedFlag.
; (failure)
(TST sets Z bit in CCR if MarginFlag is 0)
(TST sets Z bit in CCR if ErasedFlag is 0)
(TST sets Z bit in CCR if ErasedFlag is 0)
(BEQ branches if MarginFlag is 0)
(BEQ branches if ErasedFlag is 0)
(BNE branches if ErasedFlag is 1)
----------------
Erasing the FLASH Array
Application Note
19

Related parts for AN1836