PI657 Based ode Hopping Security System Author: OVERVIEW This document describes a PI657 based code hopping automotive security system. The security system implements all the basic features found on security systems and can be changed to modify or add features as required. The code can also be moved to a higher functionality PI microcontroller for more I/O or code space. FEATURES Kobus Marneweck Microchip Technology Inc. PIUT T0KI VDD N VSS N DIO LK S RFIN IMMO SIREN PLIGHT N LOK U 4 5 6 7 8 9 0 4 PI657 8 7 6 5 4 0 9 8 7 6 5 MLR OS OS N4 N N OVR LEARN DOOR TRIG IGN TRUNK UNLOK ode hopping alarm system System can handle up to six transmitters ing of new transmitters Arm/Disarm Trunk release ar finder Panic Locking/unlocking of doors Door and shock sensor trigger inputs REOMMENDED READING If the reader is unfamiliar with KEELOQ ode Hopping it would be helpful to read Introduction to KEELOQ (DS900). This and other KEELOQ literature can be found on Microchip s Web site or from a Microchip field application engineer. The software described in this application note is available on a diskette from Microchip by ordering DS4049. A complete list of KEELOQ literature can be found at the end of the application note. BLOK DIAGRAM Power Supply Switch Inputs Ignition Doors Trigger RF Receiver PI657 Outputs Parking Lights Lock Unlock Trunk Immob Siren 0 Microchip Technology Inc. DS00645-page
MEMORY MAP EEPROM (6 BIT WORDS) Address Address 00h USER0 0h NT0 0h LRN_PTR h NT 0h BSTATUS h SER0 0h SSTATUS h SER 04h TMPNT 4h KEY0 05h USER 5h KEY 06h USER 6h KEY 07h USER 7h KEY 08h USER4 8h NT0 09h USER5 9h NT 0Ah DIS0 Ah SER0 0Bh DIS Bh SER 0h DIS h KEY0 0Dh DIS Dh KEY 0Eh DIS4 Eh KEY 0Fh DIS5 Fh KEY 0h NT00 0h NT40 h NT0 h NT4 h SER00 h SER40 h SER0 h SER4 4h KEY00 4h KEY40 5h KEY0 5h KEY4 6h KEY0 6h KEY4 7h KEY0 7h KEY4 8h NT0 8h NT50 9h NT 9h NT5 Ah SER0 Ah SER50 Bh SER Bh SER5 h KEY0 h KEY50 Dh KEY Dh KEY5 Eh KEY Eh KEY5 Fh KEY Fh KEY5 LRN_PTR SSTATUS BSTATUS TMPNT indicator points to the next available learn position. Stores the system status. Backup copy of system status. Stores the temporary counter for resynchronization. DS00645-page 0 Microchip Technology Inc.
FIGURE : ALARM STATE DIAGRAM State == State ==Immob Reset State == Remote State == 0s Time-out Trigger Remote request Remote Remote Immob 0s & IGN off IGN on request request complete or 0s time-out return to previous 0 Microchip Technology Inc. DS00645-page
OPERATION Reset Reset initializes the I/O ports, variables, and flags. The system status is read from EEPROM and the status is restored. When the system enters armed state, the doors are locked (activate LOK) and the SIREN and PLIGHT are activated for 50 ms. The changes to a slow flash rate. If a trigger is detected (IGN, DOOR or TRIG- GER) the system changes to the alarm state. Actions upon entry:. Flash parking lights for 50 ms.. hirp siren for 50 ms.. Lock doors for 500 ms. 4. Update system status. 5. flash. 6. Disable start. TABLE : STATE HANGE TABLE ondition IGN high TRIG high DOOR high Panic (any button activated for seconds) Remote function Remote function (trunk release) Remote function (car finder) LEARN high Next State state is entered whenever a trigger is detected in armed state. SIREN is activated and PLIGHT is turned on and off at a Hz rate. If a remote is detected in this state, the system changes to drive state. After a 0-second delay, SIREN and PLIGHT will be deactivated and the system returned to armed state. Actions upon entry:. Flash parking lights.. Siren on.. flash. 4. Update system status. 5. Disable start. TABLE : STATE HANGE TABLE ondition Panic (any button activated for seconds) Remote function Remote function (trunk release) 0-second timeout Next state When the system enters drive state, the doors are unlocked (activate UNLOK), and the SIREN and PLIGHT are activated twice for 50 ms.the IMMOB output is activated to enable the starting of the vehicle and is turned off. A remote signal will return the system to armed state. Actions upon entry:. Flash parking lights for 50 ms.. hirp siren for 50 ms.. Unlock doors for 500 ms. 4. Flash parking lights for 50 ms. 5. hirp siren for 50 ms. 6. Update system status. 7. off. 8. Enable start. TABLE : STATE HANGE TABLE ondition Panic (any button activated for seconds) Remote function & IGN low Remote function & IGN high Remote function (trunk release) Remote function (car finder) 0-second timeout & IGN off LEARN high Next State Immob Immob If the IGN is turned off for more than 0 seconds, the system will immobilize. The IMMOB output is turned off, and the is turned on. A remote signal only will change the state to armed, and a remote signal with the IGN on will return to drive state. Actions upon entry:. Update system status.. off.. Disable start. TABLE 4: STATE HANGE TABLE ondition Panic (any button activated for seconds) Remote function & IGN low Remote function & IGN high Remote function (trunk release) Remote function (car finder) LEARN high Next State Immob Immob DS00645-page 4 0 Microchip Technology Inc.
A LEARN input in any state will put the system in learn mode. After learn is completed or timed out the system returns to the previous state. Actions upon entry:. Update system status set PASS.. on. After first transmission:. Update system status set PASS.. off. After second transmission:. Update system status set RMAL.. on for second.. Return to previous state. TABLE 5: ondition Remote first operation Remote second operation LEARN high for 8 seconds STATE HANGE TABLE Next State Pass Return to previous state Erase all transmitters FUNTIONAL MODULES Reception The reception routine is based on reliable algorithms used in previous implementations of KEELOQ decoders. Automatic baud rate detection is used to compensate for variations in baud rate from different encoders of a specific type as well as the difference in baud rate between different encoders (HS00, HS00, HS0, HS60, HS6, and HS40). The reception routine will be able to handle 56- and 66-bit transmissions. The reception routine will determine the type of transmission by the number of bits in the transmission. This routine will be the same for all implementations. Key Generation and Decryption Decryption is done in software in the implementation. The decryption and key generation algorithms is implemented in software. The manufacturer s code is stored in program memory and code protected to securely store the key. Validation Validation consists of the following steps:. hecking the serial number (4 or 8 bits) against the stored transmitters.. omparing the discrimination value ( bits) against the stored discrimination value.. hecking that the synchronization counter falls within the first synchronization window. 4. hecking if the synchronization counter falls within the second synchronization window. 5. If found to be correct, updating the synchronization counter. Function Interpretation Transmitter Button Function ode System Function 000 Arm/Disarm 000 Trunk release 00 ar finder, or for seconds 00XX Panic The LEARN input is active high. ing is initiated by momentarily pressing the LEARN button. The decoder uses the current learning position as a scratch pad area. This means that an unsuccessful learn will delete the information stored at that learn position. The learn indicator will not be incremented if the learn was unsuccessful. The flow chart (Figure ) shows the learning operation. 0 Microchip Technology Inc. DS00645-page 5
FIGURE : LEARN OPERATION LEARN MODE Press Button on solid Button still pressed? First code received? Time greater than.6 sec.? off Time greater than 8.4 sec.? Second code received? Erase memory Time greater than.6 sec.? ode Validated? new transmitter on solid for second on solid for 0. second Exit Turn off END DS00645-page 6 0 Microchip Technology Inc.
The following checks will be performed on the received codes to determine if the transmitter is valid:. The first code that is received is checked for bit integrity.. The stored serial numbers are searched to check if a transmitter is relearned. If a relearn is taking place, that position is used. Otherwise, the position pointed to by the learn indicator will be used.. The serial number is stored in the current learn position and used to generate a key. 4. The hop code is decrypted and the result stored temporarily. 5. The serial number of the second code that is received will be compared to the first received serial number. 6. The second hop code is decrypted and the discrimination values compared. 7. The synchronization counters of the decrypted codes will be compared to check that they are sequential codes. 8. If all the checks pass the learn were successful, the learn indicator is incremented. Otherwise, the position is erased. Operation. Press and release the LEARN button. Indicator will turn on to indicate learn mode.. Press transmitter button. The will turn off.. Press transmitter a second time. The will turn on for second to indicate that the transmitter was learned successfully. 4. Repeat steps - to learn up to six transmitters. The seventh transmitter will overwrite the first transmitter that was learned. 5. will be terminated if two nonsequential codes were received or if two acceptable codes were not decoded within.6 seconds. A valid learn will be indicated by the turning on solid for second. 6. Erasing all the transmitters is accomplished by pressing and holding the LEARN button for 8.4 seconds. The will turn off at the end of the 8.4 seconds to indicate that the transmitters were erased. The learn indicator will be reset to the first position. 0 Microchip Technology Inc. DS00645-page 7
TABLE 6: DEVIE PIUT PIN PI657 Function Function PIN PI657 Function Function RT APP select 8 MLR RESET VDD +5V supply 7 Osc In R osc (4 MHz) N 6 Osc Out 4 GND Ground 5 Port Bit 7 N 5 N 4 Port Bit 6 N 6 Port A Bit 0 EEPROM DIO(+4) Port Bit 5 N 7 Port A Bit EEPROM LK () Port Bit 4 OVR 8 Port A Bit EEPROM S () Port Bit LEARN 9 Port A Bit RFIN 0 Port Bit DOOR 0 Port B Bit 0 IMMOB 9 Port Bit TRIG Port B Bit SIREN 8 Port Bit 0 IGN Port B Bit PLIGHT 7 Port B Bit 7 Port B Bit N 6 Port B Bit 6 TRUNK 4 Port B Bit 4 LOK 5 Port B Bit 5 UNLOK TABLE 7: TIMING PARAMETERS Parameter Typical Unit flash rate per second Siren time-out second time-out second time-out second All erase 8 second LOK, UNLOK, TRUNK activation 500 ms Siren chirp (arm & disarm) 50 ms Parking light (arm & disarm) 50 ms Parking light flash rate (siren) per second Panic seconds DS00645-page 8 0 Microchip Technology Inc.
FIGURE : IRUIT DIAGRAM J ON D5 n4004/7 00 µf Receiver RX RR V G ND A NT G ND 7 V 0 G ND V T ES T O UT V 4 5 Telecontrolli RR - 4 U LM7805 VI G ND VO V 5 6 7 8 6 V 00 µf U VSS DO 4 TEST TEST V 9L46B DI LK S RA k LS D Buzzer 4 00 nf k 5 RB k D 4 5 6 7 8 9 0 4 4 U T0ckI VDD N VSS N DIO MLR 8 OS 7 OS 6 N4 5 N 4 N LK S OVR LEARN RFIN DOOR 0 IMMO TRIG 9 SIREN IGN 8 PLIGHT 7 N TRUNK 6 LOK UNLOK 5 R k KLQ_SE D V U V OUT GND Power Supply Supervision 4 RD k 5 RE k D4 D5 6 RF k D6 R 0k 0 pf S SW PB S SW PB 9 8 7 6 5 4 RP RP9P8R 0K S SW PB V S SW PB 0 Microchip Technology Inc. DS00645-page 9
ADDITIONAL INFORMATION Microchip s Secure Data Products are covered by some or all of the following: ode hopping encoder patents issued in European countries and U.S.A. Secure learning patents issued in European countries, U.S.A. and R.S.A. REVISION HISTORY Revision (May 0) Added new section Additional Information Minor formatting and text changes were incorporated throughout the document DS00645-page 0 0 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. ode protection does not mean that we are guaranteeing the product as unbreakable. ode 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 opyright 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. MIROHIP MAKES REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INLUDING BUT T LIMITED TO ITS ONDITION, QUALITY, PERFORMANE, MERHANTABILITY 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, dspi, KEELOQ, KEELOQ logo, MPLAB, PI, PImicro, PISTART, PI logo, rfpi and UNI/O are registered trademarks of Microchip Technology Incorporated in the U.S.A. and other countries. FilterLab, Hampshire, HI-TEH, Linear Active Thermistor, MXDEV, MXLAB, SEEVAL and The Embedded ontrol Solutions ompany are registered trademarks of Microchip Technology Incorporated in the U.S.A. Analog-for-the-Digital Age, Application Maestro, odeguard, dspidem, dspidem.net, dspiworks, dsspeak, EAN, EOMONITOR, FanSense, HI-TIDE, In-ircuit Serial Programming, ISP, Mindi, MiWi, MPASM, MPLAB ertified logo, MPLIB, MPLINK, mtouch, Omniscient ode Generation, PI, PI-8, PIDEM, PIDEM.net, PIkit, PItail, REAL IE, rflab, Select Mode, Total Endurance, TSHAR, UniWinr, 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. 0, Microchip Technology Incorporated, Printed in the U.S.A., All Rights Reserved. Printed on recycled paper. ISBN: 978--64-6-9 Microchip received ISO/TS-6949:00 certification for its worldwide headquarters, design and wafer fabrication facilities in handler and Tempe, Arizona; Gresham, Oregon and design centers in alifornia and India. The ompany s quality system processes and procedures are for its PI MUs and dspi DSs, 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 900:000 certified. 0 Microchip Technology Inc. DS00645-page
Worldwide Sales and Service AMERIAS orporate Office 55 West handler Blvd. handler, AZ 854-699 Tel: 480-79-700 Fax: 480-79-777 Technical Support: http://www.microchip.com/ support Web Address: www.microchip.com Atlanta Duluth, GA Tel: 678-957-964 Fax: 678-957-455 Boston Westborough, MA Tel: 774-760-0087 Fax: 774-760-0088 hicago Itasca, IL Tel: 60-85-007 Fax: 60-85-0075 leveland Independence, OH Tel: 6-447-0464 Fax: 6-447-064 Dallas Addison, TX Tel: 97-88-74 Fax: 97-88-94 Detroit Farmington Hills, MI Tel: 48-58-50 Fax: 48-58-60 Indianapolis Noblesville, IN Tel: 7-77-8 Fax: 7-77-545 Los Angeles Mission Viejo, A Tel: 949-46-95 Fax: 949-46-9608 Santa lara Santa lara, A Tel: 408-96-6444 Fax: 408-96-6445 Toronto Mississauga, Ontario, anada Tel: 905-67-0699 Fax: 905-67-6509 ASIA/PAIFI Asia Pacific Office Suites 707-4, 7th Floor Tower 6, The Gateway Harbour ity, Kowloon Hong Kong Tel: 85-40-00 Fax: 85-40-4 Australia - Sydney Tel: 6--9868-67 Fax: 6--9868-6755 hina - Beijing Tel: 86-0-8569-7000 Fax: 86-0-858-04 hina - hengdu Tel: 86-8-8665-55 Fax: 86-8-8665-7889 hina - hongqing Tel: 86--8980-9588 Fax: 86--8980-9500 hina - Hangzhou Tel: 86-57-89-80 Fax: 86-57-89-89 hina - Hong Kong SAR Tel: 85-40-00 Fax: 85-40-4 hina - Nanjing Tel: 86-5-847-460 Fax: 86-5-847-470 hina - Qingdao Tel: 86-5-850-755 Fax: 86-5-850-705 hina - Shanghai Tel: 86--5407-55 Fax: 86--5407-5066 hina - Shenyang Tel: 86-4-4-89 Fax: 86-4-4-9 hina - Shenzhen Tel: 86-755-80-660 Fax: 86-755-80-760 hina - Wuhan Tel: 86-7-5980-500 Fax: 86-7-5980-58 hina - Xian Tel: 86-9-88-75 Fax: 86-9-88-756 hina - Xiamen Tel: 86-59-888 Fax: 86-59-880 ASIA/PAIFI India - Bangalore Tel: 9-80-090-4444 Fax: 9-80-090-4 India - New Delhi Tel: 9--460-86 Fax: 9--460-86 India - Pune Tel: 9-0-566-5 Fax: 9-0-566-5 Japan - Yokohama Tel: 8-45-47-666 Fax: 8-45-47-6 Korea - Daegu Tel: 8-5-744-40 Fax: 8-5-744-40 Korea - Seoul Tel: 8--554-700 Fax: 8--558-59 or 8--558-594 Malaysia - Kuala Lumpur Tel: 60--60-9857 Fax: 60--60-9859 Malaysia - Penang Tel: 60-4-7-8870 Fax: 60-4-7-4068 Philippines - Manila Tel: 6--64-9065 Fax: 6--64-9069 Singapore Tel: 65-64-8870 Fax: 65-64-8850 Taiwan - Hsin hu Tel: 886--6578-00 Fax: 886--6578-70 Taiwan - Kaohsiung Tel: 886-7--780 Fax: 886-7-0-905 Taiwan - Taipei Tel: 886--500-660 Fax: 886--508-00 Thailand - Bangkok Tel: 66--694-5 Fax: 66--694-50 EUROPE Austria - Wels Tel: 4-74-44-9 Fax: 4-74-44-9 Denmark - openhagen Tel: 45-4450-88 Fax: 45-4485-89 France - Paris Tel: --69-5-6-0 Fax: --69-0-90-79 Germany - Munich Tel: 49-89-67-44-0 Fax: 49-89-67-44-44 Italy - Milan Tel: 9-0-746 Fax: 9-0-46678 Netherlands - Drunen Tel: -46-69099 Fax: -46-69040 Spain - Madrid Tel: 4-9-708-08-90 Fax: 4-9-708-08-9 UK - Wokingham Tel: 44-8-9-5869 Fax: 44-8-9-580 hina - Zhuhai Tel: 86-756-0040 Fax: 86-756-0049 05/0/ DS00645-page 0 Microchip Technology Inc.