AN2398 Freescale Semiconductor / Motorola, AN2398 Datasheet - Page 21

no-image

AN2398

Manufacturer Part Number
AN2398
Description
In-Circuit Programming of FLASH Memory via the Universal Serial Bus for the MC68HC908JB8
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
ICP_Reset_Init:
_Startup:
ChkSum_Loop:
Not_Overflow:
Not_Overflow1:
;
Jmp_Application
;
;***********************************************************************
;*
;***********************************************************************
;
;====================================================================
;
;====================================================================
USB_ICP:
;
;* =========================================================
;*
;*
;*
;* =========================================================
ITS_USB_ICP:
MOTOROLA
Initialize the USB module
In-Circuit Programming of FLASH Memory via the USB for the MC68HC908JB8
lda
cbeqa
KCMPLO
clr
clra
ldhx
add
bcc
inc
aix
cphx
bne
add
bcc
inc
tsta
bne
lda
add
bne
jmp
USB_ICP
USB Initialization
ldhx
txs
mov
sei
clrh
bsr
mov
lda
sta
JMP_Reset_Init+1
#$FF,USB_ICP
(ROM_BEG/256),USB_ICP
V_ChksumH
#$F600
,x
Not_Overflow
V_ChkSumH
#1
#(ICP_FLAG)
ChkSum_Loop
ICP_FLAG+1
Not_Overflow1
V_ChkSum
USB_ICP
ICP_FLAG
V_ChkSum
USB_ICP
JMP_Reset_Init
#(RAM_END+1)
#%00000011,CONFIG
RST_USB_SIE
#!12,V_CPUSpeed
#$F8
FLBPR
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
; check if app address valid
; usb ICP if app address blank
; usb ICP if app address invalid
; clear checksum high byte
; clear ACC for cal checksum
; checksum start address
; add the bytes in flash
; overflow ?
; increase checksum high byte if yes
; increase flash address
; flash address reaches ICP_FLAG
; continue if not finished
; sum of flash + ICP_FLAG low byte
; overflow ?
; increase checksum high byte if yes
; checksum low byte+ICP_FLAG low byte=0 ?
; ICP mode if sum <> 0
; get ICP_FLAG high byte
; add checksum high byte
; ICP mode if sum <> 0
; jmp to application program
; set SP end of RAM
; disable COP, enable STOP
; disable interrupt
; reset high byte of H:X
; init and enable USB module
; V_CPUSpeed = 4 * 3
; unprotect FLASH
APPENDIX: Code Listing
AN2398/D
21

Related parts for AN2398