1 Introduction
The car instrument is the information exchange interface between the driver and the car, and plays an important role in the safety and economical driving of the car. In recent years, with the development of automotive electronic technology, the information displayed by the car instrument has been increasing, and the traditional mechanical pointer car combination instrument cannot meet the current usage needs. In particular, with the widespread use of computers, microelectronics and various fieldbus communication technologies, intelligent digital instruments with embedded microprocessors as the core will be the inevitable trend of the development of car instruments. This paper gives a design scheme for embedded automotive digital instruments.
2 Hardware Design
The signals that need to be processed by the automobile instrument mainly include: vehicle speed, engine speed, water temperature, oil level, and various switch signals or alarm signals. Among them, the engine speed signal and front and rear light signals are obtained from the CAN bus (engine electronic control module and front and rear light electronic control module), while the vehicle speed signal, water temperature, oil level and other switch signals are obtained from the corresponding sensors.
The structure of the automobile digital instrument system is shown in Figure 1. This system uses a stepper meter to display the vehicle speed, engine speed, water temperature and fuel level information, LCD to display the mileage information, LED to display the switch value or alarm signal, and the serial port EEPROM is used to store the mileage information. The controller MCP2510 with SPI interface and the transceiver 80C250 of Microchip Company are used to form a CAN node to realize the communication with other CAN nodes of the car.
2.1 MCU, external memory and mileage storage circuit
The system uses Samsung's ARM7TDMI device S3C44BOX as the main controller. S3C44BOX is a 16/32-bit RISC processor with a working frequency of up to 75 MHz and rich internal resources. Since S3C44BOX has no internal memory (internal SRAM is used for cache), it is necessary to use a bus to expand the external memory, including program memory and data memory. 16 Mbit: FlashSST39VF160 and 64 Mbit SDRAM HY57V641620 are used as program memory and data memory respectively. The system also uses an AT24C04 storage device to store mileage information. AT24C04 is a 4 Kbit serial memory that uses the I2C bus to store mileage information.
2.2 Power supply and reset circuit
The automotive digital instrument system is powered by a car battery, which has a voltage of about 12 V. The system requires 5 V, 2.5 V, and 3.3 V operating voltages. The operating voltage of the S3C44BOX core is 2.5 V, the operating voltage of the I/O port is 3.3 V, and the conditioning circuit and some driver devices require a 5 V operating voltage. Therefore, the system uses a 7805 regulator as a 5 V voltage converter, and AS2515AU2.5 and AS2515AU3.3 as 2.5 V and 3.3 V voltage converters, respectively. In order to store mileage information in time when power is off, a 1 000 μF capacitor is required to connect the power ground. When power is off, the large capacitor can ensure that the S3C44BOX works for a period of time to complete the storage of mileage information. The reset circuit uses a dedicated reset circuit IPM811 to achieve stable system startup. Figure 2 shows the system power supply circuit.
2.3 Processing circuits for vehicle speed, water temperature, oil level and switch quantity
Since most cars work in harsh environments, which will interfere with the speed sensor signal, the speed pulse signal needs to be processed before inputting to the interrupt port EINT0. Here, RC filtering, transistor amplification and Schmidt shaping methods are used to condition the speed pulse signal. The speed pulse conditioning circuit is shown in Figure 3.
The water temperature and oil level signals are resistance signals and must be converted into voltage signals, which are then input to the AD port of the S3C44BOX. Other switch quantities are filtered and stepped down before being input to the I/O port of the S3C44BOX. [page]
2.4 CAN bus communication circuit
S3C44BOX has no SPI interface, but has SIO interface. The sending and receiving of SIO module can latch data bit on rising edge or falling edge. Therefore, the register corresponding to SIO module of S3C44BOX can be set to send data on rising edge and receive data on falling edge, so as to match the SPI bus timing of MCP2510. The CAN bus communication circuit is shown in Figure 4.
Stepper motor meter circuit, etc. The stepper motor uses Switchec's automotive instrument dedicated stepper motor X15.168 and a dedicated four-channel stepper motor driver X12.017. The I/O level of S3C44BOX is 3.3V CMOS level, while X12.017 is 5V CMOS level, so 74LVX4245 level conversion is required.
3 Software Design
3.1 Operating System
μC/OS-II is a free, open source embedded real-time operating system developed by Jean J-Labrosse. μC/OS-II is a priority-based preemptive kernel. All tasks in the system have a unique priority level, which is suitable for occasions with strong real-time requirements. μC/OS-II provides a variety of system services, such as message mailboxes, message queues, semaphore management, and time delays. The real-time kernel makes the CPU more efficient.
3.2 Porting and Configuration of μC/OS-II on ARM
Except for those software modules that are closely related to hardware and need to be written in assembly language, most of the source code of μC/OS-II is written in C language, so μC/OS-II has strong portability. To port μC/OS-II on ARM, three source files are mainly written, namely OS_CPU.H, OS_CPU.C, and OS_CPU_A.S. The required basic configuration and definition (definition of data types, definition of enable and disable interrupt macros, etc.) are completed in OS_CPU.H; OS_CPU.C mainly ports six functions including OS-TaskStkInit(), OSTaskCreateHook(), OSTaskDelHook(), OSTaskSwHook(), OSTaskStatHook(), and OSTimeTickHo-ok(); OS_CPU_A.S mainly completes the porting of four assembly functions including OSStartHighRdy(), OSCtxSw(), OSIntCtxSw(), and OSTickISR().
3.3 System tasks and analysis
For a specific embedded application system, "task division" is the key to real-time operating system application software. Whether the task division is reasonable will directly affect the quality of software design. This system mainly has 8 tasks, namely, vehicle speed pulse measurement task, CAN bus task, water temperature sampling task, oil level sampling task, switch quantity processing task, mileage recording and LCD display task, stepper motor drive task, and WDT task. Tasks communicate and share data through message queues and semaphores. The system main control program is as follows: [page]
After completing the initialization (hardware initialization ARMtargetInit(), μC/OS-II initialization OSInit(), establishing a message queue, etc.), the main program creates each task in turn, then calls OSStart() to start the operating system and start the clock ARMTargetStart(). In μC/OS-II, each task is concurrent, but with different priorities and its own task stack. Different tasks communicate and share data through message queues and semaphores. The task adopts an infinite loop structure. Each task gives up the right to use the CPU by delaying or waiting for semaphores and message queues. In this way, an interrupt switching task is generated when the clock pulse arrives, and the system switches to running the ready high-priority task. When the delay or semaphore and message queue arrive, the task runs again. The system uses the TimerO timer interrupt as the system clock pulse controller, and establishes semaphores in the required tasks. The system tasks are as follows:
1) Vehicle speed pulse measurement task: The pulse signal is connected to EINTO, timer 1 is used for timing, the number of pulses within time t is measured, and the data is sent to the message queue.
2) CAN bus task: The CAN bus task waits for the interrupt service program to send and receive the semaphore of the CAN bus data. After obtaining the right to use the CPU, the CAN bus task processes the CAN bus data and sends it to the message queue, and waits again to receive the semaphore.
3) Water temperature and oil volume sampling tasks: Sample analog quantities at regular intervals and send the sampled analog quantity values to the message queue.
4) Switch quantity processing task: control the LED to light up or turn off, and delay according to the state of the switch quantity.
5) Mileage recording and LCD display task: When the vehicle speed pulse value accumulates to a count value of 0.1 km, a semaphore is sent to this task. After receiving the semaphore, the task enters the ready state, obtains the right to use the CPU during task scheduling, displays and records the mileage information, and continues to wait for receiving the semaphore after running.
6) Stepper motor driving task: first wait for the message queue, then identify the message content according to the task sending the message, drive the stepper motor to rotate the corresponding number of steps according to the data in the queue, and wait for the message in the queue again after running. This task is given the second highest priority.
7) WDT task: used for monitoring and improving system reliability, with the highest task priority and delay.
3.4 CAN bus task and stepper motor drive task flow
Since the pins of the SIO interface of the S3C44BOX are multiplexed with the standard I/O ports, you must first set pins 57 to 59 of the S3C44BOX as SIO interfaces, and then configure the corresponding registers of the SIO module to make the SIO timing consistent with the SPI interface protocol of the MCP2510. This can be achieved through the following initialization SIO function.
As shown in Figure 5, after initialization is completed, the main program initiates the CAN bus task and the stepper motor drive task. The two tasks enter the waiting semaphore and waiting message queues respectively. After the CAN bus is interrupted, the interrupt service program releases the semaphore, making the CAN bus task enter the ready state. After it obtains the CPU control right, it processes the data and then sends the data to the message queue, so that the stepper motor drive task enters the ready state. The motor task obtains the CPU usage right through the task call, and then calculates the required number of drive steps according to the data in the message queue to drive the motor to rotate.
4 Conclusion
A high-precision, high-sensitivity, stable embedded bus automotive digital instrument is designed using S3C44BOX and embedded real-time operating system μC/OS_II. S3C44BOX is rich in resources and fast in execution, and can expand many functions, such as IC card, GPS, black box, etc. In addition, the embedded real-time operating system simplifies the application program and can call system tasks efficiently and in real time. Therefore, this automotive digital instrument system can well solve the problem of automotive instruments moving towards comprehensive informatization.
Previous article:Design of Intelligent Car Based on HC9SDG128 Single Chip Microcomputer
Next article:Design and implementation of automotive safety and defense systems
Recommended ReadingLatest update time:2024-11-16 17:37
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
- [TI recommended course] #Basics of Hall Effect Magnetic Sensors#
- Is the battery level indicator accurate? Battery: I guessed it.
- Would you dare to sit in a car without a steering wheel? The United States allows self-driving cars without steering wheels
- F28335 learning ADC configuration
- Please recommend a step-down circuit
- C6000 Cache
- FPGA_100 Days_Binary to Decimal
- What parameters determine the emission distance of the infrared transmitter tube?
- Msp430PID control motor speed programming example
- A New Decision Feedback Equalizer Architecture Based on FPGA