Design of driving recorder system based on MC9S12XD

Publisher:Jinyu2022Latest update time:2016-05-31 Source: eefocusKeywords:MC9S12XD Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
  CAN bus is a serial multi-master controller area network bus. Its main principle is to connect all relevant controllers on the vehicle to realize the communication between the engine controller, gearbox controller, ABS controller, body controller, instrument and other controllers. In addition to making the vehicle wiring harness less, more orderly and lighter, the greater benefit of the CAN-bus system is that the whole vehicle information can be shared instantly. The developed driving recorder is used to collect the vehicle CAN bus data information in real time during the vehicle driving process, and store the data in a USB flash drive, which is transmitted to the PC with the USB flash drive as the carrier. The data can be analyzed by the software on the PC. It overcomes the previous mode that the on-site data acquisition system must have a computer. It can understand the changes of various data information during the operation of the vehicle in real time, and record the driving conditions synchronously. After the vehicle is tested or driven for a long time, the recorded data is used to analyze the vehicle driving performance and the operation of each component, which facilitates the calibration and design work.

  System overall structure design

  Due to the good characteristics of the CAN serial communication bus, it is widely used in the fields of field data acquisition systems, automobile manufacturing and aviation industries. The CAN bus-based data recorder designed in this paper is used in the Chery Automobile A5 model to collect and store node data on the vehicle CAN network. A5 is the first domestically produced car with its own independent brand that uses the CAN bus system. Its CAN-bus is mainly used in the transmission department, and there are also a small number of applications in the body department, ITS department and information department. Real-time data collection for the A5, the first model to use CAN technology, can understand the changes in various data information during the operation of the car, which is of great significance to the research and development of the A5 and all subsequent models.

  When the CAN bus driving recorder is working, it should be connected to the car CAN bus to become a CAN node in order to collect CAN data information. As shown in Figure 1, the system not only collects CAN bus messages in the car, but also can collect analog signal quantities in real time as needed. The LCD screen is used to display the collected signal values ​​​​and has a power-off protection function. After power is restored, the original data can be restored. In addition to displaying the collected data to the user in real time on the LCD screen, it can also be stored in a USB flash drive through the USB interface chip CH375 for the experimenter to take back to the laboratory for analysis. If you want to realize the storage function, just press the storage switch.

  Interpretation of CAN bus driving recorder system circuit - circuit diagram reading every day (165)

  Figure 1 System overall structure

  According to the overall structure of the system, the hardware circuit mainly consists of the following modules: main controller module, LCD module, CAN driver module, power module, CH375 interface circuit module. The system CPU uses Freescale's MC9S12XD ($8.1770) series microcontroller. It is the core of the control and communication part, not only responsible for system initialization settings and message reception, but also for the relevant data judgment processing and display. The chip integrates almost all analog and digital peripherals and other functional components required for the microcontroller control system and data acquisition system. Its main features are as follows:

  (1) The MC9S12XD series has a unique XGATE coprocessor. The reception of CAN signals in this system is completed by the interrupt program, and the interrupt processing program is handed over to XGATE for processing, which will reduce the CPU load and improve the system's response speed. (2) It has 16 analog-to-digital conversion channels, which provides hardware support for collecting analog signals and can be programmed to select 10-bit accuracy. (3) It has 5 MSCAN modules and an internally integrated CAN controller. The configuration of the CAN module is essentially converted into the configuration of the corresponding registers of the microcontroller, which is convenient and flexible to use. (4) The support of background debugging mode BDM makes chip debugging extremely convenient and speeds up the product development cycle. (5) The rich interrupt sources provide sufficient guarantee for the system to run without the support of the operating system.

  Power Module

  The power supply of the recorder is taken from the 12V vehicle-mounted battery power supply. In addition to supplying the system, this power supply is also responsible for the power supply of ignition, lighting, signal and other equipment. The power supply fluctuates greatly and the interference is serious. Since the car may encounter a relatively bad road condition during driving, the recorder power interface may become loose or have poor contact due to severe vibration. Therefore, the power module must be carefully designed to meet the needs. The schematic diagram of the power module circuit is shown in Figure 2, where U1 is a 6V backup power supply provided by the battery, and U2 (main power supply) is a vehicle-mounted 12V power supply. The power module is divided into 2 paths. The +5v voltage after 7805 voltage stabilization is used to power the LCD separately, and the VCC converted by 4275 is used to power the entire microcontroller and auxiliary circuits. When the system is working normally, D1 is in the cut-off state and the backup battery does not work. Once the main power supply is lost, D1 is quickly turned on and the backup power supply automatically starts to power the system.

  Interpretation of CAN bus driving recorder system circuit - circuit diagram reading every day (165)

  Figure 2 Power module

  There are two reasons for this design of the power module, as follows:

  (1) Use of backup battery. The recorder stores the collected data, that is, the collected data is written sequentially into the clusters allocated for the record file. When the collection is completed, the experimenter disconnects the storage switch or the collection is forced to terminate due to power failure. The microcontroller needs to close the record file, which is an important process. Closing the file means writing the actual length of the file and the total number of collected data records into the file header. If the file is not closed correctly, or if there is no time to close the file due to power failure, Windows will not be able to find the end of the file, and the PC software will not be able to open the file because it cannot find the end of the collected data. At this time, the collection work will fail. In order to prevent the inability to close the file due to power failure, this system uses a backup battery.

  (2) The MCU and LCD are powered separately. When the main power supply is working normally, the power of the entire system is supplied by the main power supply. Once the main power supply is powered off, the backup battery only powers the MCU to complete the file closing process, and the LCD does not work due to power failure. Since the power consumption of the LCD is large and the backup battery has limited power, this two-way power supply method can not only provide the power supply required for closing files, but also save battery power. Of course, the backup battery cannot be used for a long time and can only be used for emergency file closing processing of the system. For this purpose, a power detection signal is designed. Once the main power failure is detected, the buzzer and light-emitting diode are enabled to remind the user that the power supply is abnormal and the staff needs to check the power connector of the recorder.

  CI-I375 interface circuit module

  The USB interface chip used in this system is CH375 from Nanjing Qinheng Electronics Co., Ltd. This chip supports host mode and device mode. It has an 8-bit data bus and read, write, chip select control lines and interrupt output, which can be easily connected to the system bus of the microcontroller. It also has built-in firmware for processing the dedicated communication protocol of Mass-Storage mass storage devices. The external microcontroller can directly read and write the USB disk in sectors as the basic unit. The read select signal RD#, write select signal WR#, and chip select signal CS# are all input signals and are valid at low levels. CS# is the interrupt request output signal, which is also valid at low levels. The A0 signal is used to distinguish between commands and data. When A0=1, commands can be written, and when A0=0, data can be read and written. The 8-bit bidirectional data bus is connected to the PA port (PA0-PA7) of the microcontroller for parallel transmission. Its hardware supports the automatic detection of USB device connection function. When it is normally connected in host mode, its ACT# pin outputs a low level. Therefore, an external pull-up resistor is connected to the ACT# pin and a light-emitting diode is connected in series to indicate whether the USB device is normally connected.

  When laying out the PCB, try to place the 7805 chip at the edge of the board where the heat dissipation is better, and away from the LCD screen. Because in the actual process, after testing, the 7805 chip generates a lot of heat. If it is used for a long time and close to the LCD screen, it will affect the display effect of the LCD. In addition, try to make the LED of the power module close to the power interface, and the LED of the USB module close to the USB module, and distinguish them by color for easy observation by users. The driving recorder developed by this system has been successfully used in various road tests such as 30,000 kilometers and 50,000 kilometers of A5 cars, accurately recording important data during driving, and providing important data basis for researchers to conduct performance analysis, fault analysis, and calibration work. Using a CAN-based driving recorder on a vehicle that already has a CAN bus can greatly reduce the complexity of the system and reduce costs. For different models, only a few software modifications are required without changing the hardware, making the recorder extremely flexible and portable, and thus widely used in various models.

Keywords:MC9S12XD Reference address:Design of driving recorder system based on MC9S12XD

Previous article:Design of electric vehicle power management communication system based on single chip microcomputer
Next article:Design of Brushless DC Motor in Automobile System

Latest Microcontroller Articles
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号