Upload
others
View
4
Download
0
Embed Size (px)
Citation preview
AN728Remote Keyless Entry and Convenience Center Reference
OVERVIEWThis Application Note describes the working of aKEELOQ® code hopping decoder implemented on aMicrochip mid-range MCU (PIC16F873). The softwareimplements a stand-alone decoder integrated with aconvenience center master microcontroller. Thedecoder supports the Microchip's HCS200, HCS201,HCS300, HCS301, HCS360, and HCS361 KEELOQhopping code encoders. The decoder supports normaland secure learning. Two manufacturer's codes allowdifferent manufacturers to share a public key, but retaintheir own private keys.
This design has been optimized to integrate into eitheran existing model platform without modification to thewiring harness (piggybacks onto original), or can beused with a new model with multiplexed wiring usingthe LIN standard. Operational flexibility is key to overallconcept with many scalable features that can be cus-tomer, dealer, or factory end-of-line programmable.
This system has, additionally, been presently installedin a vehicle that has been completely retrofitted withRemote Keyless Entry (RKE) and power seat memorymodules. This platform will also be used to test thefuture lighting control and engine immobilizer modules.
FEATURES• Supports two manufacturer's codes• Compatible with Microchip's HCS200, HCS201,
HCS300, HCS301, HCS360 and HCS361 encoders.
• Automatic baud rate detection• Automatic Normal or Secure learn detection• Six learnable transmitters• LIN Network Functions
- Operates boot (trunk) lock remotely- LIN master node- Flash parking lights upon lock or unlock com-
mand- Flash headlamps (n-times to forever)
• Can be added to existing wiring harness without modification
The LIN (Local Interconnect Network) protocol wasdevised to address low cost automotive networks. TheLIN standard is meant to replace the myriad of low-endmultiplex wiring solutions in current use.
The LIN standard includes the specification of thetransmission protocol, the transmission medium, theinterface between, development tools, and theinterfaces for software programming.
FIGURE 1: RKE SYSTEM
Notice: This is a non-restricted version of Application Note AN728 which is available under the KEELOQ LicenseAgreement. The license agreement can be ordered from the Microchip Literature Center as DS40149.
Author: Chuck SimmersMicrochip Technology Inc.
Relay
DC-DCConverter
RFReceiver
InputProtectionNetworks
PIC®
Microcontroller
LIN BusXcvr
LIN Bus
High-SideDrivers
Relay
Light Driver
Relay
Relay
Relay
Door and Boot LockDriver Door UnlockPassenger Door UnlockBoot Unlock
Courtesy Lights
Ride Height Leveling
VCCVBAT
VIGN
Unlock Sense
KeyFob
Door Jam
Design with LIN Bus Interface
© 2011 Microchip Technology Inc. DS00728B-page 1
AN728
FIGURE 2: SYSTEM BLOCK DIAGRAMOPERATIONAL FEATURESFor optional features refer to Section "Customer OptionProgramming"
Locks
LOCK AND UNLOCK WITH DOOR SWITCHES
• One UNLOCK push of driver's door switch unlocks passenger doors, second push within 4 seconds unlocks driver's side. (Option: UNLOCK operates all doors, simultaneously)
• Push of passenger's UNLOCK switch only unlocks passenger doors. (Option: if above option is selected, passenger's UNLOCK operate all doors)
• Push of any LOCK switch locks all doors and boot.
LOCK AND UNLOCK WITH RKE FOB
• One push of RKE UNLOCK switch unlocks driver's door, second push within 4 seconds unlocks passenger doors. (Option: RKE UNLOCK operates all doors, simultaneously)
• One push of RKE LOCK switch locks all doors and boot.
• One push of RKE BOOT switch unlocks and opens boot lid.
AUTO-LOCK/UNLOCK (OPTIONALLY ENABLED)
• All doors unlock when ignition is turned off. (Option: when ignition key is removed)
• All doors lock when transmission has DRIVE selected. (Option: when vehicle speed reaches 20 mph (32 kph) and DRIVE selected)
• All doors and boot lock after 0-100 seconds (pro-grammable) after ignition key is removed and all doors have been closed. (Option: disabled)
• If above Auto-lock mode is selected, then if any windows are not fully closed, close all windows. (Option: disabled)
• Boot is automatically locked whenever closed. (Option: disabled)
Remote Keyless EntryConvenience Module
Door Locks
Door ControlModule
MirrorsBoot Lock
Transmitter
WindowMotors
TransponderReceiver
Seat PositionControl Module
Transponder
Security SystemModule
Motion SensorsOpening DetectorsGlass Breakage Sensors
Lighting ControlModule
IgnitionImmobilisor
ModuleLIN bus
DS00728B-page 2 © 2011 Microchip Technology Inc.
AN728
LightingCOURTESY LIGHTS
• On whenever a door is open.• On half intensity for 0-30 seconds (programma-
ble) or until a door is opened, when ignition is switched off. (Option: disabled)
• Dimming to off (0-30 seconds, programmable) when all doors closed. (Option: off immediately, no dimming)
• Off immediately when ignition is switched on.• On for 0-30 seconds (programmable) or until a
door is opened when RKE unlocks any doors.• Off immediately when RKE locks all doors.
HEADLIGHTS
• If headlights are on, keep on for 0-90 seconds (settable by instrument panel control) after ignition is switched off.
• If ambient light is low, and RKE unlocks any doors, headlights on for 0-30 seconds (program-mable) or until ignition is switched on. (Option: disabled or sidelights only)
SIDELIGHTS
• Flash for 1 second whenever RKE locks or unlocks doors. (Option: disabled)
Seats and MirrorsWhenever the driver's door is unlocked by the RKE, thedriver's seat positioning system and the rearview mir-rors will be commanded to assume a position stored intheir respective nonvolatile memories. The positionnumber is selected by decoding the serial number ofthe RKE transmitter. Thus several different transmitterfobs can command their own unique settings. (Option:disabled)
A given seat/mirror setting can be associated to a spe-cific transmitter, by the following sequence.
1. Adjust seat and mirrors to desired position.2. With the ignition switch on, press the LOCK and
UNLOCK switches on the selected RKE fobsimultaneously.
These settings are now associated with this transmitter.
Remote Transmitter LEARN FunctionLearning is a feature that allows the addition of newtransmitters to the system without the need to repro-gram the system. During the learning process, thedecoder identifies the transmitter and stores itsparameters (cryptographic key and synchronizationinformation) in EEPROM for future use. If the transmit-ter is activated again, the decoder will recognize thetransmitter and respond to it normally.
The decoder's learning capabilities simplify replace-ment of lost transmitters. When a transmitter is lost, theuser can "teach" the decoder the crypto-key of a newtransmitter bought off the shelf. When a transmitter islost, it is advisable to erase and relearn all existingtransmitters to ensure that the lost transmitter is deniedaccess to the system.
Learning a transmitter by a decoder is a two-phase pro-cess. During the learn process, a cryptographic key isgenerated by the decoder. The crypto-key is storedwith the serial number and synchronization informationafter the crypto-key has been verified.
The crypto-key generation process has three inputs.The first is the source of the crypto-key generation. Thesource can be the encoder's serial number (normallearn) or the encoder's seed (secure learn). The nextinput is the crypto-key generation algorithm. The thirdinput to the system is a manufacturer's crypto-key. Themanufacturer's crypto-key tailors the crypto-keygeneration algorithm to a specific manufacturer. Thiscustomizing of the crypto-key generation algorithmmeans competitors can not clone transmitters for asystem.
Two transmissions are needed by the decoder duringlearn; one is used to generate a crypto-key and thesecond, to validate the generated crypto-key. If theuser uses the serial number as the crypto-key genera-tion source, then both transmissions will be normalhopping code transmissions. If the user chooses to usesecure learn (seed as the crypto-key generationsource), the first transmission should be a hoppingcode transmission, and the second transmission aseed transmission. The HCS360 and HCS361 encod-ers are ideally suited for secure learn. These encoderstransmit the seed if S0 and S1 are activated for longerthan 3 seconds. This means that secure learn can beperformed with a single extended press of a buttonassuming the button is tied to S0 and S1.
© 2011 Microchip Technology Inc. DS00728B-page 3
AN728
LEARNING PROCEDURELearning a transmitter is accomplished as follows:
1. Press and release the LEARN button. TheLEARN LED will turn on to indicate that thedecoder has entered Learn mode.
2. Press transmitter button. The LEARN LED willturn off, indicating a transmission has beenreceived.
3. Press transmitter a second time. The LEARNLED will flash to indicate that the transmitter waslearned successfully.
4. Repeat steps 1-3 to learn up to the maximumnumber of transmitters. Additional transmitterswill overwrite transmitters already in the system.
Learning will be terminated if two non-sequential codesare received or if two acceptable codes were notreceived within about 30 seconds. An unsuccessfullearning attempt will be indicated by the LEARN LEDturning on for 1 second.
TRANSMITTER ERASING
Erasing of all the transmitters is accomplished bypressing and holding the LEARN button for 8 seconds.The LED will turn off at the end of the 8 seconds to indi-cate that the transmitters were erased.
Network OperationThe unit is connected to a LIN interface bus as a sec-ondary master node. Six command frames areencoded by the firmware.
- Unlock boot- Flash sidelamps upon lock or unlock- Lock all doors and boot- Flash headlamps on ‘PANIC’ push- Stop flashing headlamps on second ‘PANIC’
push
The LIN identifiers selected for this application are‘0Bh’ and ‘11h’. The six commands are selected by thefirst data byte following the identifier.
TABLE 1: LIN IDENTIFIERS
Currently Implemented FeaturesFor functions lighting and seat/mirror position control,the RKE module communicates command and trans-mitter identification data over the LIN bus interface tothe appropriate submodule. These submodules arenormally autonomous in operation, but can be com-manded externally. They perform the requested func-tion without further supervision of the RKE module. Ifan error should occur during execution of a command,a diagnostic trouble code will be stored for laterretrieval through a service data link.
Note: The second transmission must be a SEEDtransmission when secure learn is used.
ID 1st data byte
2nd data byte
Action
0Bh 00h x Reserved0Bh 01h 03h Flash Park11h 10 x Unlock Boot11h 17 x All Lock0Bh 02 FF Flash Head0Bh 02 00 Stop Flash
Note: For safety reasons, whenever the ignitionswitch is in the 'on' position, all output func-tions are inhibited.
DS00728B-page 4 © 2011 Microchip Technology Inc.
AN728
TABLE 2: FEATURE STATUSFeature Currently Implemented CommentsLock/Unlock w/switch
Yes
Lock/Unlock w/RKE
Yes
Auto Lock/Unlock
Partial Needs VSS and/or DRIVE input
Courtesy Lights YesHeadLights Yes Communicates to Lighting Control ModuleSideLights Yes Communicates to Lighting Control ModuleSeat and mirror position
No Communicates to Seat Position Module and Mirror Position Module
© 2011 Microchip Technology Inc. DS00728B-page 5
AN728
CUSTOMER OPTION PROGRAMMINGSome functional options can be selected from the RKEtransmitter key fob. These options are available to anytransmitter that has already been learned by the sys-tem. Pressing any button, with the exception of Panic,for longer than four seconds will enter the Program-ming mode. A second button pressed, simultaneously,within the four to ten second period will toggle an optionon or off. The programming sequence can be cancelledby releasing the first button, then pushing any button.
TABLE 3: OPTIONAL FUNCTIONSFirst Button Second Button Action Option
UnlockLock Toggle Config1.6 RKEUNL: RKE Door Lock Option
Boot(1)
Panic Enter LEARN Mode Set receiver to learn new transmitter fobs (up to a total of eight)
LockUnlock Toggle Config4.5 CHRP: Audible Feedback on RKE
Lock/ Unlock Events
Boot(1) Toggle Config1.0 BOOTLK: Boot Lock OptionPanic Toggle Config4.7 RKEFSH: Flash Sidelights on RKE
Activity
Boot(1)
Unlock(1)
Lock(1)
Panic(1)
Note 1: Not available on three-button RKE fobs.
DS00728B-page 6 © 2011 Microchip Technology Inc.
AN728
CIRCUIT DESCRIPTION
Voltage RegulatorThe regulator is an automotive-grade, low dropout lin-ear device capable of supplying up to 500 mA of cur-rent. It contains reverse battery polarity and over-voltage protection, and can handle load dump tran-sients of +60V / -50V. It also has internal short circuitdetection and thermal overload protection.
The input to the board is further protected by a reversepolarity blocking diode (D2) and over-voltage control bya zener diode (D3).
Battery voltage is current limited to the LIN transceiverby resistor, R6.
Inputs and Outputs
PROTECTED SYSTEM INPUTS
All inputs that are exposed to the vehicle system areclamped by back-to-back Schottky diodes to the inter-nal VCC and VSS power planes.
All inputs are assumed to switch between chassisground and 14.4V VBAT. A resistor divider is providedto attenuate the input to a VCC-VSS voltage range.
To use the J1-2 and J1-5 inputs, the respective inputprotection circuitry must be installed and the tracesbetween E1 and E2 cut.
RELAY OUTPUTS
The relays are rated at 14VDC, 20 A with a maximumswitching power of 400 W.
The coils are driven from the PIC® MCU through anoctal high-side driver array. Each driver is capable of+500 mA and a total package load of not more than 2.5W. The normally open (NO) contacts of relays K1through K4 are tied together and supplied by J2, pin 10.All other contacts are kept separate and available onJ1, J2, or discreet pads.
To use the alternative TP1 and/or TP2 outputs of thehigh-side driver, the input signal conditioning circuitsassociated with J1-2 and J1-5 must be removed andthe jumpers E1 and E2 installed.
PULSE-WIDTH MODULATED OUTPUT
A high current (5 A, 80V) Darlington-pair transistordrives pin 14 of J2. The transistor can be installed ineither the Q1 or the Q2 position on the board. Q1 con-figures the output to be a high-side drive. Q2 is for low-side drive. The output transistor is protected byblocking diode, D4.
RADIO FREQUENCY RECEIVER INPUT
The output of the radio receiver module U1 is con-nected to pin 25 (RB4) of the PIC MCU, U2. A wire ofsuitable length is connected to the pad labeled ANT1as an antenna.
LEARN CONTROL INTERFACE
Connector JP2 is used to connect to a remote switchand LED to implement the 'Learn' request function andstatus display. The switch input is pulled up to VCC byan onboard 10 kΩ resistor. The LED is driven throughan onboard 1 kΩ current-limiting resistor.
IN-CIRCUIT DEBUG AND SERIAL PROGRAMMING INTERFACE
The resident PIC MCU software can be debugged orreprogrammed through an MPLAB® ICD or ICSP™module connected to JP3. This is normally a RJ11, 6-pin telecom connector, but for the automotive environ-ment this has been replaced with a 6-pin mini DIN. Thisconnector and its associated cabling are much morerobust than the typical telecom-type hardware.
Local Interconnect Network (LIN) InterfaceThe LIN bus interface is through a Microchip MCP201LIN transceiver. The internal PIC UART pins (RC6/TXand RC7/RX) are connected to the respective pins onthe transceiver. The transceiver's Chip Select input isdriven from RC0. A high level on this output turns thetransmitter on. The FAULT output of the transceiver isbrought to the RC5 for software fault detection and cor-rection.
The RX pin of the LIN receiver can, alternatively, beconnected to RB0 by installing jumper E1. This allowsthe PIC MCU to be setup to wake on a transition of theLIN bus.
© 2011 Microchip Technology Inc. DS00728B-page 7
AN728
APPENDIX A: SCHEMATICS5 5
4 4
3 3
2 2
1 1
DD
CC
BB
AA
"ON"
"LEARN"
LIN-bus
ORN
BLK
PNK
LT B
LU
TAN
BLK/
RED
TAN/
BLK
PPL/R
ED
PPL
PPL/
WHT
ORN
BLK
C1NO NC
COM
C2
1 B
2 C
3 E
Optio
n: G
rounded
Door
Jam
b
Sw
itches
Optio
n: P
ow
er
ON
Indic
ato
r
Optio
n: A
dditi
onal I
nputs
6-p
in M
ini D
IN
Note
: D
o n
ot in
stall
both
Q1 a
nd Q
2. If a
hig
h-s
ide
switc
h is
needed in
stall
ON
LY
Q1. If a
low
-sid
e
drive
r is
calle
d for,
then
inst
all
ON
LY
Q2.
BO
TTO
M V
IEW
Chandle
r, A
rizona 8
5224
1.6
Mic
rochip
Technolo
gy, In
c.
Wednesday, A
ugust 07, 2002
11
B
AM
AD
Auto
motive P
roducts
Gro
up
2355 W
est C
handle
r B
lvd.
Rem
ote
Keyle
ss E
ntr
y D
ecoder
to L
IN-b
us N
ode
Main
Chuck S
imm
ers
{Page
}
Siz
e
Rev
Sheet
of
APG
Dra
wn b
y
LE
AR
N
LE
D
TX
XC
VR
en
AllL
ockC
OM
PU
nLockC
OM
AllL
ockN
C
DU
nLockN
C
PU
nLockN
C
BU
nLockC
OM
BU
nLockN
C
RF
INWA
KE
up
RX
LevelC
OM
LevelN
C
LevelN
O
Ignitio
n
PW
M1
PW
M1
AllL
ock
S0
S2
S3 P
WM
0X
tra2
S1
BU
nLock
PW
M0
DU
nLock
PU
nLock
Court
esyLig
ht
CLig
htS
ens
CLig
ht
UN
LO
CK
Sense
Vbat
Level
Xtr
a1
DU
nLockN
O
PU
nLockN
O
DU
nLockC
OM
BU
nLockN
O
AllL
ockN
O
VC
C
VB
B
VB
B
VC
C
VC
C
VC
C
VC
C
VC
C
VC
C
VC
CV
CC
VC
C
VC
C
VC
C
Vbat
Vbat
VC
C
RE
G1
LM
2937E
T-5
.0
13
2
INO
UT
GND
+C
622uF
+C
310uF
R7
1K
J1-J
1V
bat-
12V
J2-J
11
Chassis
GN
D
D2
1N
4004
R3
1K
JP
3
1 2 3C
5
.005uF
D1
1N
4750 2
7V
C4
.01uF
R5
1K
R6
0.0
D3
1N
4755 4
3V
R15
25K
R10
15K
J1-J
7
IGN
itio
n
K1
K2
K3
J1-J
3
J1-J
8
K4
J2-J
9
U1
RR
3-x
xx
123456789101112131415
VCCGNDANTNCNCNCGNDNCNCVCCGNDVCCTESTOUTVCC
AN
T1
AN
TE
NN
A
E1
12
K5
J2-J
12
J2-J
13
J2-J
14
R16
25K
R11
15K
R2
10K
D12
1N
5819
R1
10K
R17
25K
R12
15K
D14
1N
5819
R18
1K
Q1
TIP
121
JP
2
1 2 3
S1
LE
D2
JP
2 1 2 3
J1-J
4C
hassis
GN
D
Q2
TIP
121
D4
1N
4004
+
C2
30pF
Y1
4.0
MH
z
+
C1
30pF
U3
UD
N2981A 1 2 3 4 5 6 7 8
18
17
16
15
14
13
12
11
9 10
IN0
IN1
IN2
IN3
IN4
IN5
IN6
IN7
OU
T0
OU
T1
OU
T2
OU
T3
OU
T4
OU
T5
OU
T6
OU
T7
Vs GNDT
P1
1
TP
21
R13
25K
R8
15K
D5
1N
5819 D
11
1N
5819
R9
15K
R14
25K
E3
12
E2
12
J1-J
2
J1-J
5
D6
1N
5819
D7
1N
5819
U2 PIC
16F
873
1 9
10 2 3 4 5 6 7
21
22
23
24
25
26
27
28
11
12
13
14
15
16
17
18
MC
LR
/Vpp/T
HV
OS
C1/C
LK
IN
OS
C2/C
LK
OU
T
RA
0/A
N0
RA
1/A
N1
RA
2/A
N2/V
ref-
RA
3/A
N3/V
ref+
RA
4/T
0C
LI
RA
5/A
N4/S
S
RB
0/IN
TR
B1
RB
2R
B3/P
GM
RB
4R
B5
RB
6/P
GC
RB
7/P
GD
RC
0/T
1O
SO
/T1C
KI
RC
1/T
1O
SI/C
CP
2R
C2/C
CP
1R
C3/S
CK
/SC
LR
C4/S
DI/S
DA
RC
5/S
DO
RC
6/T
X/C
KR
C7/R
X/D
T
D13
1N
5819
D10
1N
5819
R4
20K
D15
1N
5819
JP
1
1 2 3 4 5 6
D8
1N
5819L
ED
1
D9
1N
5819
J2-J
10
Vbat-
12V
J1-J
6
MC
P201
U4
6142
5
7
3
8
LIN
RX
TX
CS
/WA
KE
GN
DVBAT
VDD
FA
ULT
/SLP
S
D16
1N
4004
E4
12
C7
0.1
uF
DS00728B-page 8 © 2011 Microchip Technology Inc.
AN728
Schematic Revision HistoryPCB Revision History
Revision Number Description Matching PCB
RKE001 Revision 1.3 First release, replaced 2mm double-row connector with.156 single row, added two auxiliary inputs conditioning circuits, added optional low-side cour-tesy light driver, replaced RJ11 6-pin ICD connec-tor with a 6-pin mini DIN.
Hand-wired prototype
RKE001 Revision 1.4 Added D15 diode to MCLR pin. RKE001 Rev 1.2
RKE001 Revision 1.5 Not released None
RKE001 Revision 1.6 Released K-line transceiver with MCP201. Changed Jx connectors for higher current.
RKE001 Rev 1.6
Revision Number Description Matching Schematic
RKE001 Revision 1.2 Relay footprints are backwards. Fully functional. RKE001 Rev. 1.4
RKE001 Revision 1.3 Fixed relay footprints. No change to J1-J14. RKE001 Rev. 1.4
RKE001 Revision 1.4 Not released RKE001 Rev 1.5
RKE001 Revision 1.5 Not released RKE001 Rev 1.5
RKE001 Revision 1.6 Re-oriented parts placement to quiet LIN area and for more current carrying capability.
RKE001 Rev 1.6
© 2011 Microchip Technology Inc. DS00728B-page 9
AN728
TABLE 4: CONNECTOR DESCRIPTIONSJP1 ICD/ICSP Interface
Pin Number Pin Name Description PIC® MCU Signal
1 MCLR Master Clear Input / Program Mode Select Pin 1 MLCR
2 VCC +5VDC Power Pin 20 VDD
3 GND Ground Power Pin 8,19 VSS
4 RB7 Data Input/Output Pin 28 RB7/PGD
5 RB6 Clock Input Pin 27 RB6/PGC
6 RB3 Low Voltage ICSP Programming Input Pin 24 RB3/PGM
JP2 Learn Interface
Pin Number Pin Name Description PIC MCU Signal1 GND Ground Power Pin 8,19 VSS
2 SW Learn Switch Input Pin 26 RB53 LED Learn LED Output Pin 23 RB2
JP3 LIN Interface
Pin Number Pin Name Description PIC MCU Signal1 VBAT +12VDC Battery Power No connection2 LIN LIN bus Input/Output Pin 17 and 18 RC6/TX
and RC7/RX3 GND Bus Ground Power Pin 8,19 VSS
J1 System Interface
Pin Number Pin Name Description PIC MCU Signal1 VBAT +12VDC Battery Power No connection2 IN1 Input #1 Pin 12 RC13 K1COM Relay #1 Common Controlled by Pin 2 RA04 K2NC Relay #2 Normally Closed Controlled by Pin 3 RA15 IN2 Input #2 Pin 15 RC46 K2COM Relay #2 Common Controlled by Pin 3 RA17 Ignition / IN3 Ignition Input #3 Pin 22 RB18 K3COM Relay #3 Common Controlled by Pin 4 RA2
J2 System Interface
Pin Number Pin Name Description PIC MCU Signal9 K4COM Relay #4 Common Controlled by Pin 5 RA3
10 VBATRLY Relays #1, #2, #3, and #4 Normally Open —11 GND Chassis Ground Power —12 K5COM Relay #5 Common Controlled by Pin 7 RA513 K5NO Relay #5 Normally Open Controlled by Pin 7 RA514 PWM 5.0 A High- or Low-side Output with Input #5 Controlled by Pin 13
RC2, read by Pin 14 RC3
Note: J1 and J2 pin number are not sequential on board layout.
DS00728B-page 10 © 2011 Microchip Technology Inc.
AN728
Optional System Interface Signals
Pin Number Pin Name Description PIC MCU Signal— K1NC Relay #1 Normally Closed Controlled by Pin 2 RA0— K3NC Relay #3 Normally Closed and Input #4 Controlled by Pin 4
RA2, read by Pin 6 RA4— K4NC Relay #4 Normally Closed Controlled by Pin 5 RA3— K5NC Relay #5 Normally Closed Controlled by Pin 7 RA5— TP1 0.5 A High-side Output Controlled by Pin 15
RC4— TP2 0.5 A High-side Output Controlled by Pin 12
RC1
© 2011 Microchip Technology Inc. DS00728B-page 11
AN728
FIGURE 3: VEHICLE SYSTEMA A
B B
C C
D D
E E
44
33
22
11
Driv
er D
oor
Pass
enge
r Do
ors
RK
E M
od
ule
OR
N
GR
Y
TA
N
BLK
LT
BLU
TA
N
OR
N
BLK
LO
CK
UN
LO
CK
Vbat
Ka
GM
#20167608
2
CA
SE1
5 4 3M
Ma
Moto
r
M
Md
Moto
r
K3
K1
K2
SW
1
M
Mb
Moto
r M
Mc
Moto
r
+12V
bat
UN
LO
CK
Sense
LO
CK
Sense
DU
NLO
CK
AllL
OC
K
PU
NLO
CK
DS00728B-page 12 © 2011 Microchip Technology Inc.
AN728
The present assignment of input and output circuits is as follows:Connector Number Direction Function Signal RangeJ1-1 Power +12V Battery On alwaysJ1-2 — Not assignedJ1-3 Out Lock All On = 12V Off = n.c.J1-4 Out Driver Door Unlock NC On = n.c. Off = 12VJ1-5 — Not assignedJ1-6 Out Driver Door Unlock On = 12V Off = n.c.J1-7 In Ignition On = 12V Off = n.c.J1-8 Out Passenger Doors Unlock On = 12V Off = n.c.J2-9 Out Boot Unlock On = 12V Off = n.c.J2-10 Power +12V Battery On alwaysJ2-11 Power Chassis GroundJ2-12 Out Load Leveler Solenoid On = J2-12 shunted to J2-13
Off = n.c.J2-13 Out Load Leveler Power Switched on by IgnitionJ2-14 Out Courtesy Lights On = 12V Off = n.c.
Continuously variable in 255 stepsK1NC — Not assignedK3NC — Not assignedK4NC — Not assignedK5NC — Not assigned
Note: Pins are not sequential on board.
© 2011 Microchip Technology Inc. DS00728B-page 13
AN728
CONFIGURATION REGISTERSSeveral features of the RKE system can be configured to suit the end user. These configuration bytes are located inEEPROM data memory and can be modified at software assembly time or by an external programmer such as PROMATE® II. Refer to program listing for exact addresses.
REGISTER 1: CONFIGURATION BYTE 1 D = 1 D = 1 D = 1 D = 1 D = 1 D = 0 D = 0 D = 1
UNLOCK RKEUNL AUTOUN OFF/RM AUTOLK DRV/SPD WINDUP BOOTLKbit 7 bit 0
bit 7 UNLOCK: Inside Door Lock Option bit1 = Unlock passenger, first push. Unlock driver, second push.0 = Unlock all, one push
bit 6 RKEUNL: RKE Door Lock Option(1) bit1 = Unlock driver, first press. Unlock passenger, second press.0 = Unlock all, one press
bit 5 AUTOUN: Auto Unlock Option bit1 = Enable auto unlock option0 = Disable auto unlock option
bit 4 OFF/RM: Auto Unlock Select bitIf bit 5, AUTOUN is ‘1’, else bit 4 has no effect1 = Unlock all when ignition is switched off0 = Unlock all when ignition key is removed
bit 3 AUTOLK: Auto Lock Option bit1 = Enable auto lock option0 = Disable auto lock option
bit 2 DRV/SPD: Auto Lock Select bitIf bit 3, AUTOLK is ‘1’, else bit 2 has no effect1 = Lock all when vehicle speed is greater than 20 kph0 = Lock all when DRIVE gear is selected
bit 1 WINDUP: Windows Up Option bit1 = If any window is not closed when a lock function is invoked, window will be raised0 = Disabled, no action
bit 0 BOOTLK: Boot Lock Option bit1 = Boot is locked whenever it is closed0 = Disabled, no action
Note 1: Can be customer programmed from transmitter fob. Refer to Section "Customer Option Programming".
Legend:R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’-n = Value at PORD = Default value
’1’ = Bit is set ’0’ = Bit is cleared x = Bit is unknown
DS00728B-page 14 © 2011 Microchip Technology Inc.
AN728
REGISTER 2: CONFIGURATION BYTE 2REGISTER 3: CONFIGURATION BYTE 3
D = 0 D = 0 D = 0 D = 0 D = 0 D = 0 D = 0 D = 0
LKDLY7 LKDLY6 LKDLY5 LKDLY4 LKDLY3 LKDLY2 LKDLY1 LKDLY0bit 7 bit 0
bit 7-0 KDLY<7:0> Lock Delay Time bits0 = Disabled, no delayn = Delay time 1 to 255 seconds after ignition key is removed and all doors have been closed,
all doors lock
Legend:R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’-n = Value at PORD = Default value
’1’ = Bit is set ’0’ = Bit is cleared x = Bit is unknown
D = 0 D = 0 D = 0 D = 1 D = 1 D = 1 D = 1 D = 1
WLKAWY WLKUP SIDEO CLDLY4 CLDLY3 CLDLY2 CLDLY1 CLDLY0bit 7 bit 0
bit 7 WLKAWY: Enable Walk Away Headlight On bit1 = Enable lighting module to keep headlights on for a set period of time. Time controlled by
lighting module.0 = Disable
bit 6 WLKUP: Enable Walk Up Lights On bit1 = Enable lighting module to turn on lights for a set period of time. Time controlled by lighting
module.0 = Disable
bit 5 SIDEO: Side Lights Only Select bit1 = If bit 6, WLKUP is 1, turn on headlights0 = If bit 6, WLKUP is 1, turn on only sidelights
bit 4-0 CLDLY<4:0> Courtesy Light Delay Time bits0 = Disabled, no delayn = Delay time 1 to 31 seconds after ignition is switched off, courtesy lights will stay on
Legend:R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’-n = Value at PORD = Default value
’1’ = Bit is set ’0’ = Bit is cleared x = Bit is unknown
© 2011 Microchip Technology Inc. DS00728B-page 15
AN728
REGISTER 4: CONFIGURATION BYTE 4Factory default values can be reestablished by cyclingpower off, then on, while pressing the LEARN button.After resetting back to the factory default, individualoption selections can be reprogrammed into theconfiguration memory.
Referenced Documents:• "LIN Specification Package", Revision 1.2,
November 17, 2000, www.lin-subbus.org• Microchip Applications Note AN729, “LIN Bus
Implementation using PIC® MCU, DS00729A
D = 1 D = 0 D = 0 D = 1 D = 1 D = 1 D = 1 D = 1RKEFSH SMPOS CHRP CLDIM4 CLDIM3 CLDIM2 CLDIM1 CLDIM0bit 7 bit 0
bit 7 RKEFSH: Flash Sidelights on RKE Activity (1) bit1 = Flash sidelights for 1 second whenever RKE activity detected0 = Disabled
bit 6 SMPOS: Seat and Mirror Position Command bit1 = Command seat and mirror control modules to assume pre-selected position0 = Disabled
bit 5 CHRP: Audible Feedback on RKE Lock and Unlock Events(1) (2) bit1 = Audio transducer is enabled whenever RKE Lock/UnLock detected0 = Disabled
bit 4-0 CLDLY<4:0> Courtesy Light Dim Time bits0 = Disabled, no dimmingn = Dimming time 1 to 31 seconds after all doors are closed
Note 1: Can be customer programmed from transmitter fob. Refer to Section "Customer Option Programming".
2: Must be disabled in certain markets.
Legend:R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’-n = Value at PORD = Default value
’1’ = Bit is set ’0’ = Bit is cleared x = Bit is unknown
DS00728B-page 16 © 2011 Microchip Technology Inc.
AN728
APPENDIX B: MAIN PROGRAMMING FLOWCHARTS
Main
CallCheckEventTimer
PWM value= 0?
Courtesy LightSwitchON?
PWM value= 255?
IGNITIONON?
PWM value= 0?
Call ReadInputs
Learn LED = 0
Call Test_Learn
Call Receive
Learn_Mode_RQ?MessageReceived?
M_Loop2a
Learn LED = 1
Call Learn_TX
NO
YES
YES
YES
NO
NO
NO NO
YES YES
M_Loopc
M_Loopa
M_Loopb
MAIN
© 2011 Microchip Technology Inc. DS00728B-page 17
AN728
APPENDIX B: MAIN PROGRAMMING FLOWCHARTS (CONTINUED)
M_Loop2a
Learn LED = 1
DiscriminationValue
AllTransmitters
Checked?
Call Calc_ID
Tst_SNOK?
Max Serial Number = 28 bitsMax Transmitters = 6
Decrypt Hopcode
Xmit_Repeat=0 Xmit_Repeat=1Xmit_Repeat=0
Repeated TX?Sync
Counter
Main
TX_OK=1
OUT_500 = 1
NO YES
YES
YES
NO
NO
NO
NOYES
YES
Select NextTransmitter
OK?
OK?
Call Cntr_Wr
IsButton same as
previous?
NO
Decode and
YES
Perform Function
TX_OK=0
DS00728B-page 18 © 2011 Microchip Technology Inc.
AN728
APPENDIX B: MAIN PROGRAMMING FLOWCHARTS (CONTINUED)
Save Status
RETURN
INTERRUPT
Increment
Restore Status
CNT_HI/LO
© 2011 Microchip Technology Inc. DS00728B-page 19
AN728
APPENDIX B: MAIN PROGRAMMING FLOWCHARTS (CONTINUED)
Disable Interrupts
PWMvalue = 0
PWMvalue =
RETURN
PWMvalue -
PWMvalue< 0 ?
DIMDELAYDEC
Is this a64mS
Interrupt?
Is this a4S
Interrupt?
Is this a500mS
Interrupt?
Are anyoutputs ON?
Is
Is
SecondFunctionFlag set?Turn outputs OFF
Clear all lock flags
ClearSecondFunction
Flag
XmitRepeatFlag set?
SetSecondFunction
Flag
Turn LED ON
ClearXmitRepeat
Flag
Re-enableInterrupts
NO
YES
NO
YES
NO
YES
NO
YES
NO
YES
NO
YES
NO
YES
CHECKEVENTTIMER
DS00728B-page 20 © 2011 Microchip Technology Inc.
AN728
ADDITIONAL INFORMATIONMicrochip’s Secure Data Products are covered bysome or all of the following: Code hopping encoder patents issued in Europeancountries and U.S.A.Secure learning patents issued in European countries,U.S.A. and R.S.A.
REVISION HISTORY
Revision B (May 2011)• Added new section Additional Information• Minor formatting and text changes were
incorporated throughout the document
© 2011 Microchip Technology Inc. DS00728B-page 21
AN728
NOTES:DS00728B-page 22 © 2011 Microchip Technology Inc.
Note the following details of the code protection feature on Microchip devices:• Microchip products meet the specification contained in their particular Microchip Data Sheet.
• Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the intended manner and under normal conditions.
• There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchip’s Data Sheets. Most likely, the person doing so is engaged in theft of intellectual property.
• Microchip is willing to work with the customer who is concerned about the integrity of their code.
• Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not mean that we are guaranteeing the product as “unbreakable.”
Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of ourproducts. Attempts to break Microchip’s code protection feature may be a violation of the Digital Millennium Copyright Act. If such actsallow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act.
Information contained in this publication regarding deviceapplications and the like is provided only for your convenienceand may be superseded by updates. It is your responsibility toensure that your application meets with your specifications.MICROCHIP MAKES NO REPRESENTATIONS ORWARRANTIES OF ANY KIND WHETHER EXPRESS ORIMPLIED, WRITTEN OR ORAL, STATUTORY OROTHERWISE, RELATED TO THE INFORMATION,INCLUDING BUT NOT LIMITED TO ITS CONDITION,QUALITY, PERFORMANCE, MERCHANTABILITY ORFITNESS FOR PURPOSE. Microchip disclaims all liabilityarising from this information and its use. Use of Microchipdevices in life support and/or safety applications is entirely atthe buyer’s risk, and the buyer agrees to defend, indemnify andhold harmless Microchip from any and all damages, claims,suits, or expenses resulting from such use. No licenses areconveyed, implicitly or otherwise, under any Microchipintellectual property rights.
© 2011 Microchip Technology Inc.
Trademarks
The Microchip name and logo, the Microchip logo, dsPIC, KEELOQ, KEELOQ logo, MPLAB, PIC, PICmicro, PICSTART, PIC32 logo, rfPIC and UNI/O are registered trademarks of Microchip Technology Incorporated in the U.S.A. and other countries.
FilterLab, Hampshire, HI-TECH C, Linear Active Thermistor, MXDEV, MXLAB, SEEVAL and The Embedded Control Solutions Company are registered trademarks of Microchip Technology Incorporated in the U.S.A.
Analog-for-the-Digital Age, Application Maestro, CodeGuard, dsPICDEM, dsPICDEM.net, dsPICworks, dsSPEAK, ECAN, ECONOMONITOR, FanSense, HI-TIDE, In-Circuit Serial Programming, ICSP, Mindi, MiWi, MPASM, MPLAB Certified logo, MPLIB, MPLINK, mTouch, Omniscient Code Generation, PICC, PICC-18, PICDEM, PICDEM.net, PICkit, PICtail, REAL ICE, rfLAB, Select Mode, Total Endurance, TSHARC, UniWinDriver, WiperLock and ZENA are trademarks of Microchip Technology Incorporated in the U.S.A. and other countries.
SQTP is a service mark of Microchip Technology Incorporated in the U.S.A.
All other trademarks mentioned herein are property of their respective companies.
© 2011, Microchip Technology Incorporated, Printed in the U.S.A., All Rights Reserved.
Printed on recycled paper.
ISBN: 978-1-61341-169-8
DS00728B-page 23
Microchip received ISO/TS-16949:2002 certification for its worldwide headquarters, design and wafer fabrication facilities in Chandler and Tempe, Arizona; Gresham, Oregon and design centers in California and India. The Company’s quality system processes and procedures are for its PIC® MCUs and dsPIC® DSCs, KEELOQ® code hopping devices, Serial EEPROMs, microperipherals, nonvolatile memory and analog products. In addition, Microchip’s quality system for the design and manufacture of development systems is ISO 9001:2000 certified.
DS00728B-page 24 © 2011 Microchip Technology Inc.
AMERICASCorporate Office2355 West Chandler Blvd.Chandler, AZ 85224-6199Tel: 480-792-7200 Fax: 480-792-7277Technical Support: http://www.microchip.com/supportWeb Address: www.microchip.comAtlantaDuluth, GA Tel: 678-957-9614 Fax: 678-957-1455BostonWestborough, MA Tel: 774-760-0087 Fax: 774-760-0088ChicagoItasca, IL Tel: 630-285-0071 Fax: 630-285-0075ClevelandIndependence, OH Tel: 216-447-0464 Fax: 216-447-0643DallasAddison, TX Tel: 972-818-7423 Fax: 972-818-2924DetroitFarmington Hills, MI Tel: 248-538-2250Fax: 248-538-2260IndianapolisNoblesville, IN Tel: 317-773-8323Fax: 317-773-5453Los AngelesMission Viejo, CA Tel: 949-462-9523 Fax: 949-462-9608Santa ClaraSanta Clara, CA Tel: 408-961-6444Fax: 408-961-6445TorontoMississauga, Ontario, CanadaTel: 905-673-0699 Fax: 905-673-6509
ASIA/PACIFICAsia Pacific OfficeSuites 3707-14, 37th FloorTower 6, The GatewayHarbour City, KowloonHong KongTel: 852-2401-1200Fax: 852-2401-3431Australia - SydneyTel: 61-2-9868-6733Fax: 61-2-9868-6755China - BeijingTel: 86-10-8569-7000 Fax: 86-10-8528-2104China - ChengduTel: 86-28-8665-5511Fax: 86-28-8665-7889China - ChongqingTel: 86-23-8980-9588Fax: 86-23-8980-9500China - HangzhouTel: 86-571-2819-3180 Fax: 86-571-2819-3189China - Hong Kong SARTel: 852-2401-1200 Fax: 852-2401-3431China - NanjingTel: 86-25-8473-2460Fax: 86-25-8473-2470China - QingdaoTel: 86-532-8502-7355Fax: 86-532-8502-7205China - ShanghaiTel: 86-21-5407-5533 Fax: 86-21-5407-5066China - ShenyangTel: 86-24-2334-2829Fax: 86-24-2334-2393China - ShenzhenTel: 86-755-8203-2660 Fax: 86-755-8203-1760China - WuhanTel: 86-27-5980-5300Fax: 86-27-5980-5118China - XianTel: 86-29-8833-7252Fax: 86-29-8833-7256China - XiamenTel: 86-592-2388138 Fax: 86-592-2388130China - ZhuhaiTel: 86-756-3210040 Fax: 86-756-3210049
ASIA/PACIFICIndia - BangaloreTel: 91-80-3090-4444 Fax: 91-80-3090-4123India - New DelhiTel: 91-11-4160-8631Fax: 91-11-4160-8632India - PuneTel: 91-20-2566-1512Fax: 91-20-2566-1513Japan - YokohamaTel: 81-45-471- 6166 Fax: 81-45-471-6122Korea - DaeguTel: 82-53-744-4301Fax: 82-53-744-4302Korea - SeoulTel: 82-2-554-7200Fax: 82-2-558-5932 or 82-2-558-5934Malaysia - Kuala LumpurTel: 60-3-6201-9857Fax: 60-3-6201-9859Malaysia - PenangTel: 60-4-227-8870Fax: 60-4-227-4068Philippines - ManilaTel: 63-2-634-9065Fax: 63-2-634-9069SingaporeTel: 65-6334-8870Fax: 65-6334-8850Taiwan - Hsin ChuTel: 886-3-6578-300Fax: 886-3-6578-370Taiwan - KaohsiungTel: 886-7-213-7830Fax: 886-7-330-9305Taiwan - TaipeiTel: 886-2-2500-6610 Fax: 886-2-2508-0102Thailand - BangkokTel: 66-2-694-1351Fax: 66-2-694-1350
EUROPEAustria - WelsTel: 43-7242-2244-39Fax: 43-7242-2244-393Denmark - CopenhagenTel: 45-4450-2828 Fax: 45-4485-2829France - ParisTel: 33-1-69-53-63-20 Fax: 33-1-69-30-90-79Germany - MunichTel: 49-89-627-144-0 Fax: 49-89-627-144-44Italy - Milan Tel: 39-0331-742611 Fax: 39-0331-466781Netherlands - DrunenTel: 31-416-690399 Fax: 31-416-690340Spain - MadridTel: 34-91-708-08-90Fax: 34-91-708-08-91UK - WokinghamTel: 44-118-921-5869Fax: 44-118-921-5820
Worldwide Sales and Service
05/02/11