Programming EPROM and EEPROM on the 6811 EVM 7/3/92 Brian Scott Crow In response to a flurry of activity and questions, I will try to explain the correct methods for programming user code or data into the internal EPROM and EEPROM on the 6811. First let me clear up some confusing terminology. The resident microcontroller (MCU) is the 6811 located in socket U2. In addition to the resident MCU, EVMBug should be installed on a 16KByte EPROM located in socket U16. An 8KByte RAM should be installed in socket U17 for use as the Pseudo ROM. If you are using an E-series part (such as E0, E1, E2, or E9), another 8KByte RAM should be installed in socket U15. This area is user available for A-series parts (such as the A0, A1, or A8) for expanded mode operation. The concept of Pseudo ROM comes from the desire to emulate MCU's with different on chip memory configurations. We want to emulate MCU's with up to 16KBytes of ROM, OTPROM, EPROM, or EEPROM, while retaining the ability to debug and change user code with relative ease. This is implemented with RAM chips and write protection from user code only. Note that the monitor can still access, corrupt, or modify contents of the Pseudo ROM. These RAM chips can also be disabled. To disable the RAM in socket U15, simply remove the physical device from the socket. To disable the RAM at socket U17, remove the jumper from J10. To disable the Pseudo EEPROM, remove the jumper from J11. Remember that EEPROM is first controlled by the CONFIG register EEON bit. The CONFIG register should contain $0C to turn off the internal EEPROM and access the Pseudo EEPROM. Contrary to popular belief, an A series part in the resident MCU socket (U2) can be used to program an E series part in the programming socket (U32 or U56), and vice-versa. CAUTION: The jumper J20 selects the memory map used for the resident MCU. Be careful to only program locations of EPROM and EEPROM in the map of the programming socket. The jumper J20 must be applied to pins 1 and 2 to select the memory map for the resident MCU for an A-series part or pins 2 and 3 for an E-series part. One common problem in programming parts on the EVM is a noisy clock line from the oscillator circuit to the programming socket. This can be improved by cutting C26 off of the board and shorting across R22. These revisions apply to boards up to and including Rev G (the most recent Rev). These modifications will help alleviate noise on the clock lines necessary to program parts. Make sure that the serial cable from the PC is connected to the Terminal port of the EVM. The Host port is used only in Transparent Mode to download code from a different Host server. The next item of interest and question is the application of power to the EVM board. EEPROM programming is made possible by a charge pump on board. EPROM programming requires a Vpp of +12 Volts dc to operate properly. This Vpp of +12 Vdc must be applied through a 100 Ohm resistor to provide current limiting. In summary, apply to connector J5, Vpp=+12 Vdc through 100 Ohms, +5 Vdc, -12 Vdc, +12 Vdc, and Gnd. This setup will allow programming of the EPROM and the EEPROM. Note that if you are only programming EEPROM, the Vpp connection is not required. To program parts, we must next generate some object code to download. This can be easily done using a Freeware crossAssembler from our bulletin board at 512-891-FREE or by using the supplied software like IASM11. IASM11 is particularly convenient because of the built in communications software. Any assembler used must be able to generate S record format object files. S records are discussed at the end of any user manual for one of Motorola's programming boards. Assemble your code and ensure that an S record file has been generated. It should automatically have the .S19 extension and reside in the directory of your source code. If the code is to be programmed into the EEPROM, make sure the program is ORG B600 or another address in the EEPROM. Likewise, if programming the EPROM ORG the program to an appropriate address in EPROM like E000 or C000 depending on the part (how much EPROM is available at the high end of memory). We will now take a look at the proper steps to program and verify the EPROM and EEPROM of the MCU in the programming socket. 1. With power disconnected from the EVM board, insert the MCU to be programmed into the programming socket (U32 or U56). The chip should be face up with the notch in the upper left corner. Make sure that Switches S4 and S5 are in the Reset and Off states respectively ( to the right when the red switches are at the top). 2. Reapply power to the EVM board in the manner discussed above. Begin executing software to communicate with the board ( IASM11 or ProComm+). 3. Depress and release the Master Reset (Switch S3). Hit Carriage Return on the keyboard. If the board and PC are communicating correctly you should see a display of the registers and an EVMBug prompt. 4. To download the previouysly assembled S record object file, type the command to the EVM board: LOAD T to tell the board that you are about to load an S record file from the terminal port. Then send the file via your communications program. (In IASM11 press F7 to open communications window, then hit F6 to begin downloading. At the prompt, enter the file to be downloaded, e.g. Sample.S19. Successful completion can be verified by visually making sure that the last line of S records was S9030000FC. Hit return to end the download. Ignore the Illegal Command Error that follows. If the download was not successful, check the power, the serial cable, the communications protocol (8 data, No parity, 1 stop bit), and the Comm port. Repeat #3 and #4. 5. You may also visually verify the download by executing the monitor command MD (address) where address is the beginning of your program. If the contents do indeed match your intended object code, you can be doubly secure of the download. 6. Apply power to the programming socket by placing Switch S5 to the PWR position. 7. Depress and release the Master Reset (Switch S3). Hit Carriage Return on the keyboard. If the board and PC are still communicating correctly you should see a display of the registers and an EVMBug prompt. 8. Place Switch S4 in the OUT position to remove the reset condition from the programming socket. 9. Now any of the commands BULK, CHCK, COPY, ERASE, PROG, or VERIFY can be entered using the syntax of the EVM users manual. Several examples are listed below: ____________________________________________________________ prog b600 b7ff ;program bytes b600 b7ff with the ;contents of Pseudo EEPROM MC68HC11 NOT BLANK ENTER RETURN TO CONTINUE ;if data is already there, return ;will continue programming, any ;other key will terminate VERIFY COMPLETE ;programmed successfully ____________________________________________________________ prog 103f 103f 0c ;put 0c into CONFIG register MC68HC11 DOES NOT VERIFY ;the CONFIG register cannot be > ;verified in this manner copy 103f 103f e000 ;copy contents of CONFIG to a RAM ;location, then verify visually md e000 ;by looking at new contents ____________________________________________________________ prog e000 ffff ;program bytes e000 ffff with the ;contents of Pseudo EPROM VERIFY COMPLETE ;message indicates successful ;EPROM programming ____________________________________________________________ Other examples are provided in the EVM User's Manual in Chapter 3. 10. Remove power to the programming socket by replacing Switch S5 to the OFF position. 11. Remove the programmed device from the programming socket. Congratulations, you have programmed one of the most versatile microcontrollers in the 6811 family. Further assistance may be available by calling the AMCU applications engineering group at (512) 891-3927. Good luck on your next project!!!