AN-881
One Technology Way • P. O . Box 9106 • Norwood, MA 02062-9106, U.S.A. • Tel : 781.329.4700 • Fax: 781.461.3113 • www.analog.com
APPLICATION NOTE
Flash/EE Memory Programming via LIN—Protocol 4
by Aude Richard
INTRODUCTION
A key feature of the ADuC7034 is the ability to download code
to on-chip Flash/EE memory while in-circuit. This in-circuit
code download is performed via the LIN communications bus.
This application note describes the download protocol implemented on the ADuC7034 (Protocol 4) to enable users to
develop their own LIN programming tools either for series
production programming or for application updates.
The term host refers to the host machine (microcontroller,
DSP, or other machine) attempting to download data to the
ADuC7034. The term loader refers specifically to serial
download firmware resident on the ADuC7034.
Note that this application note describes Protocol 4 only.
Protocol 6 is described in the AN-946 Application Note
Programming Flash/EE Memory via LIN—Protocol 6,
available from www.analog.com.
The protocol is shown on the part branding on Line 3
(see Table 1 ). A40 refers to a released version of Protocol 4
whereas A60 refers to a released version of Protocol 6.
Table 1. Branding Example
Line LFCSP
Line 1 ADuC7034
Line 2 BCPZ
Line 3 A40 #date code
Line 4 Assembly lot number
This protocol is LIN 2.0 compatible at 19.2 k baud, transmitting
8 bytes of data per packet. It is estimated that this protocol erases
and downloads 30,000 bytes to an ADuC7034 device in
approximately 35.9 secs.
RUNNING THE ADuC7034 LOADER
To enable an unattended download via LIN, the ADuC7034
enters loader mode only if NTRST is low during reset and the
content of Flash/EE memory at Address 0x00080014 is not
0x27011970 or the Page 0 checksum, as illustrated in Figure 1.
Normally, NTRST is kept low and entry to download mode
is determined by the content of Flash Address 0x00080014.
Typically, in user applications, the value at Flash Address
0x00080014 is not 0xFFFFFFFF; therefore, user code must
have a built-in mechanism for corrupting Address 0x00080014
or erasing Page 0 (Flash Address 0x0 to Flash Address 0x200)
and for resetting the part. This mechanism allows entry to
download mode to reprogram the part. Ideally, the value at
Flash Address 0x00080014 should be programmed last to
enable re-entry to download mode in case the power fails or
another error occurs during reprogramming of the bulk of the
program.
The checksum of Page 0 is simply the sum of all the half words
in Page 0 excluding the two half words of the word at Address
0x00080014. This sum must be stored at Address 0x00080014.
Rev. 0 | Page 1 of 8
AN-881 Application Note
TABLE OF CONTENTS
Introduction ...................................................................................... 1
Running the ADuC7034 Loader..................................................... 1
User Code and System Code Requirements ............................. 4
Assigning PIDs via LIN ............................................................... 4
LIN Download Protocol Commands ........................................ 5
Secure Write Frames .................................................................... 5
Address Write Frames ...................................................................6
Verify Command Checksum Calculation ..................................6
Data Write Frame ..........................................................................7
Status Read Frame .........................................................................7
Additional Information ................................................................8
Rev. 0 | Page 2 of 8
Application Note AN-881
INITIALIZE ON-CHIP
PERIPHERALS TO FACTORY
CALIBRATED ST ATE
PAGE ERASED?
0x14 = 0xFFF FFFFF
YES
LIN COMMAND
NO YES
NO
NO
YES
JTAG MODE?
NTRST = 1
KEY PRESENT?
0x14 = 0x27011970
NO
CHECKSUM PRESENT?
0x14 = CHECKSUM
NO
FLAG PAGE 0 ERROR
NO
RESET
COMMAND
YES
YES
ERASE PAGE 0
SOFTWARE
RESET
Figure 1. Entering Download Mode
Rev. 0 | Page 3 of 8
06446-001