This action might not be possible to undo. Are you sure you want to continue?
AN1010/D Rev. 1, 5/2002 M68HC11 EEPROM Programming from a Personal Computer
This application note describes a simple and reliable method of programming either the M68HC11’s internal EEPROM or the EEPROM connected to the MCU’s external bus. The data to be programmed is downloaded from any standard personal computer (PC) fitted with a serial communications port. In addition to the programming procedure, the software incorporates the facility to verify the contents of the MCU’s internal or external memory against code held on a PC disc. Both program and verify options use data supplied in S record format, which is downloaded from the PC to the M68HC11 using the RS232 protocol supported by the MCU’s SCI port. The minimum MCU configuration required to program the M68HC11’s internal EEPROM is shown in Figure 1. This consists only of the MCU, an RS232 levelshifting circuit, plus an 8-MHz crystal and a few passive components.
RS232 CONNECTOR 16 RxD TxD + CTS DSR DCD DTR 0V GND C1 + C2 14 13 1 3 4 5 15 VDD C4 + 26 MODA 3 MODB 2 2 + C3 6 RESET 17 4.7 k 1 µF CERAMIC 0V 0.1 µF +5 V MAX232 11 12 21 PD1 (TX) +5 V
VSS 1 EXTAL 7 MC68HC11A1 52-PIN PLCC 10 M 8 XTAL 22 pF 8 MHz 22 pF
20 PD0 (RX)
0V C1, C2, C3, C4 — 22 mF, 25-V aluminum or tantalum Note: To improve reliability of the MCU, all its unused inputs should be connected to VSS or VDD.
Figure 1. M68HC11 Bootstrap Mode Connection to RS232 Line
© Motorola, Inc., 1988, 2000, 2002
To initiate the download, the PC is connected to the M68HC11 SCI transmit and receive lines via a level shifter. The circuit in Figure 1 uses a Maxim MAX232 to eliminate the need for additional ±12-volt supplies. The MCU’s special bootstrap mode is invoked by applying a logic 0 to the MODA and MODB pins, followed by a hardware reset. Removing the reset condition causes the MCU to start execution of its bootloader program, located in internal ROM, between addresses $BF40 and $BFFF. In normal single-chip or expanded modes, the boot ROM is not accessible, and reads from these memory locations will result, respectively, in irrelevant data or external memory fetches. An additional consequence of bootstrap operation is that all vectors are relocated to the boot ROM area. With the exception of the reset vector, which points to the start of the boot ROM, the remaining interrupt vectors all point to an uninitialized jump table in RAM. Three bytes are reserved for each entry in the jump table to allow for an extended jump instruction. Table 1 and Table 2 detail the memory map of the bootstrap vectors and an example RAM jump table. Table 1. Bootstrap Vector Assignments
Address BFFE BFFC BFFA BFF8 BFF6 BFF4 BFF2 BFF0 BFEE BFEC BFEA BFE8 BFE6 BFE4 BFE2 BFE0 BFDE BFDC BFDA BFD8 BFD6 Vector BF40 00FD 00FA 00F7 00F4 00F1 00EE 00EB 00E8 00E5 00E2 00DF 00DC 00D9 00D6 00D3 00D0 00CD 00CA 00C7 00C4 Bootstrap reset Clock monitor COP fail Illegal opcode SWI XIRQ IRQ Real-time interrupt Timer output capture 1 Timer output capture 2 Timer output capture 3 Timer output compare 1 Timer output compare 2 Timer output compare 3 Timer output compare 4 Timer output compare 5 Timer overflow Pulse accumulator overflow Pulse accumulator input edge SPI SCI Description
M68HC11 EEPROM Programming from a Personal Computer
The bootstrap program continues by initializing the SCI transmitter and receiver to 7812 baud and proceeds to examine the state of the NOSEC bit in the CONFIG register. Typical Instruction JMP CLKMON JMP COPFL NOTE: Before any interrupts are enabled in bootstrap mode. no use is made of the break transmitted by the SCI. . RAM Jump Table Internal RAM Address 00FD 00FA . and download the binary file EEPROGIX. where the internal EEPROM contains information of a proprietary or confidential nature. etc. then the erasing sequence is not carried out. As this application note does not make use of the M68HC11’s interrupt system. If this is at logic 0 (security enabled). MOTOROLA M68HC11 EEPROM Programming from a Personal Computer 3 . the bootloader will erase the entire contents of internal EEPROM and also the CONFIG register. The PC-resident program will now configure the appropriate COM channel to 1200 baud. It will then proceed to load the binary file into all 256 RAM locations and then jump to address $0000 (for instance. no parity. it is the software designer’s responsibility to initialize all appropriate entries in the jump table. one stop bit.BAS is given at the end of this application note. it is necessary to initiate the PC S record downloader program.BAS (written in BASIC). The bootstrap program then issues a break condition on the SCI transmit line and waits for the reception of the first byte.AN1010/D Introduction Table 2. At this point. The M68HC11’s bootloader automatically will detect the fact that the first incoming character is received at a different baud rate and change its SCI rate to 1200 baud. If the NOSEC bit is at logic 1. It will display a header message and prompt the user for the number of the COM channel (either one or two) which is connected to the M68HC11. the first RAM location). A listing of EELOAD. In this application. Note also that erasing the CONFIG register disables the security feature. the jump table is not set up.BOO from the PC to the M68HC11. called EELOAD. . This feature is particularly useful for security-conscious applications.
then waits for a control character from the PC. Once the newly downloaded S record programmer starts execution in the M68HC11. 4 M68HC11 EEPROM Programming from a Personal Computer MOTOROLA .BOO consists of the M68HC11 executable code shown in the source listing at the end of this application note. This ensures synchronism between the PC and the M68HC11. during download of EEPROGIX. the PC does not detect the echo. This character will determine the operating mode of the S record programmer. EEPROM data and address faults can be quickly identified by inspection.AN1010/D EEPROGIX.BOO is only used to detect the baud rate of the PC and is not echoed back. 3. Table 3. This program is designed to receive S records from the PC and program the data fields into the appropriate EEPROM memory locations. It also removes the need for a hardware handshake. In this way. while the remaining 256 bytes are echoed by the M68HC11’s SCI transmitter. Note that these programming utilities can be used to load and verify external RAM as well as external EEPROM. The options available are shown in Table 3. the actual stored byte value is returned to the PC. At the end of the verify download. However. and $00 appended up to the 256th byte. where it is displayed with a preceding colon delimiter. 2. every character in the S record file is immediately echoed back to the PC.BOO. Verify Option If a verify error occurs. the total number of errors is displayed. it configures the SCI to 9600 baud. as this feature is unnecessary at this stage. Request whether the downloaded data must be echoed to the screen Prompt the user for the required operating mode Request the name of the S record file to be downloaded from the PC Once the download starts. with the addition of $FF at the head of the file. S Record Downloader Operating Mode Options Control Character X I V Operating Mode Program external EEPROM/RAM Program internal EEPROM Verify internal or external EEPROM/RAM If the S record programmer has been downloaded successfully. A point to note is that the initial $FF byte in EEPROGIX. the PC resident program will now: 1. and at the same time it removes some of the overhead associated with the EEPROM programming delay time.
With internal EEPROM. it is first generally necessary to erase the required byte (erased state is $FF) and follow with a write of data to the same address. but one of the internal M68HC11 timer functions could equally well be used to provide the time delay. Figure 2 and Figure 3 show the flowcharts of the internal EEPROM erase and write sequences. for instance). To allow programming of the CONFIG register in all mask set versions of the M68HC11A series and to permit expanded mode operation. If the CONFIG register address ($103F) is detected. the programming time delay must be implemented or initiated by software.#MDA instruction on the eighth line of program code in EEPROGIX. This same error message is displayed if a fault or incorrect connection exists on the serial link between the PC and M68HC11.X. This condition is detected by the PC-resident program. MOTOROLA M68HC11 EEPROM Programming from a Personal Computer 5 .AN1010/D Internal or External Option Internal or External Option If a programming error occurs in either internal or external programming mode. The internal programming sequence involves accessing the PPROG register (address $103B) to latch the EEPROM address and data buses for the duration that the programming voltage is applied. In this application. Also. then the CONFIG register is not read directly after programming. the M68HC11-resident software will hang up. This prevents premature termination of the download. If the user wishes to maintain operation in bootstrap mode (to verify internal ROM code. a software timing loop is used. if the read back data after programming does not correspond to the expected data. which will then abort the download and display an error message. the MCU resident program switches from bootstrap mode to special test mode by setting the MDA bit (bit 5) in the HPRIO register (address $103C).ASC should be removed and the program reassembled. The one exception to this operation stems from the fact that changes to the M68HC11’s CONFIG register can be detected only after a subsequent hardware reset. for instance. then the BSET HPRIO. Programming Internal EEPROM The techniques for programming internal and external EEPROM are quite different.
Internal EEPROM Erase Sequence 6 M68HC11 EEPROM Programming from a Personal Computer MOTOROLA .AN1010/D BEGIN ERASE CONFIG REGISTER ? N SELECT BYTE ERASE MODE Y SELECT BULK ERASE MODE ENABLE ERASE MODE ENABLE ADDRESS AND DATA LATCHES WRITE TO REQUIRED MEMORY ADDRESS (DATA IRRELEVANT) APPLY PROGRAMMING VOLTAGE WAIT 10 ms REMOVE PROGRAMMING VOLTAGE DISABLE ERASE MODE DISABLE ADDRESS AND DATA LATCHES END Figure 2.
AN1010/D Programming Internal EEPROM BEGIN ENABLE BYTE WRITE MODE ENABLE ADDRESS AND DATA LATCHES WRITE REQUIRED DATA TO REQUIRED ADDRESS APPLY PROGRAMMING VOLTAGE WAIT 10 ms REMOVE PROGRAMMING VOLTAGE DISABLE WRITE MODE DISABLE ADDRESS AND DATA LATCHES END Figure 3. Internal EEPROM Write Sequence MOTOROLA M68HC11 EEPROM Programming from a Personal Computer 7 .
In practice. 8 M68HC11 EEPROM Programming from a Personal Computer MOTOROLA . provided the address is not $0000. An important outcome of this is that. as the former has no equivalent of the PPROG control register. Emulator Address Decoding The emulator circuit in Figure 4 shows the M68HC11’s address line A13 connected to pin 26 of the 2864. this should never pose a problem. irrespective of the selected programming mode. The addition of the MC68HC24 gives a minimal component count implementation of a circuit which accurately emulates the M68HC11A8 singlechip MCU. To program the 2864 from the PC. When a 27128 memory is used. This involves examining the most significant bit of the data programmed by reading from the address just written to until the data becomes true. Although this pin is actually unused by the 2864. The added benefit of using the 2864 is that the software designer’s program and/or data can be modified without removing the emulator from the target system. This can be particularly useful in applications where the emulator may be enclosed in a confined space or in an environmental chamber. In addition. the memory range $C000–$DFFF is mapped over the normally used 8-Kbyte range of $E000–$FFFF. is a feature to force program execution at the address specified in the S9 S record address field.AN1010/D Programming External EEPROM Figure 4 shows the hardware needed to interface the M68HC11 to an external 2864 EEPROM. which provides a total of 8 Kbytes of reprogrammable memory. its inclusion permits the replacement of the 2864 with a 27128 16-Kbyte EEPROM memory. A data polling technique is used to determine the end of the programming delay time. its full 16-Kbyte address range of $C000–$FFFF is available to the MCU. the erase sequence and delay time are handled automatically by the 2864 on-chip logic. the MS bit will read as the complement of the expected data. (During the programming delay time. when a 2864 is used. the external operating mode option (X) must be selected from the EELOAD menu. Included in the S record programmer. Programming the 2864 involves fewer operations than are needed for internal EEPROM.) This means that the same software algorithm can be used to download code or data to external RAM as well as external EEPROM.
MC68HC11A8 Emulator Using 2864 EEPROM .1 F 52 1 3 VDD VRL VRH VSS MODEA 2 MODEB 18 XIRQ 28 39 41 42 40 38 37 36 35 33 32 31 30 43 MODE 17 VDD VSS C2 0.1 F 1 12 23 34 NC NC NC NC PB0 PB1 PB2 PB3 PB4 PB5 PB6 PB7 27 26 25 24 22 21 20 19 IRQ RST E STRA STRB PB4 PB5 PB6 PB7 PB3 PB2 PB1 PB0 19 17 5 4 6 IRQ RST E AS R/W AD0 AD1 AD2 AD3 AD4 AD5 AD6 AD7 C1 } AN1010/D Emulator Address Decoding Figure 4.VSS PORT D 20 21 22 23 24 25 34 33 32 31 30 29 28 27 PD0 PD1 PD2 PD3 PD4 PD5 IC1 MC68HC11A1FN 9 A0/D0 10 A1/D1 11 A2/D2 12 A3/D3 13 A4/D4 14 A5/D5 15 A6/D6 16 A7/D7 38 A12 37 A13 36 A14 35 A15 39 A11 40 A10 41 A9 42 A8 } IC2 MC68HC24FN STRA 7 STRB 18 PC0 PC1 PC2 PC3 PC4 PC5 PC6 PC7 8 9 10 11 13 14 15 16 PA0 PA1 PA2 PA3 PA4 PA5 PA6 PA7 EXTAL XTAL E0 E1 E2 E3 E4 E5 E6 E7 43 45 47 49 44 46 48 50 7 8 PB4 PB5 PB6 PB7 PB3 PB2 PB1 PB0 PORT A } IOTEST 1 2 12 IC3-D 11 13 HC00 VDD 14 1C3-A HC00 3 7 VSS 2 VSS 29 VSS PORT E 1C4 HC373 VDD 1 OE 11 LE 3 4 D0 7 D1 D2 8 D3 13 D4 14 D5 17 18 D6 D7 20 4 IC3-B 6 5 HC00 IC5 2864A 1 28 20 VDD CE 22 CE 27 WE 10 D0 11 A0 9 A1 D1 12 8 A2 D2 13 7 A3 D3 15 6 A4 D4 16 5 A5 D5 17 4 A6 D6 18 3 A7 D7 19 25 A8 24 A9 21 A10 23 A11 2 A12 26 A13 VSS VSS 14 VDD C3 0.1 F VSS 00 01 02 03 04 05 06 07 10 2 5 6 9 12 15 16 19 10 IC3-C 9 HC00 A0 A1 A2 A3 A4 A5 A6 A7 8 PORT C VDD 6 5 4 3 44 A12 A13 A14 A15 CS VSS R1 10 k R2 10 k R3 10 k R4 10 k R5 10 k R6 10 k R7 10 k R8 10 k PORT B } } MOTOROLA M68HC11 EEPROM Programming from a Personal Computer 9 VDD VDD 26 51 0.
CODE/DATA FIELD CONTAINS OPTIONAL DESCRIPTIVE INFORMATION. (Len) = $14 MEMORY LOAD ADDRESS FIELD.BOO" CLRLN$=SPACE$(80) VER$="1. Figure 5. JUST A CHECKSUM. Ldlo) = $C01E S1 14 C01E0B29BDC02A 18386A3B6F3B391 80926FC39 DE CODE/DATA FIELD 0 TO N BYTES OF CODE/DATA APART FROM THE LETTER S AT THE START.BAS 20/3/87 Version 1. designed to program either internal or external’ ’ EEPROM in the 68HC11’s memory map’ ’ The loader can also verify memory against an S record file. S9 — TERMINATION RECORD: LOAD ADDRESS FIELD CONTAINS OPTIONAL EXECUTION ADDRESS. (Ldhi.AN1010/D Figure 5 shows the general format of S record files. RECORD TYPE: S0.’ ’ Downloaded data is optionally echoed on terminal. Motorola East Kilbride’ ’ Motorola Copyright 1987’ ’ This program downloads S record file to the M68HC11 through special’ ’ bootstrap program. OR S9 S0 — HEADER RECORD: LOAD ADDRESS FIELD = $0000. ALL CHARACTERS IN THE RECORDS ARE HEXADECIMAL DIGITS REPRESENTED IN ASCII FORMAT. NUMBER OF HEX CHARACTERS FOLLOWING. CHECKSUM ALGORITHM: LSB OF [ Len + Ldhi + Ldlo = ∑ byte ] k k=0 Note: The S record programmer in this application ignores the checksum byte.’ ’ =================================== CR$=CHR$(13) MIN$=CHR$(32) MAX$=CHR$(127) ERM$="Can’t find " LOADER$="EEPROGIX. S-Record Format } CHECKSUM BYTE n 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 ’ ******* EELOAD. THERE IS NO CODE/DATA FIELD.0": ’Version number of EELOAD’ ERRTOT%=0: ’Number of errors found by verify operation’ CLS 10 M68HC11 EEPROM Programming from a Personal Computer MOTOROLA . CODE/DATA FIELD CONTAINS EXECUTABLE CODE OR DATA. S1 — CODE/DATA RECORD. S1.0 *******/ ’ Written by R.Soja.
ECHO$ 450 WEND 470 ROW=CSRLIN: ’Store current line number’ 480 EEOPT$=" ": ’Initialise option char’ 490 WHILE EEOPT$<>"X" AND EEOPT$<>"I" and EEOPT$<>"V" 500 510 GOSUB 1070 LINE INPUT "Select Internal. and COM1 or COM2 is connected to the SCI" OPEN LOADER$ FOR INPUT AS #2 CLOSE #2 ON ERROR GOTO 0 CHAN$="0" ROW=CSRLIN: ’Store current line number’ WHILE CHAN$<>"1" AND CHAN$<>"2" GOSUB 1070 LINE INPUT "Enter COM channel number (1/2):".N.:NEXT I%PRINT: ’Clear DOS commands from screen’ ECHO$=" " WHILE ECHO$<>"Y" AND ECHO$<>"N" GOSUB 1070 LINE INPUT "Do you want echo to screen (Y/N):". eXternal or Verify EEPROM option (I/X/V):".EEOPT$ 520 WEND 530 OPT$="Verify" 540 IF EEOPT$="I" THEN OPT$="Internal" 550 IF EEOPT$="X" THEN OPT$="External" 560 ROW=CSRLIN: ’Store current line position in case of file error’ 570 RXERR=0: ’Initialise number of RX errors allowed’ 580 ON ERROR GOTO 910 590 GOSUB 1070 MOTOROLA M68HC11 EEPROM Programming from a Personal Computer 11 . ensure 68HC11 is in bootstrap mode." RESET is off.1" SHELL "COPY "+LOADER$+" "+CM$ GOSUB 1070 FOR 1%=1 to 4:PRINT CLRLN$.AN1010/D Emulator Address Decoding 190 200 210 220 230 240 250 260 270 280 290 300 310 320 330 340 350 360 370 380 390 400 401 402 410 420 430 440 PRINT " <<<<<<<< EELOAD Version "." >>>>>>>>" PRINT " <<<<<<<< 68HC11 Internal/External EEPROM loader/verifier >>>>>>>>" PRINT PRINT "==> PRINT " PRINT ’ First make sure loader program is available’ ON ERROR GOTO 880 Before continuing.VER$.CHAN$ WEND CM$="COM"+CHAN$ ’ Now set baud rate to 1200 and load EEPROG through boot loader’ ’ by executing DOS MODE and COPY commands’ SHELL "MODE "+CM$+":1200.8.
HEX$(ASC(C$)).F$.EEOPT$.OPT$. 690 GOSUB 990: ’Read char into B$’ 700 ’Transmit Internal.F$.AN1010/D 600 IF OPT$="Verify" THEN INPUT "Enter filename to verify: ".F$ 610 CLOSE 620 OPEN F$ FOR INPUT as #2 630 ON ERROR GOTO 0 640 ’COM1 or 2 connected to SCI on HC11’ 650 OPEN CM$+":9600. ’No echo to screen’ 785 NEXT I% 787 IF E% THEN PRINT 790 WEND 795 PRINT 800 PRINT "Download Complete" 810 IF V% THEN PRINT ERRTOT%.MID$(S$.1).1" AS #1 660 ’Establish contact with HC11 by sending CR char & waiting for echo’ 670 ON ERROR GOTO 860: ’Clear potential RX error’ 680 PRINT #1."> to: ".:GOSUB 990:IF E% THEN PRINT B$.N.CR$.S$ L%=LEN(S$) FOR I%=1 to L% PRINT #1." error(s) found" 820 CLOSE #2 830 SYSTEM 840 END 850 ’ ------------------’ 860 IF RXERR>5 THEN 940 ELSE RXERR=RXERR+1:RESUME 610 870 ’ ------------------’ 880 PRINT:PRINT ERM$.:GOSUB 990: 720 ON ERROR GOTO 930 730 PRINT "Starting download of <". IF V% THEN GOSUB 1030:IF C$<>"" THEN PRINT ":".8.I%.LOADER$:PRINT "Program aborted" 890 GOTO 830 900 ’-------------------’ 910 PRINT ERM$." Eeprom" 732 IF ECHO$="Y" THEN E%=1 ELSE E%=0 734 IF EOPT$="V" THEN V%=1 ELSE V%=0 740 WHILE NOT EOF(2) 750 751 752 760 770 INPUT #2.SPACE$(40) 920 RESUME 580 930 ’-------------------’ 940 PRINT:PRINT "Communication breakdown: Download aborted" 950 GOTO 820 12 M68HC11 EEPROM Programming from a Personal Computer MOTOROLA .External or Verify EEPROM option char to 68HC11’ 710 PRINT #1.F$ ELSE INPUT "Enter filename to download:".
This means that data * * polling is active on each byte written to the EEPROM.#1):RETURN 1010 1020 1025 ’-------------------’ ’--SUB waits for received character. with time limit’ 980 ’-returns with char in B$. * MOTOROLA M68HC11 EEPROM Programming from a Personal Computer 13 .1. East Kilbride * Motorola Copyright 1987. or null in C$ if time limit exceeded’ 1030 T0%=0:C$="":WHILE LOC(1)=0 AND T0%<1:T0%=T0%+1:WEND 1040 IF LOC(1)>0 THEN C$=INPUT$(1. * * Because the serial communication rate (~1mS/byte) is * * slower than the 2864 internal timer timeout rate (~300µs) * * page write mode cannot be used.0 * * * Written by R. * * * * When the internal EEPROM is programmed.ASC 19/3/87 Revision 1. with time limit’ ’-returns with char in C$. * * In this case. * * As the host software always waits for the echo before * * downloading the next byte. * * after an initial delay of approx 500µs. host transmission is suspended * * during the data polling period.AN1010/D Emulator Address Decoding 960 ’-------------------’ 970 ’--SUB waits for received character. * Each byte loaded is echoed back to the host. * * or to the 68HC11’s internal EEPROM. data polling is used to detect* * completion of the programming cycle. * * * * * This program loads S records from the host to * either a 2864 external EEPROM on the 68HC11 external bus. instead of data * * polling. the 500µs delay is not required and is * * bypassed. Motorola.1:RETURN 1100 1 A 2 A 3 A 4 A 5 A 6 A 7 A 8 A 9 A 10 A 11 A 12 A 13 A 14 A 15 A 16 A 17 A 18 A 19 A 20 A 21 A 22 A 23 A 24 A 25 A 26 A 27 A ’-------------------’ ************************************************************************************************************************ * * EEPROGIX. each byte is verified after programming. * * * * When programming a 2864. or aborts if time limit exceeded’ 990 T0%=0:WHILE LOC(1)=0:IF T0%>100 THEN 940 ELSE T0%=T0%+1:WEND 1000 B$=INPUT$(1.1.#1):ERRTOT%=ERRTOT%+1 1050 RETURN 1060 1070 ’-------------------’ ’--SUB Clear line ’ 1080 LOCATE ROW. It can also be used * * verify memory contents against an S record file or just * load RAM located on the 68HC11’s external bus.Soja.1:PRINT CLRLN$ 1090 LOCATE ROW.
* * separated by a colon. It * * is the responsibility of the host downloader program to * * detect this condition and take remedial action. * * * Data transfer is through the SCI. apart from the normal echo * * back of each character. all differences between memory * * and S record data are also sent back to the host. i. configured for 8 data * bits. * * * The BASIC program EELOAD just displays a ’Communication * breakdown’ message. and terminates the program. * * 14 M68HC11 EEPROM Programming from a Personal Computer MOTOROLA . and * * perform the action required. * * * * When used in the verify mode. * * The host software must be capable of detecting this. the program effectively hangs up. * * * * Before receiving the S records. * PAGE * Constants TDRE RDRF MDA SMOD ms10 us500 * * Registers BAUD SCCR1 SCCR2 SCSR SCDR PPROG HPRIO EQU EQU EQU EQU EQU EQU EQU $2B $2C $2D $2E $2F $3B $3C EQU EQU EQU EQU EQU EQU $80 $20 $20 $40 10000/3 500/3 10ms delay with 8MHz xtal.e. 500us delay. 9600 baud.AN1010/D 28 A 29 A 30 A 31 A 32 A 33 A 34 A 35 A 36 A 37 A 38 A 39 A 40 A 41 A 42 A 43 A 44 A 45 A 46 A 47 A 48 A 49 A 50 A 51 A 52 A 53 A 54 A 55 A 56 A 57 A 58 A 59 A 60 A 61 A 62 A 63 A 64 A 65 A 66 A 67 A 68 A 69 A 70 A 002B 002C 002D 002E 002F 003B 003C 0080 0020 0020 0040 0D05 00A6 * If a failure occurs.: ASCII ’X’ for external EEPROM ASCII ’I’ for internal EEPROM ASCII ’V’ for verify EEPROM * * * * * * * * This program is designed to be used with the BASIC EELOAD * program. * * * The BASIC loader program EELOAD simply displays the * returned erroneous byte adjacent to the expected byte. a code byte is received * * from the host.
X SCCR2.#SMOD and then expanded mode. then change option to 1 If external EEPROM requested Default to internal EEPROM: EEOPT=0. Offset for control registers. Then check control byte for external or internal EEPROM selection. CMPB BNE DEC #’V’ ReadOpt EEOPT If not verify then get next character else make EEOPT flag negative. Initialise SCI for 8 data bits.X. EQU BSR CMPB BNE BSR CMPB BEQ * READC #’S LOAD READC #’1 LOAD1 Wait until S1 or S9 received. MASK=$FF.#MDA Force Special Test mode first. 107 A 002E 8D62 108 A 0030 C153 109 A 0032 26FA 110 A 0034 8D5C 111 A 0036 C131 112 A 0038 2719 MOTOROLA M68HC11 EEPROM Programming from a Personal Computer 15 . 9600 baud ORG RMB RMB RMB RMB $0 1 1 1 1 75 P 0000 0001 76 P 0001 0001 77 P 0002 0001 78 P 0003 0001 79 A 80 A 81 A 82 A 0000 8E00FF 83 A 0003 CE1000 84 A 0006 6F2C 85 A 0008 CC300C 86 A 000B A72B 87 A 000D E72D 88 A 000F 1C3C20 89 A 90 A 91 A 0012 9F00 92 A 0014 8D7C 93 A 0016 C149 94 A 0018 2714 95 A 001A C158 96 A 001C 2609 97 A 001E 7C0000 98 A 0021 8680 99 A 0023 9701 100 A 0025 2007 101 A 102 A 0027 C156 103 A 0029 26E7 104 A 002B 7A0000 105 A 106 A 002E * LOAD * OptVerf *=>> MAINTAIN SPECIAL TEST MODE TO ALLOW B96D CONFIG REGISTER PROGRAMMING <<== * ReadOpt BCLR HPRIO. (From Bootstrap mode) STS BSR CMPB BEQ CMPB BNE INC LDAA STAA BRA <EEOPT READC #’I’ LOAD #’X’ OptVerf EEOPT #$80 <MASK LOAD and select mask for data polling mode.X HPRIO. Note: They overwrite initialisation code!!!! 0000 EEOPT MASK TEMP LASTBYTE * * Program 0000 ORG LDS LDX CLR LDD STAA STAB BSET $0 #$FF #$1000 SCCR1.AN1010/D Emulator Address Decoding 71 A 72 A 73 A 74 A 103F CONFIG * EQU $103F * Variables.X. discarding checksum of previous S1 record.X #$300C BAUD.
Adjust it for first time thru’ LOAD2 loop. then don’t program byte! If internal EEPROM option selected then program else just store byte at address. including checksum. When all bytes done. LOAD9 #0 * .AN1010/D 113 A 003A C139 114 A 003C 26F0 115 A 003E 8D5F 116 A 0040 17 117 A 0041 8002 118 A 0043 8D6B 119 A 0045 8D58 120 A 0047 4A 121 A 0048 26FB 122 A 004A 188C0000 123 A 004E 27FE 124 A 0050 186E00 125 A 126 A 0053 * LOAD1 LOAD9 CMPB BNE BSR TBA SUBA BSR BSR DECA BNE CPY BEQ JMP #’9 LOAD RDBYTE Complete reading S9 record before terminating #2 GETAD RDBYTE # of bytes to read including checksum.Y If verifying. LOAD RDBYTE get next S record (discarding checksum) else read next data byte into ACCB. WAIT1 .Y <LASTBYTE <MASK DATAPOLL Now either wait for completion of programming programming cycle by testing MS bit of last data written to last data written to memory or just verify internal programmed data.Y If execution address =0 then hang up else jump to it! EQU BSR TBA SUBA BSR DEY BRA * RDBYTE Read byte count of S1 record into ACCB and store in ACCA #3 GETADR Remove load address & checksum bytes from count Get load address into X register. Get execution address in Y Now discard remaining bytes. LOAD1B 127 A 0053 8D4A 128 A 0055 17 129 A 0056 8003 130 A 0058 8D56 131 A 005A 1809 132 A 005C 2017 133 A 134 A 005E D600 135 A 0060 2B25 136 A 0062 2705 137 A 0064 C6A6 138 A 0066 5A 139 A 0067 26FD 140 A 0069 18E600 141 A 006C D803 142 A 006E D401 143 A 0070 26F7 144 A 0072 4A 145 A 0073 27B9 146 A 0075 8D28 147 A 0077 1808 148 A 0079 7D0000 149 A 007C 2B05 150 A 007E 2743 151 A 0080 18E700 LOAD1B LOAD1E DATAPOLL WAIT1 * LOAD1A LDAB BMI BEQ LDAB DECB BNE LDAB EORB ANDB BNE DECA BEQ BSR INY TST BMI BEQ STAB EEOPT VERIFY DATAPOLL #us500 Update CC register If not verifying EEPROM then If programming external EEPROM then wait 500us max. 16 M68HC11 EEPROM Programming from a Personal Computer MOTOROLA . Advance to next load address EEOPT LOAD1D PROG .
X SCSR.X. X. READAC HEXBIN 1st read MS nibble Convert to binary and move to upper nibble <TEMP READC HEXBIN <TEMP Return with byte in ACCB * Save byte counter RDBYTE RDBYTE Read MS byte of address and put it in MS byte of ACCD Now read LS byte of address into LS byte of ACCD Put load address in Y Restore byte counter and return.* SCDR.* Read next char ACCA.#TDRE.AN1010/D Emulator Address Decoding 152 A 0083 D703 153 A 0085 20D7 154 A 155 A 0087 18E600 156 A 008A D103 157 A 008C 27E4 158 A 008E 8D08 159 A 0090 20E0 160 A 161 A 0092 LOAD1D STAB BRA <LASTBYTE LOAD1A Save it for DATA POLLING operation. Return with char in ACCB.X and echo it back to host. 162 A 0092 1F2E20FC 163 A 0096 E62F 164 A 0098 1F2E80FC 165 A 009C E72F 166 A 009E 39 167 A 168 A 009F 8DF1 169 A 00A1 8D17 170 A 00A3 58 171 A 00A4 58 172 A 00A5 58 173 A 00A6 58 174 A 00A7 D702 175 A 00A9 8DE7 176 A 00AB 8D0D 177 A 00AD DA02 178 A 00AF 39 179 A 180 A 00B0 181 A 00B0 36 182 A 00B1 8DEC 183 A 00B3 17 184 A 00B4 8DE9 185 A 00B6 188F 186 A 00B8 32 187 A 00B9 39 188 A 189 A 00BA 190 A 00BA C139 191 A 00BC 2302 192 A 00BE CB09 193 A 00C0 C40F HEXNUM * HEXBIN * GETADR * RDBYTE STAB RTS BSR BSR LSLB LSLB LSLB LSLB STAB BSR BSR ORAB RTS EQU PSHA BSR TBA BSR XGDY PULA RTS EQU CMP8 BLS ADDB ANDB SCDR. * VERIFY LDAB CMP8 BEQ BSR BRA * READC EQU BRCLR LDAB WRITEC BRCLR * SCSR. * #’9 HEXNUM #9 #$F If ACCB>9 then assume its A-F Get ASCII char in ACCB MOTOROLA M68HC11 EEPROM Programming from a Personal Computer 17 .Y <LASTBYTE LOAD1E WRITEC LOAD1E If programmed byte is correct then read next byte else send bad byte back to host before reading next byte. .#RDRF. Y regs unchanged by this routine.X.
If byte was CONFIG register then bulk erase.Y Load ACCB with old value.AN1010/D 194 A 00C2 39 195 A 196 A 00C3 197 A 00C3 36 198 A 00C4 8616 199 A 00C6 188C103F 200 A 00CA 2602 201 A 00CC 8606 202 A 00CE 8D10 203 A 00D0 8602 204 A 00D2 8D0C 205 A 00D4 188C103F 206 A 00D8 2603 207 A 00DA 18E600 208 A 00DD 32 209 A 00DE 20A3 210 A 211 A 00E0 * PROGRAM PROGX PROGA RTS * PROG EQU PSHA LDAA CPY BNE LDAA BSR LDAA BSR CPY BNE LDAB PULA BRA LOAD1D * Save ACCA. to allow for A1 &A8 as well as A2. #$16 #CONFIG PROGA #$06 PROGRAM #2 PROGRAM #CONFIG PROGX .X PPROG. Write to required address Enable internal programming voltage 212 A 00E0 A73B 213 A 00E2 18E700 214 A 00E5 6C3B 215 A 00E7 3C 216 A 00E8 CE0D05 217 A 00EB 09 218 A 00EC 26FD 219 A 00EE 38 220 A 00EF 6A3B 221 A 00F1 6F3B 222 A 00F3 39 223 A * WAIT2 #mS10 and wait 10mS DEX BNE PULX DEC CLR RTS PPROG.X Enable internal addr/data latches.X Disable internal programming voltage Release internal addr/data latches and return WAIT2 224 A END 18 M68HC11 EEPROM Programming from a Personal Computer MOTOROLA . to prevent hangup later. Restore ACCA and return to main bit.Y PPROG. Default to byte erase mode If byte’s address is CONFIG then use EQU STAA STAB INC PSHX LDX * PPROG.X . Now program byte. Now byte erase or entire memory + CONFIG.
AN1010/D Emulator Address Decoding SYMBOL TABLE: Total Entries= 41 BAUD CONFIG DATAPOLL EEOPT GETADR HEXBIN HEXNUM HPRIO LASTBYTE LOAD LOAD1 LOAD1A LOAD1B LOAD1D LOAD1E LOAD9 MASK MDA OptVerf PPROG PROG 002B 103F 0069 0000 00B0 00BA 00C0 003C 0003 002E 0053 005E 0075 0083 0072 0045 0001 0020 0027 003B 003C PROGA PROGRA M PROGX RDBYTE RDRF READC ReadOp t SCCR1 SCCR2 SCDR SCSR SMOD TDRE TEMP VERIFY WAIT1 WAIT2 WRITEC mS10 uS500 00CE 00E0 00DD 009F 0020 0092 0012 002C 002D 002F 002E 0040 0080 0002 0087 0066 00EB 0098 0D05 00A6 MOTOROLA M68HC11 EEPROM Programming from a Personal Computer 19 .
Buyer shall indemnify and hold Motorola and its officers. Inc. damages. All operating parameters. directly or indirectly. There are no express or implied copyright licenses granted hereunder to design or fabricate any integrated circuits or integrated circuits based on the information in this document. including without limitation consequential or incidental damages. Inc.com/semiconductors Information in this document is provided solely to enable system and software implementers to use Motorola products. Hong Kong 852-26668334 TECHNICAL INFORMATION CENTER: 1-800-521-6274 HOME PAGE: http://www. and expenses. N. P. Motorola and the Stylized M Logo are registered in the U. and reasonable attorney fees arising out of.K. Ltd. Motorola does not convey any license under its patent rights nor the rights of others. © Motorola. All other product or service names are the property of their respective owners.. Motorola. Inc. 1988. affiliates. Denver. Motorola products are not designed.. Technical Information Center.AN1010/D HOW TO REACH US: USA/EUROPE/LOCATIONS NOT LISTED: Motorola Literature Distribution. intended. Patent and Trademark Office. “Typical” parameters which may be provided in Motorola data sheets and/or specifications can and do vary in different applications and actual performance may vary over time. Tai Po. employees. Motorola makes no warranty. Colorado 80217 1-303-675-2140 or 1-800-441-2447 JAPAN: Motorola Japan Ltd. Minami-Azabu Minato-ku.T. Box 5405. Tai Po Industrial Estate. 2 Dai King Street. Tokyo 106-8573 Japan 81-3-3440-3569 ASIA/PACIFIC: Motorola Semiconductors H. any claim of personal injury or death associated with such unintended or unauthorized use. representation or guarantee regarding the suitability of its products for any particular purpose. even if such claim alleges that Motorola was negligent regarding the design or manufacture of the part. including “Typicals” must be validated for each customer application by customer’s technical experts. Silicon Harbour Centre.motorola.. 2000. or other applications intended to support or sustain life. SPS. or for any other application in which the failure of the Motorola product could create a situation where personal injury or death may occur. 2002 AN1010/D .S. or authorized for use as components in systems intended for surgical implant into the body. subsidiaries. costs. digital dna is a trademark of Motorola. Should Buyer purchase or use Motorola products for any such unintended or unauthorized application. 3-20-1. and specifically disclaims any and all liability. and distributors harmless against all claims. Motorola reserves the right to make changes without further notice to any products herein. is an Equal Opportunity/Affirmative Action Employer.O. nor does Motorola assume any liability arising out of the application or use of any product or circuit.
This action might not be possible to undo. Are you sure you want to continue?
We've moved you to where you read on your other device.
Get the full title to continue reading from where you left off, or restart the preview.