Listing 1. MCU-to-MCU Duplicator Program
M68HC11 Bootstrap Mode, Rev. 1.1
Freescale Semiconductor
209
27
**************************************************
28
*
29 B600 7F103D
BEGIN
CLR
INIT
Moves Registers to $0000-3F
30 B603 8604
LDAA
#$04
Pattern for DWOM off, no SPI
31 B605 9728
STAA
SPCR
Turns off DWOM in EVBU MCU
32 B607 8680
LDAA
#RESET
33 B609 9704
STAA
PORTB
Release reset to target MCU
34 B60B 132E20FC WT4BRK
BRCLR
SCSR RDRF WT4BRK Loop till char received
35 B60F 86FF
LDAA
#$FF
Leading char for bootload ...
36 B611 972F
STAA
SCDR
to target MCU
37 B613 CEB675
LDX
#BLPROG
Point at program for target
38 B616 8D53
BLLOOP
BSR
SEND1
Bootload to target
39 B618 8CB67D
CPX
#ENDBPR
Past end ?
40 B61B 26F9
BNE
BLLOOP
Continue till all sent
41
*****
42
* Delay for about 4 char times to allow boot related
43
* SCI communications to finish before clearing
44
* Rx related flags
45 B61D CE06A7
LDX
#1703
# of 6 cyc loops
46 B620 09
DLYLP
DEX
[3]
47 B621 26FD
BNE
DLYLP
[3] Total loop time = 6 cyc
48 B623 962E
LDAA
SCSR
Read status (RDRF will be set)
49 B625 962F
LDAA
SCDR
Read SCI data reg to clear RDRF
50
*****
51
* Now wait for character from target to indicate it's ready for
52
* data to be programmed into EPROM
53 B627 132E20FC WT4FF
BRCLR
SCSR RDRF WT4FF
Wait for RDRF
54 B62B 962F
LDAA
SCDR
Clear RDRF, don't need data
55 B62D CED000
LDX
#EPSTRT
Point at start of EPROM
56
* Handle turn-on of Vpp
57 B630 18CE523D WT4VPP
LDY
#21053
Delay counter (about 200ms)
58 B634 150402
BCLR
PORTB RED
Turn off RED LED
59 B637 960A
DLYLP2
LDAA
PORTE
[3] Wait for Vpp to be ON
60 B639 2AF5
BPL
WT4VPP
[3] Vpp sense is on port E MSB
61 B63B 140402
BSET
PORTB RED
[6] Turn on RED LED
62 B63E 1809
DEY
[4]
63 B640 26F5
BNE
DLYLP2
[3] Total loop time = 19 cyc
64
* Vpp has been stable for 200ms
65
66 B642 18CED000
LDY
#EPSTRT
X=Tx pointer, Y=verify pointer
67 B646 8D23
BSR
SEND1
Send first data to target
68 B648 8C0000
DATALP
CPX
#0
X points at $0000 after last
69 B64B 2702
BEQ
VERF
Skip send if no more
70 B64D 8D1C
BSR
SEND1
Send another data char
71 B64F 132E20FC VERF
BRCLR
SCSR RDRF VERF
Wait for Rx ready
72 B653 962F
LDAA
SCDR
Get char and clr RDRF
73 B655 18A100
CMPA
0,Y
Does char verify ?
74 B658 2705
BEQ
VERFOK
Skip error if OK
75 B65A 150403
BCLR
PORTB (RED+GREEN) Turn off LEDs
76 B65D 2007
BRA
DUNPRG
Done (programming failed)
77 B65F
78 B65F 1808
VERFOK
INY
Advance verify pointer
79 B661 26E5
BNE
DATALP
Continue till all done
80 B663
81 B663 140401
BSET
PORTB GREEN
Grn LED ON