A Design Scheme for Embedded Automotive Digital Instruments

Publisher:会飞的笨鱼Latest update time:2013-02-25 Source: dzsc Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

  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.

System structure diagram
 

  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.

System power 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.

Vehicle speed pulse conditioning circuit

  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.

CAN bus communication hardware connection diagram

  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.

 

CAN bus and stepper motor drive task flow chart

  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.

Reference address:A Design Scheme for Embedded Automotive Digital Instruments

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

Design of CAN communication module based on single chip microcomputer and MCP2510
CAN (Controller Area Network) bus, or controller area network. Due to its high performance, high reliability and unique design, CAN bus is gaining more and more attention. Bosch of Germany originally designed CAN bus for automobile monitoring and control system. Now, its application has been developed in the fields
[Microcontroller]
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号