Sie sind auf Seite 1von 8

Application note AN-E005

How to Implement ICP Using ELAN EM78PXXX General Purpose OTP MCUs
Technical Description, Release 1.0

Copyright 2003 Elan Microelectronics Corporation, No. 12, innovation 1st. Rd. Science-Based Industrial Park, Hsinchu City, Taiwan.

The use of this document is limited to: 1. Distribution within your organization. 2. Distribution to potential customers or partners. This authorization is given on condition that any extract of these documents made by you shall retain all proprietary notice, including this copyright notice. The contents of this specification are subject to change without notice. Elan Microelectronics assumes no responsibility for errors that may appear in this specification and makes no commitment to update, or to keep current, the information contained in this specification. The products described herein are not intended for use in life support appliances, devices, or systems. Use of Elan Microelectronics products in such applications is not supported and is prohibited. NO PART OF THIS SPECIFICATION MAY BE REPRODUCED OR TRANSMITTED IN ANY FORM OR BY ANY MEANS WITHOUT THE EXPRESS WRITTEN PERMISSION OF ELAN MICROELECTRONICS. Note that any product, process or technology described in the document may be subject of other intellectual property rights reserved by Elan Microelectronics Corporation or a third party. No right to use such Intellectual Property Right is granted hereunder. Trademarks Elan Microelectronics Corporation and the Elan logo are registered trademarks and service marks or trade names whether registered or not, which may attach to certain words or signs used herein. The absence of such mention, however, in no way implies that there is no protection. Elan Microelectronics Corporation may make improvements or changes in the products or the program described in this document at any time without notice. This page and all content enclosed are Copyright Elan Microelectronics, Hsinchu City, Taiwan.

REVISION HISTORY Version 1.0 Date 24.06.2004 Author Mark Svoboda Description Released

AN-E005-V1.0-page 2

Preliminary

www.elan-europe.com

TABLE OF CONTENTS 1.0 INTRODUCTION 2.0 RE-PROGRAMMING AN OTP MICROCONTROLLER 3.0 ABOUT ELANS EM78P156 4.0 HOW TO IMPLEMENT ICP WITH EM78P156 5.0 APPLICATION CIRCUIT 6.0 PROGRAMMER 7.0 PROGRAMMING ENVIRONMENT 8.0 REPROGRAMMING WITH ELAN OTP MCU EM78P156 9.0 CONCLUSION APPENDIX A: APPENDIX B: PROGRAM EXAMPLE EXAMPLE ICP CIRCUIT 4 4 4 4 5 5 5 6 6 7 8

AN-E005-V1.0-page 3

Preliminary

www.elan-europe.com

1.0 INTRODUCTION
In-circuit programming ICP is a technique that allows a programmable device, a microcontroller for example, to be programmed after the device has been placed or soldered in the circuit board. ICP is a great way to reduce the cost of field firmware upgrades as well as reduce time to market for your product. This solution also allows manufacturers to quickly match microcontroller firmware variations running on the same PCB with actual market demand via last-minute programming. This application note describes a simple way to program Elans family of 8-bit general purpose microcontrollers while the IC is mounted in the application PCB. For purposes of description, this application note describes ICP for Elans popular EM78P156 1K ROM OTP microcontroller while mounted in the PCB. The same technique may also be used for Elans EM78P153, EM78P156N, EM78P257, EM78P447(N), EM78P458, EM78P459, EM78P418N, EM78P419N, and EM78P809N microcontrollers, all of which have very similar OTP programming structures.

2.0 RE-PROGRAMMING AN OTP MICROCONTROLLER


Although by definition OTP microcontrollers can only be programmed one time, this ICP application note also describes a method by which an OTP device can be re-programmed multiple times depending on the size of the firmware as compared to the microcontroller OTP ROM size.

3.0 ABOUT ELANS EM78P156


The EM78P156 is an 8-bit, high-speed RISC microcontroller with 57 instructions for general-purpose applications. It has 1K of OTP program ROM, 48 bytes RAM, and 12 I/O pins. Operating voltage is 2.3 5.5V. It comes in 4 package variations, DIP, SOP, and SSOP with 2 different pinning configurations:

Figure 1: EM78P156 package variation

The EM78P156 is pin and function compatible with Microchip PIC 16C54/55/56 (see Elan application note Replacing Microchips PIC 16C54/55/56/57 with Elan Microelectronics EM78P156/P447).

4.0 HOW TO IMPLEMENT ICP WITH EM78P156


There are three main components of an ICP system: application circuit, programmer, and programming environment.

AN-E005-V1.0-page 4

Preliminary

www.elan-europe.com

5.0 APPLICATION CIRCUIT


For OTP programming, 6 dual-function pins of the microcontroller are required for programming. They are:
Table 1: PIN assignment of EM78P156ELP/ELM

See Appendix B: Example ICP circuit Another important issue is supply voltage. The OTP programming specification states that the MCU should be programmed at 5V. If the application circuits operating voltage is not 5V, the VDD pin should be isolated, and a 5V supply applied to VDD.

Pin Name Pin (programming mode # / operating mode) ACLK / OSCO DATAIN / P50 DINCK / P51 PGMB / OSCI OEB / P67 VPP / RESET 15 17 18 16 13 4

I/O

Function during programming mode

6.0 PROGRAMMER
I I/O I I I I CLK for address increase ROM series Input/Output pin CLK for DATAIN pin Program enable control pin, active low. Output enable control for DATAIN, active low for output. 13 Volt for OTP programming. The second consideration is the OTP programmer and its drive capabilities. DWTR is ELANs standard OTP programmer which has been designed to program the MCU in a socket mounted on the programmer. It has not been designed to drive signals over long connectors. It is therefore recommended that the cable length between the programmer and application circuit should not be longer than 20 centimeters. If the cable length is too long, the programming might be fail due to signal attenuation. Note: for manufacturers wanting to develop their own OTP programming hardware, Elans OTP programming specifications are available free of charge under NonDisclosure Agreement (NDA).

The application circuit must be designed to allow all the OTP programming signals to be connected directly to the EM78P156. Fig. 1 shows an example circuit for implementing ICP with the EM78P156. When designing an application circuit with ICP, several issues must be considered: Isolation of all the programming signal pins from the surrounding circuit. Minimum and maximum operating voltage for VDD. In a typical application circuit, each pin of the MCU might be connected to several other active and/or passive components. Any component still connected to programming pins during programming could cause an OTP programming error. For example, capacitive loading on a programming signal pin could negatively affect the programming signals required rise time. Resistive loading would reduce necessary programming signal voltages. Therefore, the first step to implement the ICP circuit is isolation of all the programming pins. Fig. 1 shows the ICP circuit example. The critical factor in the ICP circuit is how to isolate the 6 programming-related pins without affecting the functionality of the application circuit. EM78P156 needs six pins for OTP programming. All these programming pins need to be isolated during programming. When the EM78P156 is programmed, the /RESET/VPP pin must be supplied with an external 13V DC level. The VPP pin of EM78P156 also functions as the reset pin during normal operation, and is normally connected to an external RC circuit. Therefore it is recommended to use a diode to isolate the VPP pin. The CD4066 is a low-cost bi-directional solid-state electronic switch. The circuit below is configured such that a high voltage (13V) applied to VPP during OTP programming will cause the CD4066, via a transistor inverter (2N3904), to disconnect the 6 other pins which are used for OTP programming. After programming, to insure that the application circuit functions normally, the resistor values must be chosen such that the 2N3904 is switched off during normal operation of the circuit. When designing your application, you should also consider the ON state resistance of the CD4066 switch, which can depend on the supply voltage. Note that electrical isolation of pins may also be achieved by mechanical jumpers, or mechanical switches. This method involves manual intervention before and after ICP programming.

7.0 PROGRAMMING ENVIRONMENT


Different programming environments require different types of programmer, and programming interface. You may rd choose Elans DWTR OTP programmer, a 3 party gang writer, or develop your own ICP hardware. ICP application circuits may need customised connectors to the programmer and to the application PCB, and the cable distance between programmer and application circuit may also affect the drivers ability to provide the correct signals and required current. The cables also need to be shielded to prevent programming signals being corrupted by external noise. After take into consideration the application circuit, the programmer, and the programmer environment, virtually anyone can make a workable, high quality ICP application circuit.

AN-E005-V1.0-page 5

Preliminary

www.elan-europe.com

8.0 REPROGRAMMING WITH ELAN OTP MCU EM78P156


By definition, OTP microcontrollers are not normally reprogrammable. However, there is a method to reprogram Elans OTP MCU so long as it is not write protected after the first programming, and there is enough blank OTP memory remaining to accommodate your desired additional firmware. The EM78P156 has two vectors, reset and interrupt, at locations 0x00 and 0x08 respectively. When the EM78P156 encounters reset or an interrupt occurs, the code location in one of these two addresses is executed. Appendix A: Example 1 shows a sample of list files. The list on the left-hand side in example 1 is the code first programmed into EM78P156. The list on the right-hand side of example 1 is the additional code programmed for the second time. From example 1, if your OTP memory already has firmware programmed into it, and has free remaining space in the OTP memory, which is large enough to accommodate the additional desired code, you could program the remaining blank OTP memory with the new code, and replace the original code with NOPs. First consideration is that you must reserve enough free memory addresses after the rest/interrupt vectors because the location of the jmp commands programmed in the corresponding reset and

9.0 CONCLUSION
Anyone can create a reliable ICP programming circuit by adopting the recommended circuit design and programming techniques previously mentioned. Multiple-time OTP programming can also be achieved with the software technique described in this application note. Elans technical support staff are available to answer any questions you have about the requirements for ICP based on Elans OTP microcontrollers.

AN-E005-V1.0-page 6

Preliminary

www.elan-europe.com

APPENDIX A:
Example1: Firmware list files

PROGRAM EXAMPLE

First Program Memory

Program Opcode Assembly Instruction ORG JMP ORG JMP ORG INTERRUPT: CLRA MOV MOV MOV RETI START: MOV CONTW CLRA IOW IOW MOV MOV IOW MOV IOW ENI JMP 0X00 START 0X08 INTERRUPT 0X0B

Second Program Memory

Program Opcode Assembly Instruction ORG NOP ORG JMP ORG NOP ORG JMP ORG NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP ORG INTERRUPT: MOV MOV MOV RETI START: MOV CONTW CLRA IOW IOW MOV MOV IOW MOV IOW ENI 0X00 0X01 START 0X08 0X09 INTERRUPT 0X0B

00000 00008 00009 0000B 0000C 0000D 0000E 0000F 00010 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 0001A 0001B 0001B

1410 1409

00000 00001

0000 1421

00008 0080 004F 18FF 0046 0013 RF,A A,@0XFF PORT6,A 00009 0000B 0000C 0000D 0000E 0000F 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 0001A 0001B 0001C 0001D 0001E 0001F 00020 00021 00021 00022 00023 00024 00025 00026 00027 00028 00029 0002A 0002B

0000 141C 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000

184F 0002 0080 0005 0006 0046 1840 000E 1804 000F 0010 HERE: 141B

A,@0b01001111

PORT5 PORT6 PORT6,A A,@0b01000000 0X0E A,@0b00000100 0X0F

HERE

0X1C

004F 18FF 0046 0013 184F 0002 0080 0005 0006 0046 1840 000E 1804 000F 0010

RF,A A,@0XFF PORT6,A

A,@0b01001111

PORT5 PORT6 PORT6,A A,@0b01000000 0X0E A,@0b00000100 0X0F

AN-E005-V1.0-page 7

Preliminary

www.elan-europe.com

APPENDIX B:

EXAMPLE ICP CIRCUIT


VDD

R
C

CD4066 EM 78P156
P51

I/O1_A
P50

I/O1_B I/O2_B I/O3_B I/O4_B I/O5_B


To application circuit

D
/RESET/VPP VSS

I/O2_A
OSCI

I/O3_A
OSCO

I/O4_A
VDD

I/O5_A
P67

VDD

Control Pin

2N3904

ICP Connector ICP connector

AN-E005-V1.0-page 8

Preliminary

www.elan-europe.com

Das könnte Ihnen auch gefallen