With the development of high-performance electronic display technology, the degree of electronicization of automobile instruments is getting higher and higher. High-tech products such as multifunctional all-electronic display instruments, head-up display instruments, car navigation systems, and driving recorders have been developed at home and abroad. In the future, electronic embedded instruments for automobiles will have the following advantages: providing a large amount of complex information, making the degree of electronic control of automobiles higher and higher; meeting the requirements of small and lightweight, making limited driving space more humane; realizing the electronicization of automobile instruments with high precision and high reliability, reducing the occurrence rate of failures; equipped with an online fault diagnosis system, once a car fails, the source of the fault can be found, which is convenient for maintenance; the appearance design has a high degree of freedom, and the automobile dashboard is beautiful. Based on the above advantages, more and more automobiles will adopt electronic instruments for various purposes. Embedded electronic instruments with novel shapes and powerful functions will be the development trend and trend of automotive instruments in the future.
1 Intelligent vehicle instrument system structure
The intelligent vehicle instrument has the functions of most traditional vehicle instruments. The driver can obtain the current vehicle status information, such as vehicle speed, oil pressure, oil temperature, water temperature, engine oil pressure or battery power, through the display interface of the vehicle instrument.
Traditional vehicle instruments are directly connected to the vehicle's sensors. The instrument system obtains the current state of the vehicle through the analog quantity of the sensor, which is not very accurate. The intelligent vehicle instrument designed in this paper is not simply connected to the sensor, but connects the entire vehicle into a network structure through the CAN controller. The vehicle components are equipped with CAN controllers, and the vehicle components are connected through twisted pair cables to form a network system to realize the electrification of the components. At the same time, the electrification of vehicle instruments and automotive components also improves the accuracy and reliability of the vehicle and reduces the occurrence of failures.
The vehicle-mounted intelligent instrument is mainly divided into two parts: the hardware system based on the S3C2440 processor and the software system under the WinCE environment. The hardware system provides the basis for the entire control system and is responsible for CAN bus communication. The software system provides the hardware driver of the CAN bus and the instrument upper application under WinCE.
2 Hardware Design
The hardware system is based on S3C2440, with RAM memory, NOR Flash and NAND Flash as storage media, and some peripheral devices are extended to be responsible for the input and output of system information, such as CAN bus communication unit, LCD display, touch screen, universal serial port, USB device, Ethernet interface, etc. The system hardware structure is shown in Figure 1.
Figure 1 System hardware structure diagram
Among many interfaces, the CAN bus communication unit is a key part in the whole vehicle communication process. In each important part of the car, a corresponding CAN control unit is configured, and each CAN bus control unit is connected by a twisted pair. Each component of the car sends the current status information of the component through the CAN control unit, which is sent to the CAN unit of the intelligent vehicle instrument through the twisted pair, and the data is sent to the system through the CAN interface of the system. After the vehicle instrument system obtains the data, it processes the data to obtain the current status information of the vehicle components.
The CAN bus interface circuit is shown in Figure 2. Microchip's CAN bus controller MCP2515 is used. MCP2515 fully supports CAN 2.0A/B technical specifications and has a speed of 1 Mbps. The SPI interface standard makes it easier to connect with S3C2440. It can send and receive standard and extended data frames and remote frames. It has 2 acceptance mask registers and 6 acceptance filter registers to filter out unwanted messages, reducing the microprocessor's overhead. The CAN bus transceiver uses TJA1050, which provides the interface between the CAN controller and the physical bus and the differential sending and receiving functions of the CAN bus.
Figure 2 CAN bus interface circuit
In order to enhance the anti-interference ability of the CAN bus node and improve the stability of the system, an optocoupler isolator 6N137 is added between the CAN controller and the CAN transceiver, instead of connecting the TXCAN and RXCAN terminals directly to the transceiver, so that the electrical isolation between the CAN nodes on the bus is achieved. At the same time, this also solves the problem of level compatibility between MCP2515 and TJA1050, and can also suppress spike pulses and noise interference in the CAN network. The two power supplies used in the optocoupler part of the circuit must be completely isolated, otherwise it will lose its meaning. The isolation of the power supply can be achieved by using a low-power power isolation module or a switching power supply module with multiple 5 V isolated outputs. Although these parts increase the complexity of the interface circuit, they improve the stability and safety of the node.
At the CAN interface, the two 60 Ω resistors (total 120 Ω) on the CAN communication line play a role in increasing the load and reducing echo reflection, which is a remedial measure for impedance matching. A capacitor is connected between the middle part of the two 60 Ω and the ground terminal to resist interference. [page]
3 Software Design
The overall environment of the software is WinCE programming environment. The corresponding WinCE operating system is customized for the vehicle-mounted intelligent instrument hardware system to realize the hardware driver. Then the application program is written to realize the operation of the system hardware through the specific operation of the application program, that is, to realize the function of the system. Among them, the key is to write the driver of the CAN controller. The CAN driver realizes the operation of the application software on the CAN control unit and reads the data code in the CAN control unit.
3.1 System development and migration
Embedded system development is the design of the system driver layer, the most important of which is the development and debugging of BSP. Therefore, the development of the underlying driver of the intelligent vehicle instrument is particularly important.
Since the WinCE operating system is used, the WinCE operating system image is customized using Platform Builder. In Platform Builder, you can add drivers for some system hardware (such as LCD screen, RAM), which have been written by Microsoft. Then start the Bootloader, download the image file to the Flash memory, and configure the operating system startup file boot.ini.
3.2 CAN bus driver development
Since CAN is an external device, the CAN driver needs to be written as a stream interface driver. The stream interface driver function is designed to closely match the usual file system API (such as ActivateDevice, ReadFile, WriteFile, and IOControl, etc.), that is, the stream interface driver appears as a system file in the application, and the application completes the operation of the device by operating the special files of the system file. The writing of stream interface files mainly uses stream interface functions, which are the entry points of the stream interface driver, such as XXX_Init, XXX_Read, and XXX_Open. These stream interface files correspond to the corresponding API functions, so that the application can access the external device through the corresponding functions.
As a stream interface driver, the CAN bus driver also has a set of standard functions to complete I/O operations. These functions are provided to the WinCE operating system kernel, and they are all DLL files of the stream interface driver. When dynamically loading the CAN bus driver, the system must register it. CAN driver registry information:
WCHAR *szRegKey=L"DriversBuiltInCAN";
WCHAR * szPrefix=L"CAN";
WCHAR * szDLL=L"can.dll";
WCHAR *szFriendlyName=L"CANDriver";
DWORD * DrvIndex=1;
DWORD * DrvOrder=0;
After completing the registration through the above code, call the ActivateDeviceEx() function to load the driver.
3.3 CAN bus driver communication process
The CAN bus controller driver is mainly used to set the baud rate of MCP2515, the acceptance filter of MCP2515, the CAN message transmission mode and the CAN data transmission and reception mode. The driver is an intermediate link between the upper application and the hardware. The intelligent vehicle instrument system is developed in the EVC++ environment.
The stream driver opens the function CreateFile() as a file: After the driver is successfully opened, the CreateFile() function returns a handle that is not INVALID-HANDLE-VALUE, which is also the parameter of the driver closing function CloseHandle(). The CAN setting function DeviceIoControl() receives the handle and control command code obtained by the CreateFile() function, sets the input/output buffer and the size of the buffer. After the function is executed, it returns the actual output buffer size, etc. The CAN bus sending and receiving functions WriteFile() and ReadFile() use the driver file handle, send and receive buffer and other parameters to complete the sending and receiving of data. After the operation is successful, the actual number of bytes sent and received is returned.
In order to prevent the main thread from being in a state of waiting for data to arrive and to allow the main thread to have a time token to operate other things, the program adopts a multi-threaded design and creates a data receiving thread. The data receiving thread is an infinite loop that continuously queries the CAN bus data exit flag. If the exit flag is valid, the loop ends and exits. The driver process is shown in Figure 3.
Figure 3 CAN bus driver communication process
Conclusion
At present, vehicle-mounted instruments based on embedded technology are gradually becoming popular. This article uses the ARM9 microprocessor based on WinCE as the development platform, which has fast processing speed and powerful functions; uses CAN bus technology for mutual transmission of signals, and the CAN bus receives information sent by automobile components in real time, and processes and analyzes it; uses WinCE operating system, which has a friendly interface. This intelligent vehicle-mounted instrument system can save costs, reduce power consumption, and has strong maintainability and is easy to expand and upgrade.
Previous article:Design of Embedded Audio System Based on S3C2410 and UDAl341
Next article:Design and implementation of communication interface between S3C44B0X and multi-channel simulator control board based on ARM 7
Recommended ReadingLatest update time:2024-11-16 21:27
- Popular Resources
- Popular amplifiers
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
- A batch of STM32F103RBT6 10 packages in stock
- PYPL October 2022 Rankings
- Looking for a voltage detection circuit or chip, 3v to 12v
- Weekly review information broadcast ~ Watch it all at once!
- Creative poker clock based on ESP32
- "Wanli" Raspberry Pi car launched
- You must call ros::init() before creating the first NodeHandle
- CSL library for GPIO of C6000 series DSP
- Some comments for the forum
- GD32E103 eval can be compiled with IAR