Passive Keyless Entry (PKE) Reference Design User's Manual

Passive Keyless Entry (PKE)
Reference Design
User’s Manual
© 2006 Microchip Technology Inc.
DS21986A
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 our
products. Attempts to break Microchip’s code protection feature may be a violation of the Digital Millennium Copyright Act. If such acts
allow 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 device
applications and the like is provided only for your convenience
and may be superseded by updates. It is your responsibility to
ensure that your application meets with your specifications.
MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED,
WRITTEN OR ORAL, STATUTORY OR OTHERWISE,
RELATED TO THE INFORMATION, INCLUDING BUT NOT
LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE,
MERCHANTABILITY OR FITNESS FOR PURPOSE.
Microchip disclaims all liability arising from this information and
its use. Use of Microchip devices in life support and/or safety
applications is entirely at the buyer’s risk, and the buyer agrees
to defend, indemnify and hold harmless Microchip from any and
all damages, claims, suits, or expenses resulting from such
use. No licenses are conveyed, implicitly or otherwise, under
any Microchip intellectual property rights.
Trademarks
The Microchip name and logo, the Microchip logo, Accuron,
dsPIC, KEELOQ, microID, MPLAB, PIC, PICmicro, PICSTART,
PRO MATE, PowerSmart, rfPIC and SmartShunt are
registered trademarks of Microchip Technology Incorporated
in the U.S.A. and other countries.
AmpLab, FilterLab, Migratable Memory, MXDEV, MXLAB,
SEEVAL, SmartSensor 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, dsPICDEM,
dsPICDEM.net, dsPICworks, ECAN, ECONOMONITOR,
FanSense, FlexROM, fuzzyLAB, In-Circuit Serial
Programming, ICSP, ICEPIC, Linear Active Thermistor,
MPASM, MPLIB, MPLINK, MPSIM, PICkit, PICDEM,
PICDEM.net, PICLAB, PICtail, PowerCal, PowerInfo,
PowerMate, PowerTool, Real ICE, rfLAB, rfPICDEM, Select
Mode, Smart Serial, SmartTel, Total Endurance, UNI/O,
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.
© 2006, Microchip Technology Incorporated, Printed in the
U.S.A., All Rights Reserved.
Printed on recycled paper.
Microchip received ISO/TS-16949:2002 quality system certification for
its worldwide headquarters, design and wafer fabrication facilities in
Chandler and Tempe, Arizona and Mountain View, California in
October 2003. The Company’s quality system processes and
procedures are for its PICmicro® 8-bit MCUs, 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.
DS21986A-page ii
© 2006 Microchip Technology Inc.
PKE REFERENCE DESIGN
USER’S MANUAL
Table of Contents
Preface ........................................................................................................................... 1
Chapter 1. System Overview
1.1 Overview ........................................................................................................ 6
1.2 Operational Overview ..................................................................................... 7
1.3 Features ......................................................................................................... 7
1.3.1 LF Initiator ................................................................................................... 7
1.3.2 Key Fob ....................................................................................................... 7
1.3.3 RF Receiver ................................................................................................ 8
1.4 Reference Documents .................................................................................... 8
Chapter 2. Low-Frequency Initiator Module
2.1 Introduction ................................................................................................... 10
2.2 Hardware ...................................................................................................... 10
2.2.1 Microcontroller ........................................................................................... 10
2.2.2 Configurable Inputs ................................................................................... 10
2.2.3 LF Transmitter ........................................................................................... 10
2.2.4 Network Interfaces .................................................................................... 10
2.2.5 Power ........................................................................................................ 10
2.3 Software ....................................................................................................... 12
Chapter 3. PKE Transmitter-Transponder
3.1 Introduction ................................................................................................... 14
3.2 Hardware ...................................................................................................... 14
3.2.1 Transmitter ................................................................................................ 15
3.3 Software ....................................................................................................... 17
3.3.1 Dual Encoder Operation ............................................................................ 20
3.3.2 Code Hopping Code Word Data Format ................................................... 20
3.3.3 EEPROM Organization ............................................................................. 23
Chapter 4. Remote Keyless Entry Receiver-Decoder Module
4.1 Introduction ................................................................................................... 26
4.2 Hardware ...................................................................................................... 26
4.2.1 UHF Receiver ............................................................................................ 26
4.2.2 Microcontroller ........................................................................................... 26
4.2.3 Network Interface ...................................................................................... 27
4.2.4 Power Supply ............................................................................................ 27
4.2.5 Connectors ................................................................................................ 28
4.3 Software ....................................................................................................... 30
4.3.1 Modules Overview ..................................................................................... 30
Worldwide Sales and Service .................................................................................... 33
© 2006 Microchip Technology Inc.
DS21986A-page iii
PKE Reference Design User’s Manual
NOTES:
DS21986A-page iv
© 2006 Microchip Technology Inc.
PKE REFERENCE DESIGN
USER’S MANUAL
Preface
NOTICE TO CUSTOMERS
All documentation becomes dated, and this manual is no exception. Microchip tools and
documentation are constantly evolving to meet customer needs, so some actual dialogs
and/or tool descriptions may differ from those in this document. Please refer to our web site
(www.microchip.com) to obtain the latest documentation available.
Documents are identified with a “DS” number. This number is located on the bottom of each
page, in front of the page number. The numbering convention for the DS number is
“DSXXXXXA”, where “XXXXX” is the document number and “A” is the revision level of the
document.
For the most up-to-date information on development tools, see the MPLAB® IDE on-line help.
Select the Help menu, and then Topics to open a list of available on-line help files.
INTRODUCTION
This chapter contains general information that will be useful to know before using the
PKE Reference Design. Items discussed in this chapter include:
•
•
•
•
•
Document Layout
Conventions Used in this Guide
Recommended Reading
The Microchip Web Site
Customer Support
DOCUMENT LAYOUT
This document describes a Passive Keyless Entry (PKE) system upgrade to an existing
Remote Keyless Entry (RKE) application. The manual layout is as follows:
• Chapter 1. “System Overview” – Describes the PKE system upgrade to an
existing Remote Keyless Entry (RKE) application overview.
• Chapter 2. “Low-Frequency Initiator Module” – Describes the Low-Frequency
Magnetic Transmitter.
• Chapter 3. “PKE Transmitter-Transponder” – Describes the Remote Keyless
Entry unit as a solution for Passive and RKE Keyless Entry applications.
• Chapter 4. “Remote Keyless Entry Receiver-Decoder Module” – Describes
the Remote Keyless Entry Receiver-Decoder module as a target board for RKE
and PKE message transmissions.
© 2006 Microchip Technology Inc.
DS21986A-page 1
Preface
CONVENTIONS USED IN THIS GUIDE
This manual uses the following documentation conventions:
DOCUMENTATION CONVENTIONS
Description
Represents
Examples
Code (Courier font):
Plain characters
Sample code
Filenames and paths
#define START
c:\autoexec.bat
Angle brackets: < >
Variables
<label>, <exp>
Square brackets [ ]
Optional arguments
MPASMWIN [main.asm]
Curly brackets and pipe
character: { | }
Choice of mutually exclusive arguments; An OR selection
errorlevel {0|1}
Lowercase characters in Type of data
quotes
“filename”
Ellipses...
Used to imply (but not show) additional text that is not relevant to the
example
list
[“list_option...,
“list_option”]
0xnnn
A hexadecimal number where n is a
hexadecimal digit
0xFFFF, 0x007A
Italic characters
A variable argument; it can be either a char isascii (char,
type of data (in lowercase characters) ch);
or a specific example (in uppercase
characters).
Interface (Arial font):
Underlined, italic text
with right arrow
A menu selection from the menu bar
File > Save
Bold characters
A window or dialog button to click
OK, Cancel
Characters in angle
brackets < >
A key on the keyboard
<Tab>, <Ctrl-C>
Referenced books
MPLAB® IDE User’s Guide
Documents (Arial font):
Italic characters
RECOMMENDED READING
It is recommended that you become familiar with the documents listed below, prior to
using the PKE Reference Design Kit.
PICkit™ 2 Microcontroller Programmer User’s Guide (DS51553)
Consult this document for instructions on how to use the PICkit 2 Microcontroller
Programmer hardware and software.
AMHRRQ3-433 Telecontrolli Data Sheet (DS.0015-1.pdf)
AMHRR3-433 Telecontrolli Data Sheet (DS.0016-9.pdf)
PIC12F635/PIC16F636/639 Data Sheet (DS41232)
Data sheet for the PIC12F635/PIC16F636/639 8/14-pin Flash-based, 8-bit CMOS
microcontrollers with nanoWatt technology.
PIC16F688 Data Sheet (DS41203)
Data sheet for the PIC16F688 14-pin Flash-based 8-bit CMOS microcontrollers with
nanoWatt technology.
© 2006 Microchip Technology Inc.
DS21986A-page 2
PKE Reference Design User’s Manual
MCP201 LIN Transceiver with Voltage Regulator Data Sheet (DS21730)
Data sheet for the MCP201 LIN transceiver. Gives an overview of the device including
modes of operation and electrical characteristics.
Modular PICmicro® Mid-Range MCU Code Hopping Decoder Application Note
AN742 (DS00742)
Application note describes a KEELOQ code hopping decoder implemented on a
Microchip mid-range PICmicro microcontroller.
Using the PIC16F639 MCU for Smart Wireless Applications Application Note
AN959 (DS00959)
Application note describing the PIC16F639 as a suitable microcontroller for
bidirectional communications and low-frequency sensing applications.
HCS365 Data Sheet (DS41109)
Data sheet for the HCS365 KEELOQ code hopping encoder.
Low-Frequency Magnetic Transmitter Design Application Note AN232 (DS00232
Application note covering the basic aspects to consider when designing the transmitter
portion of a LFMC link.
PIC18F2585/2680/4585/4680 Data Sheet (DS39625)
Data sheet for the PIC18F2585/2680/4585/4680 28/40/44-pin enhanced Flash
microcontrollers with ECAN™ technology, 10-bit A/D and nanoWatt technology.
TC4421/TC4422 9A High-Speed MOSFET Drivers Data Sheet (DS21420)
Data sheet for the TC4421/TC4422 9A High-Speed MOSFET Driver. Gives an
overview of the device including electrical characteristics.
DS21986A-page 3
© 2006 Microchip Technology Inc.
Preface
THE MICROCHIP WEB SITE
Microchip provides online support via our web site at www.microchip.com. This web
site is used as a means to make files and information easily available to customers.
Accessible by using your favorite Internet browser, the web site contains the following
information:
• Product Support – Data sheets and errata, application notes and sample
programs, design resources, user’s guides and hardware support documents,
latest software releases and archived software
• General Technical Support – Frequently Asked Questions (FAQs), technical
support requests, online discussion groups, Microchip consultant program
member listing
• Business of Microchip – Product Selector Guide, latest Microchip press
releases, listing of seminars and events, listings of Microchip sales offices,
distributors and factory representatives
CUSTOMER SUPPORT
Users of Microchip products can receive assistance through several channels:
•
•
•
•
•
Distributor or Representative
Local Sales Office
Field Application Engineer (FAE)
Technical Support
Development Systems Information Line
Customers should contact their distributor, representative or field application engineer
(FAE) for support. Local sales offices are also available to help customers. A listing of
sales offices and locations is included in the back of this document.
Technical support is available through the web site at: http://support.microchip.com
© 2006 Microchip Technology Inc.
DS21986A-page 4
PKE Reference Design User’s Manual
NOTES:
DS21986A-page 5
© 2006 Microchip Technology Inc.
PKE REFERENCE DESIGN
USER’S MANUAL
Chapter 1. System Overview
1.1
OVERVIEW
This manual describes a Passive Keyless Entry (PKE) system upgrade to an existing
Remote Keyless Entry (RKE) application.
The key fob design contains a PIC16F639 with a integrated three-axis Analog
Front-End (AFE).
The Low-Frequency Initiator is implemented in a PIC18F2680.
This design has been optimized to integrate into an existing model platform without
substantial modification. Operational flexibility is the key to the overall concept with
many scalable features that are end-of-line programmable by customer, dealer or
factory.
FIGURE 1-1:
PKE BLOCK DIAGRAM
RF
Transmitter
Encoder
KEY
FOB
Buttons
434 MHz
3-Axis
AFE
Trigger
125 kHz
LF
Initiator
On-Vehicle
© 2006 Microchip Technology Inc.
RF
Receiver
Decoder
RKE
Receiver
Drivers
LIN
Lock
Actuator
DS21986A-page 6
PKE Reference Design User’s Manual
1.2
OPERATIONAL OVERVIEW
When the Low-Frequency (LF) Initiator detects a trigger input, a coded 125 kHz
message is transmitted. Any transponder within range of this signal receives this
message and validates the coded data field. If the Initiator is recognized, a RF
(433.92 MHz) KEELOQ® encoded message is transmitted. A standard RKE receiver
decodes this packet and, if recognized, the appropriate action is taken.
To reduce current consumption, the LF Initiator does not poll for transponders continuously.
A trigger event wakes the initiator from Sleep or Power-down (see Figure 1-1). The trigger
input can be any type or source such as:
•
•
•
•
Commanded over one of the networks
Infra-red under door handle
Simple microswitch activated by the door handle mechanism
Capacitive proximity detector sensing a change in a field by a hand approaching
the handle
The application described herein uses a microswitch input for simplicity. As delivered,
the LF initiator will continuously poll for the transponder. This is to facilitate orientation
and range evaluation.
The transponder key fob can operate as a regular push button RKE fob. When a valid
LF field message is sensed, the microcontroller responds as if a sixth phantom button
were pushed and transmits a unique function code.
The RF Receiver/Decoder combination can include a KEELOQ Security IC. Typical
decoders are the HCS500, HCS512 or HCS515. In the case of this design, a
custom-programmed PICmicro® mid-range microcontroller was used.
1.3
FEATURES
1.3.1
LF Initiator
Refer to Microchip Application Note AN232, “Low-Frequency Magnetic Transmitter
Design” (DS00232). Features of the LF Initiator are as follows:
•
•
•
•
•
Commanded by various types of inputs
Simple momentary switch
Proximity detector
Serial-numbered challenge
CAN and LIN network support
1.3.2
Key Fob
Refer to Microchip Application Note AN959, “Using the PIC16F639 MCU for Smart
Wireless Applications” (DS00959). Features of the key fob are as follows:
• Functionally compatible with Microchip’s HCS365 encoder
• Supports up to five push button inputs
• Two LED outputs for valid button and valid low-frequency challenge indication
DS21986A-page 7
© 2006 Microchip Technology Inc.
System Overview
1.3.3
RF Receiver
Refer to Microchip Application Note AN742 “Modular PICmicro® Mid-Range MCU Code
Hopping Decoder” (DS00742). Features of the RF Receiver are as follows:
• 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
1.4
REFERENCE DOCUMENTS
RF Receiver-Decoder
1.
2.
3.
4.
“AMHRRQ3-433” Telecontrolli Data Sheet, “DS.0015-1.pdf”
“AMHRR3-433” Telecontrolli Data Sheet, “DS.0016-9.pdf”
“PIC12F635/PIC16F636/639 Data Sheet” (DS41232), Microchip Technology Inc.
“PIC16F688 14-pin Flash-Based 8-Bit Data Sheet” (DS41203), Microchip
Technology Inc.
5. “MCP201 LIN Transceiver with Voltage Regulator Data Sheet” (DS21730),
Microchip Technology Inc.
6. “Modular PICmicro® Mid-Range MCU Code Hopping Decoder”, Application Note
AN742 (DS00742), Microchip Technology Inc.
RKE/PKE Key Fob
1. “PIC12F635/PIC16F636/639 Data Sheet” (DS41232), Microchip Technology Inc.
2. “Using the PIC16F639 MCU for Smart Wireless Applications”, Application Note
AN959 (DS00959), Microchip Technology Inc.
3. “HCS365 Data Sheet” (DS41109), Microchip Technology Inc.
4. “Low-Frequency Magnetic Transmitter Design”, Application Note AN232
(DS00232), Microchip Technology Inc.
LF Initiator
1. “PIC18F2585/2680/4585/4680 Data Sheet” (DS39625), Microchip Technology
Inc.
2. “TC4421/TC4422 9A High-Speed MOSFET Drivers Data Sheet” (DS21420),
Microchip Technology Inc.
3. “Low-Frequency Magnetic Transmitter Design”, Application Note AN232
(DS00232), Microchip Technology Inc.
© 2006 Microchip Technology Inc.
DS21986A-page 8
PKE Reference Design User’s Manual
NOTES:
DS21986A-page 9
© 2006 Microchip Technology Inc.
PKE REFERENCE DESIGN
USER’S MANUAL
Chapter 2. Low-Frequency Initiator Module
2.1
INTRODUCTION
The LF transmitter is derived from the design described in Application Note AN232,
”Low-Frequency Magnetic Transmitter Design” (DS00232).
2.2
HARDWARE
2.2.1
Microcontroller
A PIC18F2680 was selected for the LF controller based on the wide range of peripherals
available on the chip. The PIC18F2680 has both a CAN controller and a LIN-compatible
EAUSART to interface to in-vehicle networks. The Capture/Compare/PWM module
lends itself to generation of the 125 kHz square wave needed as the LF carrier.
2.2.2
Configurable Inputs
Two 12V tolerant inputs are provided for triggers. Both of these PCB circuits can be
reconfigured for a variety of input types. Refer to the schematic in Figure 2-1. For
example, if one of the inputs is a momentary switch to ground:
1. Substitute a 0Ω resistor for R2.
2. Remove R3 and D3.
3. Replace D2 with a 30K resistor.
2.2.3
LF Transmitter
A high-current MOSFET driver (TC4422) is driven by the PWM output of the
microcontroller, and in turn, drives the resonant tank circuit consisting of TX coil (L1) and
C2. This output circuit generates a magnetic field with a voltage of up to 320V
peak-to-peak.
2.2.4
Network Interfaces
Network connectivity is provided by a MCP201 LIN transceiver and a MCP2551 CAN
transceiver.
2.2.5
Power
Power can be supplied through either J1 power jack, J3 CAN plug or J4 LIN connection.
Voltage should be in the range of 8-18 VDC. The automotive-grade voltage regulator is
reverse-battery, transient and load-dump protected.
To reduce power consumption in key-off situations, the power-on LED may be
removed.
© 2006 Microchip Technology Inc.
DS21986A-page 10
RJ11
J2
J1
VCC
PWM
C7
0.1 uF
R7
MCLR
VCC
GND
RB7
RB6
RB3
1
30K
1
2
3
4
5
6
IN
C4
C3
D6
TC4422
OUT
U4
IN
5
Y1
20.0 MHz
+12 VDC
20 pF
1
C1
10 μF
1N4148
20 pF
VCC
10MQ100N
6
+12 VDC
3
VD D
GND
2
GND VD D
4
2
3
4
5
6
7
10
9
1
1K
OUT
R5
3
DO5022P
L2
10-00189
L1
YEL
LED2
C2
10 μF
LED1
TP1
10 nF
400V
P3476-ND
C8
High Voltage
0.200LS
C9
RC0/T1OSO/T1CKI
RC1/T1OSI
RC2/CCP1
RC3/SCK/SCL
RC4/SDI/SDA
RC5/SDO
RC6/TX/CK
RC7/RX/DT
C10
0.200LS
11
12
13
14
15
16
17
18
21
22
23
24
25
26
27
28
GRN
VCC
R1 1K
RB0/INT0
RB1/INT1
RB2/CANTX
RB3/CANRX
RB4
RB5
PIC18F2680 RB6
RB7
RA0/AN0
RA1/AN1
RA2/AN2/VREFRA3/AN3/VREF+
RA4/T0CLI
RA5/AN4/SS/LVDIN
OSC2/CLKOUT
OSC1/CLKIN
MCLR/VPP
U1
VCC
2
GND
VR1
LM2937ET-5.0
1
PWM
1N5819
1N5819
2
4
1
8
C5
1.0 uF
VCC
2
3
4
1
15K
25K
15K
C6
1.0 uF
MCP201
U3
CS/WAKE
TX
LIN
RX
FAULT/SLPS
GND
5
6
5
8
6
7
VCC
R3
R6
REF
RS
MCP2551
GND
VCC
VCC
R2
R4
CANL
CANH
D4
D2
10MQ100N
D8
1K
10MQ100N
D7
R9
4.7K
R8
+12 VDC
D9
2
4
6
2
4
6
R10
1N4750
CON6A
1
3
5
J4
CON6A
1
3
5
J3
120
To input a +5-to-0 signal, remove R3 or R6,
replace R2 or R4 with 1K, and either put a 10K
resistor across D2-D4 OR enable internal pull-ups
in the microcontroller.
These two input circuits are set-up for +12-to-GND signals.
25K
RXD
TXD
U2
D5
1N5819
D3
1N5819
3
VD D
DS21986A-page 11
7
FIGURE 2-1:
VBAT
D1
PKE Reference Design User’s Manual
SCHEMATIC – LOW-FREQUENCY INITIATOR
© 2006 Microchip Technology Inc.
Low-Frequency Initiator Module
2.3
SOFTWARE
The LF message shown in Figure 2-2 is transmitted when the trigger event is detected.
As shown, the module will wait up to 50 ms after the challenge for a response from the
RF Receiver module. This notification is sent over the LIN data line. If no response is
received, the module will send the same message two more times, and then enter
power-down, awaiting another trigger.
FIGURE 2-2:
LF CHALLENGE DATA FORMAT
125 kHz Base Frequency
50 ms
Guard Time
Wake-Up 125 kHz Preamble
Challenge Code Portion (16 Bits)
Least Significant bits of Serial Number
(16 Bits)
2 ms
2 ms
500 μs
UHF Response Slot
4 ms
Transmission Direction LSb First
The LF challenge message consists of a 125 kHz carrier modulated as follows:
1:
A 4 ms ON to settle the receiving AGC.
2:
500 μs OFF.
3:
2 ms ON followed by a 2 ms OFF to enable the receiver output filter. This
pattern is dependant on the configuration setting of the receiving AFE.
4:
16 Least Significant bits (LSb) of the module serial number, PWM encoded
(see Figure 2-3).
5:
50 ms OFF, waiting for a valid response from the RF receiver.
The challenge code portion of the message is to ensure that only previously learned
transponders are hailed. All others will remain silent. This challenge code may be
expanded or reduced by changes to the firmware to address individual application
requirements. For this design, 16 bits were deemed sufficient.
FIGURE 2-3:
CODE WORD DATA TRANSMISSION FORMAT (PWM)
LOGIC ‘0’
LOGIC ‘1’
Bit
Period
© 2006 Microchip Technology Inc.
DS21986A-page 12
PKE Reference Design User’s Manual
NOTES:
DS21986A-page 13
© 2006 Microchip Technology Inc.
PKE REFERENCE DESIGN
USER’S MANUAL
Chapter 3. PKE Transmitter-Transponder
3.1
INTRODUCTION
The RKE Key Fob unit is a complete solution for PKE and RKE applications in a key
fob type form factor. The board was designed to accept a PIC16F636 or a PIC16F639
microcontroller. With minor modifications, it will also support a PIC12F635.
Some features of this design are:
•
•
•
•
3.2
Up to five push button inputs
One or two LED outputs
433.92 MHz transmitter
3-axis low-frequency receiver
HARDWARE
A PIC16F636, installed pin 1 justified at location U1, will support RKE applications.
Since the PIC16F636 shares the same pinout as the PIC16F639 on its upper most
pins, the only function lost is the on-chip low-frequency analog front-end.
For PKE applications, a PIC16F639 and the associated low-frequency receiver coils
are installed.
The four buttons (S1-S4) on the transmitters are connected to the appropriate inputs
on the microcontroller (S1-S4). The user may activate any combination of encoder
inputs transmitting any of the 15 possible function codes. The RFEN output option is
not used by the demonstration transmitter and should be disabled as this function
shares its output with a button input. If RFEN is enabled, the button input will be lost.
See Section 3.3 “Software”.
Button S5 is not directly associated with a specific function code bit, but rather transmits
a user-defined function code stored in EEPROM data memory.
The microcontroller Flash program and EEPROM data memory may be
programmed through J1. This connector is pinout compatible with PICkit™ 1 and
PICkit™ 2 programmers.
© 2006 Microchip Technology Inc.
DS21986A-page 14
PKE Reference Design User’s Manual
TABLE 3-1:
I/O CONNECTIONS
PORT Pin
Function
Notes
Inputs
RA0
Switch 5
ICSP™ Data
RA1
LF Data Input
ICSP Clock
RA2
Switch 3
RA3
Switch 2
RA4
Switch 1
RA5
Switch 4
ICSP MCLR
Outputs
RC0
RF Active LED
RC4
LF Challenge LED
RC5
RF Data Out
Others
RC1
Internally connected on PIC16F639
not used on PIC16F636
RC2
Internally connected on PIC16F639
not used on PIC16F636
RC3
Internally and externally connected on PIC16F639
not used on PIC16F636
3.2.1
Transmitter
The RF oscillator uses a Surface Acoustic Wave (SAW) resonator that operates at
433.92 MHz.
Note:
The design and layout of this transmitter is not sufficient to ensure
compliance with EC or FCC regulations.
The Programming Connector (J1) enables In-Circuit Serial Programming™ (ICSP™).
The transmitter can therefore be re-configured or re-programmed without removing the
microcontroller from the board.
FIGURE 3-1:
J1 PROGRAMMING CONNECTOR
1
2
VSS 3
ICSPDAT 4
ICSPCLK 5
no connection 6
MCLR
VCC
DS21986A-page 15
© 2006 Microchip Technology Inc.
VCC
1
3
5
+
+
+
J1
2
4
6
VCC
+
+
+
R16 100k
1.0 uF
C12
ICSPCLK
ICSPDAT
VCC
D8
C6
Do not assemble parts
within dotted boxes
for RKE-only
application. Replace
PIC16F639 with
PIC16F636.
10M
C11
1.0 uF
LX2
CY1 9.0 mH
220 pF
LY1
CZ1
7.1 mH
220 pF
LZ1
1K
CX1
264 pF
R8
0
VSST
RC0/C2IN+
RC1/C2INRC2
RC3
RC4/C2OUT
RC5
R12
240 pF + 24 pF
PIC16F639
100 nF
Boot
Shift
Hazard
Lock
7.1 mH
R9
VDDT
LCX
LCY
LCZ
LCCOM
RA0/C1IN+
RA1/C1INRA2/C1OUT/INT
RA3/MCLR
RA4/OSC2
RA5/OSC1
LCCOM
LX
LY
8
11
10
9
12
19
18
17
4
3
2
U3
VCC
SW5
SW3
SW2
1
VCC
GND
20
1N4148WS
LZ
13
16
15
14
7
6
5
U2
R2
433.92 MHz SAW
PWM
CSn
SCLK/ALERT
LFDATA
VBAT
1
3
5
7
nc
nc
nc
nc
47K
3V/6V
BT1
2
IN
Unlock
4
SW1
Active
C4
100 nF
OUT
6
Challenge
D4
LED-RED
D2
5.1V
R3
220
Q1
NE94433
R19 470
R20 470
D1 MA2S784
LED-GRN
D5
GND
© 2006 Microchip Technology Inc.
GND
VCC
VCC
C3
12 pF
C2
2.0 pF
C5
1.0 uF
VCC
C1
470 pF
R1 47
L1
Antenna
VBAT
FIGURE 3-2:
8
SW4
PKE Transmitter-Transponder
SCHEMATIC – RF RECEIVER/DECODER USING THE PIC16F639
DS21986A-page 16
PKE Reference Design User’s Manual
3.3
SOFTWARE
The transponder firmware is functionally based on the Microchip HCS365 KEELOQ
encoder. See the “HCS365 Data Sheet” (DS41109) for more information. Additional
routines have been added to initialize and interface to the internal low-frequency
analog front-end of the PIC16F639.
Note 1:
The transponder is initially supplied pre-programmed with the KEELOQ
encryption algorithm. The program memory and EEPROM data memory are
read-protected.
2:
The software source files supplied on the CD with this transponder have
the KEELOQ encryption routines deleted. If a new hex file is assembled
using these source files and programmed into the microcontroller, the
original KEELOQ hopping code will be overwritten and lost.
3:
Contact Microchip Technology for information about KEELOQ Security ICs
and licensing options.
The transponder key fob operates as a standard 5-button RKE fob, when not being
challenged by a Low-Frequency Initiator signal. The microcontroller responds as if a
sixth or a phantom button were pushed, when a valid LF field message is sensed and
verified.
The transponder will normally be in a low-power Sleep mode. When a switch input is
taken low or a LF challenge is received, the device will wake-up and go through
debounce delay of 20 ms before the switch value is latched. The device will then read
the configuration options and depending on the configuration options, it will determine
what the data and modulation format will be for the transmission. The transmission will
consist of a stream of code words. The code words are transmitted after the button is
pressed and as long as the buttons are held down or a time out occurs. The code word
format can be either a code hopping format or a seed format.
The time-out time can be selected with the Time-out Select (TSEL) configuration
option. This option allows the time out to be disabled or set to 0.8s, 3.2s or 25.6s. When
a time out occurs, the device will go into Sleep mode to protect the battery from draining
when a button gets stuck.
If during the transmit process a new button is detected, the current code word will be
aborted, a new code word will be transmitted and the time-out counter will reset. If all
the buttons are released, a minimum number of code words will still be completed. The
minimum code words can be set to 1, 2, 4 or 8 using the minimum code words (MTX)
configuration option. If the time for transmitting the minimum code words is longer than
the time-out time, the device will not complete the minimum code words.
A summary table of all the options is given in Section 3.3.3 “EEPROM Organization”.
DS21986A-page 17
© 2006 Microchip Technology Inc.
PKE Transmitter-Transponder
The software includes four assemble-time conditional options. These options are
enabled by removing the semi-colon in column 1 of the code line.
Select Processor, enable only one below:
#DEFINE P12F635 1
#DEFINE P16F636 1
#DEFINE P16F639 1
;Sets environment for PIC12F635
;Sets environment for PIC16F636
;Sets environment for PIC16F639
Select PORTA buttons to be connected to ground with internal pull-ups OR, connected
to VCC with internal pull-downs:
#DEFINE pullup
1
;Set to select pull-ups on PORT A.
;For pull-downs, comment out.
Since the in-circuit emulator does not support Sleep:
#DEFINE ICEmul
1
;Is set, device will not SLEEP, but will
;loop forever
Select option not to Encrypt:
#DEFINE NoEncryption 1
© 2006 Microchip Technology Inc.
DS21986A-page 18
PKE Reference Design User’s Manual
FIGURE 3-3: FLOWCHART – DEVICE OPERATION
Start
Sample
Buttons
Receive
Challenge
Get Config
LF
Data?
Yes
No
Seed
TX?
Valid
Request?
Yes
No
Yes
Read Seed
No
Increment
Counter
Encrypt
Transmit
Time Out?
Yes
No
No
MTX?
Stop
Yes
No
Buttons?
Yes
No
Seed
Time?
No
No
Yes
Seed
Button?
Yes
No
New
Buttons?
Yes
DS21986A-page 19
© 2006 Microchip Technology Inc.
PKE Transmitter-Transponder
3.3.1
Dual Encoder Operation
The transponder contains two transmitter Configuration Words, serial numbers,
encoder keys, discrimination values, counters and seed values. This means that the
transponder can be used as two independent encoders. The code word is calculated
using one of two possible encoder configurations. Most options for code word and
modulation formats can be different from Encoder 1 and Encoder 2, but LED and RF
transmitter options have to be the same. The Shift input pin is used to select between
the encoder configurations. A low on the Shift pin will select Encoder 1 and a high will
select Encoder 2.
3.3.2
Code Hopping Code Word Data Format
A code hopping code word consists of 32 bits of code hopping data, 32 bits of fixed
code and between 3 and 5 bits of status information. Various code word formats are
shown in Figure 3-4 for KEELOQ encoder compatible transmissions.
© 2006 Microchip Technology Inc.
DS21986A-page 20
PKE Reference Design User’s Manual
FIGURE 3-4:
CODE WORD DATA FORMAT
With XSER = 0, 16-bit Counter, QUEN = 0
CRC
2 Bits
C1
VLOW
1 Bit
C0
Hopping Code Portion (32 Bits)
Fixed Code Portion (32 Bits)
Status Information
(3 Bits)
BUT
4 Bits
Counter
BUT Overflow
4 Bits 2 Bits
Serial Number
(28 Bits)
S2 S1 S0 S3
S2 S1 S0 S3
OVR1
DISC
10 Bits
Synchronization
Counter
16 Bits
0
15
OVR0
With XSER = 1, 16-bit Counter, QUEN = 1
Fixed Code Portion (32 Bits)
Status Information
(5 Bits)
QUE
2 Bits
CRC
2 Bits
Hopping Code Portion (32 Bits)
Counter
BUT Overflow
4 Bits 2 Bits
Serial Number
(32 Bits)
VLOW
1 Bit
Q1 Q0 C1 C0
S2
S1
S0 S3
OVR1
DISC
10 Bits
Synchronization
Counter
16 Bits
15
0
OVR0
With XSER = 0, 20-bit Counter, QUEN = 1
QUE
2 Bits
CRC
2 Bits
Q1 Q0 C1 C0
VLOW
1 Bit
Hopping Code Portion (32 Bits)
Fixed Code Portion (32 Bits)
Status Information
(5 Bits)
BUT
4 Bits
S2 S1 S0
Serial Number
(28 Bits)
BUT
4 Bits
S2
S3
S1
DISC
8 Bits
Synchronization
Counter
20 Bits
0
19
S0 S3
With XSER = 1, 20-bit Counter, QUEN = 0
Status Information
(3 Bits)
CRC
2 Bits
C1 C0
VLOW
1 Bit
Fixed Code Portion (32 Bits)
Hopping Code Portion (32 Bits)
Serial Number
(32 Bits)
BUT
4 Bits
S2
S1
DISC
8 Bits
Synchronization
Counter
20 Bits
19
0
S0 S3
Transmission Direction LSb First
DS21986A-page 21
© 2006 Microchip Technology Inc.
PKE Transmitter-Transponder
FIGURE 3-5:
CODE WORD DATA FORMAT, NO ENCRYPTION
With XSER = 0, 16-bit Counter, QUEN = 0, S<3:0> not equal ‘0111’
Fixed Code Portion (64 Bits)
Status Information
(3 Bits)
CRC
2 Bits
C1
VLOW
1 Bit
C0
Serial Number 1
(28 Bits)
BUT
4 Bits
BUT USER1
4 Bits 4 Bits
S2 S1 S0 S3 Data 71h
S2 S1 S0 S3
USER0
8 Bits
Serial Number 2
(16 Bits)
Data 72h
With XSER = 1, 16-bit Counter, QUEN = 1, S<3:0> not equal ‘0111’
Status Information
(5 Bits)
QUE
2 Bits
CRC
2 Bits
Fixed Code Portion (64 Bits)
Serial Number
(32 Bits)
VLOW
1 Bit
BUT USER1
4 Bits 4 Bits
Q1 Q0 C1 C0
S2
S1
S0 S3 Data 71h
USER0
8 Bits
Serial Number 2
(16 Bits)
Data 72h
With XSER = 0, 16-bit Counter, QUEN = 0, S<3:0> equal ‘0111’
Fixed Code Portion (64 Bits)
Status Information
(3 Bits)
CRC
2 Bits
C1
VLOW
1 Bit
C0
Serial Number 1
(28 Bits)
BUT
4 Bits
Serial Number 2
(32 Bits)
BUT
4 Bits
S2 S1 S0 S3
S2 S1 S0 S3
With XSER = 1, 16-bit Counter, QUEN = 1, S<3:0> equal ‘0111’
Status Information
(5 Bits)
QUE
2 Bits
CRC
2 Bits
Fixed Code Portion (64 Bits)
Serial Number
(32 Bits)
VLOW
1 Bit
Q1 Q0 C1 C0
BUT
4 Bits
S2
S1
Serial Number 2
(32 Bits)
S0 S3
Transmission Direction LSb First
TABLE 3-2:
Note 1:
FUNCTION CODES
Button
Function
S0
F[xx1x]
S1
F[x1xx]
S2
F[1xxx]
S3
F[xxx1]
S4
User Programmable
LF Challenge
User Programmable
The function code is repeated in the encrypted and unencrypted data of a transmission.
© 2006 Microchip Technology Inc.
DS21986A-page 22
PKE Reference Design User’s Manual
3.3.3
EEPROM Organization
A summary of the transponder EEPROM organization is shown in Tables 3-3, 3-4 and
3-5. The address column shows the starting address of the option and its length, or bit
position. Options larger than 8 bits are stored with the MSb at the given address, and
enough consecutive 8-bit blocks are reserved for the entire option size. Options such
as SEED, which has a length that is not an exact multiple of 8 bits, are stored right
justified in the reserved space such that additional smaller options, like SDBT, may be
stored in the same address as the MSb.
TABLE 3-3:
Symbol
Address
(Bits)
Description(1)
KEY1
1E: 64 bits
Encoder Key
SEED1
14: 60 bits
Encoder Seed Value
SYNC1
00: 20 bits
00: 18 bits
Encoder Synchronization Counter (CNTSEL=1)
Encoder Synchronization Counter (CTNSEL = 0) plus overflow
SER1
10: 32 bits
Encoder Serial Number
DISC1
1C: 10 bits
Encoder Discrimination value
MSEL1
1C: ---- 3--2
Transmission Modulation
Format
Value
Format
00b
PWM
01b
Manchester
10b
VPWM
11b
PPM
HSEL1
1C: ---4 ----
Header Select
4 TE = 0
10 TE = 1
XSER1
1C: --5- ----
Extended Serial Number
28 bits = 0
32 bits = 1
QUEN1
1C: -6-- ----
Queue Counter Enable
Disable = 0
Enable = 1
STEN1
1C: 7--- ----
Start/Stop Pulse Enable
Disable = 0
Enable = 1
LEDBL1
3F: -6-- ----
Low-Voltage LED Blink
Never = 0
Once = 1
LEDOS1
3F: 7--- ----
LED On-Time Select(1)
50 ms = 0
100 ms = 1
SDLM1
3C: ---- ---0
Limited Seed
Disable = 0
Enable = 1
SDEN1
3C: ---- --1-
Seed Enable
Disable = 0
Enable = 1
SDMD1
00: 7--- ----
Seed Mode
User = 0
Production = 1
SDBT1
14: 7654 ----
Seed Button Code
SDTM1
3C: ---- 32--
Time Before Seed Code
Word(1)
BSEL1
GSEL1
Note 1:
DS21986A-page 23
ENCODER 1 (SHIFT = 0)
3C: --54 ----
3C: 76-- ----
Transmission Baud Rate
Select(1)
Guard Time Select
(1)
Value
Time (s)
00b
0.0
01b
0.8
10b
1.6
11b
3.2
Value
TE (μs)
00b
100
01b
200
10b
400
11b
800
Value
Time (ms)
00b
0.0
01b
6.4
10b
51.2
11b
102.4
All Timing values vary ±10%.
© 2006 Microchip Technology Inc.
PKE Transmitter-Transponder
TABLE 3-4:
Symbol
ENCODER 2 (SHIFT = 1)
Address
(Bits)
Description(1)
KEY2
34: 64 bits
Encoder Key
SEED2
2A: 60 bits
Encoder Seed Value
SYNC2
08: 20 bits
08: 18 bits
Encoder Synchronization Counter (CNTSEL = 1)
Encoder Synchronization Counter (CTNSEL = 0) plus overflow
SER2
26: 32 bits
Encoder Serial Number
DISC2
32: 10 bits
Encoder Discrimination value
MSEL2
32: ---- 3--2
Transmission Modulation
Format
Value
Format
00b
PWM
01b
Manchester
10b
VPWM
11b
PPM
10 TE = 1
HSEL2
32: ---4 ----
Header Select
4 TE = 0
XSER2
32: --5- ----
Extended Serial Number
28 bits = 0
32 bits = 1
QUEN2
32: -6-- ----
Queue Counter Enable
Disable = 0
Enable = 1
STEN2
32: 7--- ----
Start/Stop Pulse Enable
Disable = 0
Enable = 1
LEDBL2
3D: -6-- ----
Low-Voltage LED Blink
Never = 0
Once = 1
LEDOS2
3D: 7--- ----
LED On-Time Select(1)
50 ms = 0
100 ms = 1
SDLM2
3E: ---- ---0
Limited Seed
Disable = 0
Enable = 1
SDEN2
3E: ---- --1-
Seed Enable
Disable = 0
Enable = 1
SDMD2
08: 7--- ----
Seed Mode
User = 0
Production = 1
SDBT2
2A: 7654 ----
Seed Button Code
SDTM2
3E: ---- 32--
Time Before Seed Code
Word(1)
BSEL2
GSEL2
Note 1:
© 2006 Microchip Technology Inc.
3E: --54 ----
3E: 76-- ----
Transmission Baud Rate
Select(1)
Guard Time Select
(1)
Value
Time (s)
00b
0.0
01b
0.8
10b
1.6
11b
3.2
Value
TE (μs)
00b
100
01b
200
10b
400
11b
800
Value
Time (ms)
00b
0.0
01b
6.4
10b
51.2
11b
102.4
All Timing values vary ±10%.
DS21986A-page 24
PKE Reference Design User’s Manual
TABLE 3-5:
Symbol
WAKE
Address
(Bits)
3F: ---- --10
Description(1)
Wake-up(1)
Value
Value
00b
No Wake-up
01b
75 ms 50%
10b
50 ms 33.3%
11b
100 ms 16.6%
CNTSEL
3F: ---- -2--
Counter Select
16 bits = 0
20 bits = 1
VLOWL
3F: ---- 3---
Low-Voltage Latch Enable
Disable = 0
Enable = 1
VLOWSEL
3F: ---4 ----
Low-Voltage Trip Point
Select(2)
2.2 V = 0
3.2V = 1
PLLSEL
3F: --5- ----
PLL Interface Select
ASK = 0
FSK = 1
MTX
3D: ---- --10
Minimum Code Words
Value
Value
00b
1
01b
2
10b
4
11b
8
SLEEP
3D: ---- 3---
Sleep Output Enable
Disable = 0
Enable = 1
WAIT
3D: ---- -2--
Wait for Step-Up Regulator
Disable = 0
Enable = 1
TSEL
3D: --54 ----
Time-out Select
(1)
S4CODE
40: --54 32--
S5CODE
41: --54 32--
Switch 5 Button Code
PKECODE
42: --54 32--
PKE Challenge Received Code
Note 1:
2:
DS21986A-page 25
DEVICE OPTIONS
Value
Time(s)
00b
Disabled
01b
0.8
10b
3.2
11b
25.6
Switch 4 Button Code
All Timing values vary ±10%.
Voltage thresholds are ±100 mV.
© 2006 Microchip Technology Inc.
PKE REFERENCE DESIGN
USER’S MANUAL
Chapter 4. Remote Keyless Entry Receiver-Decoder Module
4.1
INTRODUCTION
The Remote Keyless Entry Receiver-Decoder module serves as a target board for RKE
and PKE transmissions. Visual indications of function codes, as well as, an in-vehicle
network interface are included.
This module consists of a UHF receiver, microcontroller, power supply, LED indicators
and a network physical interface.
FIGURE 4-1:
RKE RECEIVER/DECODER
Microcontroller
Function LEDS
Radio Rec.
DataIN
LEARN SW
4.2
LEARN LED
VLOW LED
Bus
Transceiver
Network
HARDWARE
4.2.1
UHF Receiver
The RF input is an AM super-regenerative compact hybrid module, which is used to
capture undecoded data from an AM Transmitter. This module has very high frequency
stability over a wide operating temperature and is tolerant of mechanical vibrations or
manual handling. A laser-trimmed, on-board inductor removes the need for any
adjustable components. Either 433.92 MHz or 315 MHz may be supplied with the
board. A CMOS/TTL output supports data rates up to 2000 Hz. This input to the
receiver module is connected to the microcontroller PORTA bit 2 INT pin. For more
information on the receiver module, see the Telecontrolli Data Sheets “DS.0015-1.pdf”
and “DS.0016-9.pdf” available on the PKE Reference Design CD-ROM (DS51575).
4.2.2
Microcontroller
a) The microcontroller can be any one of the 14-pin PICmicro® microcontroller
family members, but it is usually a PIC16F636 or a PIC16F688. The
PIC16F636 has on-chip KEELOQ encoder/decoder hardware, while the
PIC16F688 has an Enhanced Addressable USART (EAUSART) that
supports the Local Interconnect Network (LIN) and SAE J2602 protocol. In
addition to the RF data input described above, the following table shows the
I/O port connections.
© 2006 Microchip Technology Inc.
DS21986A-page 26
PKE Reference Design User’s Manual
TABLE 4-1:
I/O CONNECTIONS
PORT Pin
Function
Notes
Inputs
RA0
Jumper E2 to GND, available to user
RA2
RF Data input
RA3
LEARN push button input
ICSP™ Data
ICSP MCLR
Outputs
RA4
LEARN mode active LED
RA5
VLOW LED
RC0
S0 Function LED
RC1
S1 Function LED
RC2
S2 Function LED
RC3
S3 Function LED
Network Transceiver
RA1
Chip Select output
RC4
TX output
RC5
RX input
Note:
ICSP Clock
When programming the module, remove Jumpers 1 and 2. Replace after
verification.
The microcontroller Flash program and EEPROM data memory may be programmed
through J2. This connector is pinout compatible with PICkit™ 1 and PICkit™ 2
programmers.
See the “PIC12F635/16F636/639 Data Sheet” (DS41232) or the “PIC16F688 Data
Sheet” (DS41203) for additional information.
4.2.3
Network Interface
This section of the board may not be populated, depending upon the end application.
If this section needs to be assembled, a complete bill of materials is available.
A MCP201 (or MCP202) LIN-bus transceiver is used for the physical slave bus driver
to connect to a LIN or J2602-compatible network. A Zener diode protects the LIN bus
pin from transient voltages. The capacitor between the LIN-bus pin and ground should
have its value adjusted for the particular network topology. A large pull-up resistor on
the FAULT/SLPS pin ensures that the device resets to a standard slope control profile.
See the “MCP201 LIN Transceiver with Voltage Regulator Data Sheet” (DS21730) for
more information.
4.2.4
Power Supply
Power can be supplied to the board by way of either a J3 (5.5 mm x 2.5 mm) power jack
or through J1 (AMP 770969). Voltage should be in the range of 8-18 VDC. The automotive-grade voltage regulator is reverse-battery, transient and load-dump protected.
To reduce power consumption in key-off situations, the power-on LED may be
removed.
DS21986A-page 27
© 2006 Microchip Technology Inc.
Remote Keyless Entry Receiver-Decoder Module
4.2.5
Connectors
FIGURE 4-2:
FIGURE 4-3:
J1 SYSTEM CONNECTOR
no connection
1
4 +12 VDC VBAT
no connection
2
5
LIN Bidirectional BUS
no connection
3
6
Chassis GND
J2 PROGRAMMING CONNECTOR
MCLR 1
VCC 2
VSS 3
ICSPDAT 4
ICSPCLK 5
no connection 6
FIGURE 4-4:
J3 POWER CONNECTOR
CHASSIS GND
© 2006 Microchip Technology Inc.
+12 VDC VBAT
DS21986A-page 28
J3
J1
+
+
+
+
+
+
D1
DS2
LED
S1
C1
D2 10 uF
1N4004
1N4755 43V
2
4
6
+
1N4750 27V
D3
LINbus
220 pF
C6
Not assembled with PIC16F636
1
3
5
VBB
1K
R6
MCP201
LIN
CS/WAKE
TX
RX
FAULT/SLPS
GND
1.0
C5
LEARN
1K
2
4
1
8
VCC
U3
OUT
Can be replaced with
MCP202
5
6
.01 uF
C4
R2
10K
R4
IN
VCC
1
REG1
LM2937IMP-5.0
2
VBB
7
VBAT
100K
R10
E1
0.1 uF
+ C3
+
ON
LED1
Green LED
10 uF
C2
3
1
2
GND
3
VD D
1
DS21986A-page 29
E2
R1
1K
VCC
RA0/CIN+
RA1/CINRA2/C1OUT/INT
RA3/MCLR
RA4/OSC2
RA5/OSC1
PIC16F636
RC0/C2IN+
RC1/C2INRC2
RC3
RC4/C2OUT
RC5
10
9
8
7
6
5
Can be replaced with PIC16F688 for LIN applications
13
12
11
4
3
2
U2
VCC
AMRRS3-433 or -315
U1
VC C
GND
ANT
NC
NC
NC
GND
NC
NC
VC C
GND
VC C
TEST
OUT
VC C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
R9 1K
R8 1K
R7 1K
R5 1K
R3 1K
DS1
LED
DS6
LED
DS5
LED
DS4
LED
DS3
LED
VCC
1
2
3
4
5
6
J2
VLOW
S3
S2
S1
S0
FIGURE 4-5:
2
ANT1
PKE Reference Design User’s Manual
SCHEMATIC – TRANSPONDER KEY FOB
© 2006 Microchip Technology Inc.
Remote Keyless Entry Receiver-Decoder Module
4.3
SOFTWARE
The firmware is derived from Microchip Application Note AN743, “Modular PICmicro®
Mid-Range MCU Code Hopping Decoder” (DS00743). Originally written for a
PIC16CE624, the code has been ported to the PIC16F6XX family of devices.
The program implements a KEELOQ code hopping decoder. The software has been
designed as a set of almost independent modules (standard assembly include files
“*.INC”). For clarity and ease of maintenance, each module covers a single simple
function and can be replaced to accommodate different behavior and/or support a
different set of peripherals (memories, timers, etc.).
The set of modules presented in this application note implements the following
features:
•
•
•
•
Interrupt driven Radio Receiver (PWM) routine
Uses internal EEPROM memory to learn up to 16 transmitters
Supports Normal Learn mode
Compatible with all existing KEELOQ code hopping encoders with PWM
transmission format selected, operating in “medium mode” (Te = 200 μs)
• Uses internal 8 MHz oscillator (self-calibrating during receive)
4.3.1
Modules Overview
The code presented in this application note is composed of the following basic modules:
File Name
Function
KEELOQ®
CHECKSN.ASM
Substituted for
FASTDEC.INC(1)
KEYGEN.INC(1)
KEELOQ® decryption routine
KEELOQ® decryption key generation routines implementing Normal
MEM-63X.INC
Encapsulates PIC16F636 EEPROM drivers
decryption files
mode
MID.ASM
The actual initialization and main loop
RXI.INC
Interrupt driven receiver
TABLE.INC
Transmitters table memory management (linear list)
Note 1:
These files are not included in the general distribution set. They are available on
the KEELOQ decoder license CD-ROM (DS40038) through your local Microchip
Sales Office.
The software has been modified to include four assemble-time conditional options.
Select Processor, enable only one below:
#DEFINE P12F635
#DEFINE P16F636
1
1
;Sets environment for PIC12F635
;Sets environment for PIC16F636
Select PORTA push buttons to be connected to ground with internal pull-ups OR,
connected to VCC with internal pull-downs:
#DEFINE pullup
1
;Set to select pull-ups on PORT A.
;For pull-downs, comment out
Since the In-Circuit-Emulator can not properly handle Sleep:
#DEFINE ICEmul
1
;Is set, device will not SLEEP, but will
;loop forever
Select option not to Encrypt:
#DEFINE NoEncryption 1
© 2006 Microchip Technology Inc.
DS21986A-page 30
PKE Reference Design User’s Manual
FIGURE 4-6:
MODULES OVERVIEW DIAGRAM
TMR0
Interrupt
RXI.INC
Radio Rec
1st Buffer
X
BFFULL
Flag
MEM-62X.INC
Learn
Receive Buffer CSR
TABLE.INC
Out S0
MID.ASM
Out S3
- Insert
- Search
Main Loop
FL62X.ASM
EEPROM
LED
VLOW
- RD Word
- WR Word
KEY64.Inc
Manufacturer Code
KEYGEN.INC
- Normal KEY GEN
- Manufacturer Code Load
-OR-
CheckSN.asm(1)
KEELOQ® decoder(1)
FASTDEC.INC
- Decrypt
Note
1:
Substitute for KEELOQ decoder decryption files.
DS21986A-page 31
© 2006 Microchip Technology Inc.
Remote Keyless Entry Receiver-Decoder Module
FIGURE 4-7:
CODE WORD DATA FORMAT
With XSER = 0, 16-bit Counter, QUEN = 0
Fixed Code Portion (32 Bits)
Status Information
(3 Bits)
CRC
2 Bits
C1
VLOW
1Bit
C0
BUT
4 Bits
Hopping Code Portion (32 Bits)
Counter
BUT Overflow
4 Bits 2 Bits
Serial Number
(28 Bits)
S2 S1 S0 S3
S2 S1 S0 S3
OVR1
DISC
10 Bits
Synchronization
Counter
16 Bits
0
15
OVR0
Transmission Direction LSb First
FIGURE 4-8:
CODE WORD DATA FORMAT, NO ENCRYPTION
With XSER = 0, 16-bit Counter, QUEN = 0, S<3:0> not equal ‘0111’
Fixed Code Portion (64 Bits)
Status Information
(3 Bits)
CRC
2 Bits
C1
VLOW
1Bit
C0
BUT
4 Bits
S2 S1 S0 S3
Serial Number 1
(28 Bits)
BUT USER1
4 Bits 4 Bits
S2 S1 S0 S3 Data 71h
USER0
8 Bits
Serial Number 2
(16 Bits)
Data 72h
Transmission Direction LSb First
© 2006 Microchip Technology Inc.
DS21986A-page 32
WORLDWIDE SALES AND SERVICE
AMERICAS
ASIA/PACIFIC
ASIA/PACIFIC
EUROPE
Corporate Office
2355 West Chandler Blvd.
Chandler, AZ 85224-6199
Tel: 480-792-7200
Fax: 480-792-7277
Technical Support:
http://support.microchip.com
Web Address:
www.microchip.com
Australia - Sydney
Tel: 61-2-9868-6733
Fax: 61-2-9868-6755
India - Bangalore
Tel: 91-80-2229-0061
Fax: 91-80-2229-0062
China - Beijing
Tel: 86-10-8528-2100
Fax: 86-10-8528-2104
India - New Delhi
Tel: 91-11-5160-8631
Fax: 91-11-5160-8632
Austria - Wels
Tel: 43-7242-2244-399
Fax: 43-7242-2244-393
Denmark - Copenhagen
Tel: 45-4450-2828
Fax: 45-4485-2829
China - Chengdu
Tel: 86-28-8676-6200
Fax: 86-28-8676-6599
India - Pune
Tel: 91-20-2566-1512
Fax: 91-20-2566-1513
France - Paris
Tel: 33-1-69-53-63-20
Fax: 33-1-69-30-90-79
China - Fuzhou
Tel: 86-591-8750-3506
Fax: 86-591-8750-3521
Japan - Yokohama
Tel: 81-45-471- 6166
Fax: 81-45-471-6122
Germany - Munich
Tel: 49-89-627-144-0
Fax: 49-89-627-144-44
China - Hong Kong SAR
Tel: 852-2401-1200
Fax: 852-2401-3431
Korea - Gumi
Tel: 82-54-473-4301
Fax: 82-54-473-4302
China - Qingdao
Tel: 86-532-8502-7355
Fax: 86-532-8502-7205
Korea - Seoul
Tel: 82-2-554-7200
Fax: 82-2-558-5932 or
82-2-558-5934
Atlanta
Alpharetta, GA
Tel: 770-640-0034
Fax: 770-640-0307
Boston
Westborough, MA
Tel: 774-760-0087
Fax: 774-760-0088
Chicago
Itasca, IL
Tel: 630-285-0071
Fax: 630-285-0075
Dallas
Addison, TX
Tel: 972-818-7423
Fax: 972-818-2924
Detroit
Farmington Hills, MI
Tel: 248-538-2250
Fax: 248-538-2260
Kokomo
Kokomo, IN
Tel: 765-864-8360
Fax: 765-864-8387
Los Angeles
Mission Viejo, CA
Tel: 949-462-9523
Fax: 949-462-9608
San Jose
Mountain View, CA
Tel: 650-215-1444
Fax: 650-961-0286
China - Shanghai
Tel: 86-21-5407-5533
Fax: 86-21-5407-5066
China - Shenyang
Tel: 86-24-2334-2829
Fax: 86-24-2334-2393
China - Shenzhen
Tel: 86-755-8203-2660
Fax: 86-755-8203-1760
China - Shunde
Tel: 86-757-2839-5507
Fax: 86-757-2839-5571
China - Wuhan
Tel: 86-27-5980-5300
Fax: 86-27-5980-5118
China - Xian
Tel: 86-29-8833-7250
Fax: 86-29-8833-7256
Malaysia - Penang
Tel: 60-4-646-8870
Fax: 60-4-646-5086
Philippines - Manila
Tel: 63-2-634-9065
Fax: 63-2-634-9069
Italy - Milan
Tel: 39-0331-742611
Fax: 39-0331-466781
Netherlands - Drunen
Tel: 31-416-690399
Fax: 31-416-690340
Spain - Madrid
Tel: 34-91-708-08-90
Fax: 34-91-708-08-91
UK - Wokingham
Tel: 44-118-921-5869
Fax: 44-118-921-5820
Singapore
Tel: 65-6334-8870
Fax: 65-6334-8850
Taiwan - Hsin Chu
Tel: 886-3-572-9526
Fax: 886-3-572-6459
Taiwan - Kaohsiung
Tel: 886-7-536-4818
Fax: 886-7-536-4803
Taiwan - Taipei
Tel: 886-2-2500-6610
Fax: 886-2-2508-0102
Thailand - Bangkok
Tel: 66-2-694-1351
Fax: 66-2-694-1350
Toronto
Mississauga, Ontario,
Canada
Tel: 905-673-0699
Fax: 905-673-6509
10/31/05
DS21986A-page 33
© 2006 Microchip Technology Inc.