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.
Previous article:Design of Car Anti-theft System Based on GSM/GPS
Next article:Photonics technology will be widely used in automotive applications
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- openocd command line programming ARM bare metal program problems and solutions
- How is your circuit preparation going?
- How to use wireless firmware upgrades for MSP 430 microcontrollers
- MicroPython adds support for STM32L432KC
- Several countermeasures to suppress electromagnetic interference of power modules
- Theory and Application of DAC12 Module of MSP430 Microcontroller
- CC1310 switching rate method
- EEWORLD University - Inverter Principle
- Bluetooth and MSP430 Audio Sink Reference Design
- Apprentice