Design and implementation of vehicle anti-theft alarm based on LIN node

Publisher:科技飞翔Latest update time:2014-03-14 Source: ofweek Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

  With the rapid development of the automobile industry, there are more and more electronic control units on the car body. The traditional car body wiring harness will not only increase the manufacturing cost, but also reduce the reliability and maintainability of the system. Therefore, the car body bus came into being. The use of body bus design can not only simplify the line, save manufacturing costs, and improve reliability, but also save the maintenance cost of the system. The vehicle anti-theft alarm module is part of the body control unit (BCM). Since it does not have high requirements for the real-time and rate of bus communication, it is connected to the low-speed bus LIN.

  LIN bus

  The LIN bus is mainly used for low-speed systems that do not require the performance, speed and complexity of CAN. It is a low-cost serial communication network that uses a master node and several slave nodes. It is based on the universal UART/SCI hardware interface and has a maximum speed of 20kb/s.

  The LIN bus transmits data through message frames. A complete message frame includes a frame header and an information response. The message header includes an interval field, a synchronization field, and a flag field. The interval field consists of a continuous dominant level (0) of at least 13 bits, marking the beginning of a message frame during a data communication process. The synchronization field contains clock synchronization information, and its format is 0x55. After correctly receiving the synchronization byte field, all slave nodes accurately calculate the baud rate of the data to be sent by the host node, and use this baud rate as the baud rate setting value for the next step of sending or receiving data, thereby achieving synchronization between the slave node and the host node clock. The flag field defines the content and length of the information. The message response is sent by the host node or the slave node according to the information in the flag field, and consists of 2, 4 or 8 bytes of data and a 1-byte checksum. The checksum is obtained by calculating all bytes of the data and is used by the receiver to verify the correctness of the data.

  

  Figure 1 Complete LIN information frame

  Functional Description

  The vehicle-mounted anti-theft alarm module is a slave node of the body control module. Its main functions are as follows: first, it maintains communication with the BCM and reports the status information of the anti-theft alarm module; second, it receives commands from the body control module and drives the horn to sound an alarm; third, it monitors whether the power line, ground line and LIN line connecting the anti-theft alarm module and the BCM are cut off and sounds an alarm.

  Implementation

  1 Device Selection

  The two main components of this system are LIN transceiver and microprocessor. Since the anti-theft alarm module is a battery-powered LIN node, low-power devices should be considered as much as possible when selecting devices. The LIN transceiver is selected as TJA1020, which is the physical media connection between the body controller and the anti-theft alarm module, and also the interface between the LIN master/slave protocol controller and the LIN transmission medium. The transmit data stream of the protocol controller input pin TXD is converted into a bus signal by the LIN transceiver, and the level flip rate and waveform are limited to reduce electromagnetic radiation. The receiver of TJA1020 detects the data stream on the LIN bus and transmits it to the protocol controller through the RXD pin. TJA1020 has a low-power management mode, which consumes almost no current in sleep mode and reduces power consumption in error mode. Therefore, TJA1020 is very suitable for battery-powered LIN nodes such as anti-theft alarm modules. The system uses STMicroelectronics' 8-bit microprocessor STM8S105K4 as the main control microcontroller . When driven by the internal 128kHz clock, the static power consumption can be as low as 0.6mA. It meets the system's low power consumption requirements while having LIN controller and battery power detection 10-bit ADC functions.

  2 Information frame classification and system status definition

  The communication information frame between the body control system and the anti-theft alarm module is defined as follows:

  

  The wake-up command is used to wake the system from the sleep state to the unarmed state, and the sleep command is used to instruct the system to enter the sleep state. The content of the command information frame includes the arming, disarming, and alarm commands, as well as the definition of the alarm state attributes such as the alarm cycle and number of times. The state transition of the system is shown in Figure 2.

  

  Figure 2 State transition diagram

3 Basic Block Diagram

  The basic block diagram of the system is shown in Figure 3. The system has three interfaces with the outside world: LIN line, power line and ground line. The on-board battery supplies power to the rechargeable battery, TJA1020 and MCU respectively. The rechargeable battery is used to provide the system with the power required for alarm when the car battery power is cut off. [page]

  

  Figure 3 Basic system block diagram

  Initially, TJA1020 is in sleep mode and cuts off the power supply to MCU through INH pin. At this time, the system is defined as sleep mode. Connecting the car battery is equivalent to the level change of NWAKE pin of TJA1020, which triggers the external interrupt wake-up of TJA1020. At the same time, Tx pin of TJA1020 will generate a strong pull-down. When a remote LIN information frame wakes up TJA1020, Tx pin will generate a weak pull-down. After TJA1020 is awakened, it will turn on the power supply to MCU through INH pin to make MCU start working, and the system will enter the unarmed state.

  In the unarmed state, the MCU detects whether there is a car battery power supply signal through the GPA port. If there is no power supply signal, the system will enter the sleep state of TJA1020 through the GPB pin connected to NSLP after a certain period of time. TJA1020 will turn off the power supply of MCU through the INH pin, and the system will return to the sleep state. When the car battery power is present, if the LIN sleep information frame is received, the system will also enter the sleep state.

  When the system is in a non-sleep state, it can switch between the unarmed state, armed state and alarm state by receiving the LIN command information frame from the BCM. When the system is in the armed state and the alarm state, it will not enter the sleep state.

  4 Software Process

  The system software mainly includes the program for realizing the communication between the single-chip microcomputer and the LIN bus and the main program for the single-chip microcomputer to control the anti-theft alarm horn. To ensure the real-time communication, the system uses high-priority interrupts to receive signals on the LIN bus. In order to ensure the real-time performance of the system, in addition to some simple judgments and data reception during interrupt processing, the rest is processed in the main program.

  

  Figure 4 Main program flow chart

  Once a valid dominant level appears on the bus, the controller immediately enters the high-priority interrupt processing function. First, it determines whether it is an interval field sent by the host node. If it is an interval field, it receives the synchronization field and the identifier field. If it is not a synchronization field, it exits and waits for the next interrupt. After receiving the correct identifier, if the identifier requires the system to send information, the system sends the data field and the checksum field. After the transmission is completed, it starts to wait for the next frame of data. If the identifier does not require the machine to send data, it receives the subsequent data field and checksum field. In the main program, it determines whether the received data is valid for the machine based on the identifier. If it is valid, it will be processed accordingly. If it is invalid, it will be discarded. After the processing is completed, it starts to wait for the next frame of data.

Reference address:Design and implementation of vehicle anti-theft alarm based on LIN node

Previous article:Design of Car Anti-theft System Based on GSM/GPS
Next article:Photonics technology will be widely used in automotive applications

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号