Design and implementation of automotive BCM based on MC9S12XS128

Publisher:EtherealGlowLatest update time:2012-10-19 Source: 电子设计工程 Keywords:MC9S12XS128  MC33993 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
Freescale's S12 series 16-bit MCU is widely used in body control systems, and is used in body ECUs such as body controller BCM, door lock module, RKE receiver, intelligent actuator, and lighting module. In the BCM developed by a certain vehicle manufacturer, MC9S12XS128 is used as the central processor to realize most of the functions of body control, including door lock control, lighting control, wiper control, window control, and anti-theft alarm. It also realizes the CAN/LIN gateway function, receives vehicle speed and collision signals through the CAN bus, thereby realizing safe driving and emergency operation, and receives signals from the rain sensor through the LIN bus to control the fast, slow, or intermittent operation of the wiper. The following introduces the application of MC9S12XS128 in BCM from the key technical aspects of hardware design and software design.

1 Hardware Design
1.1 Introduction to MC9S12XS128
MC9S12XS128 is a high-performance 16-bit microcontroller for the automotive electronics market, with the characteristics of fast speed, powerful functions, low cost, and low power consumption. Its chip resources and features are as follows:
1) Bus speed up to 40 MHz;
2) 128 KB program Flash and 8 KB DataFlash, used for program and data storage, both with error correction code (ECC);
3) Configurable 8-bit, 10-bit or 12-bit ADC, 3μs conversion time;
4) Embedded MSCAN module for CAN node application, embedded enhanced SCI module and SPI module supporting LIN protocol;
5) 4-channel 16-bit counter;
6) Excellent low power consumption characteristics, with interrupt wake-up function 10, to realize the function of waking up the dormant system;
7) 8-channel PWM, easy to realize motor control.
1.2 System Structure
The hardware system structure of BCM based on S12XS128 is shown in Figure 1. As can be seen from the figure, the BCM hardware circuit includes switch signal detection, CAN/LIN communication, load control and monitoring. The switch signal detection is realized by the multi-way switch detection chip MC33993, the LIN communication is realized by the UART module and the LIN bus physical layer transceiver TJA1021, the CAN communication is realized by the CAN module and the CAN bus physical layer transceiver TJA1055, and the load control is realized by the intelligent power device. In addition to realizing the power drive for the load, the intelligent power device can also provide the mirror working current. In this way, the working condition of the load can be monitored by sampling the mirror working current and converting it with ADC.

a.JPG


1.3 Switch signal detection
In the design and implementation of BCM, the control of the control load triggered by the switch state and its state change is the most common and important control method. Due to the large number of switch signals and the fact that the control load of BCM is mostly controlled in a 10-way manner, how to complete the monitoring of multiple switch states becomes a major challenge in the design when the IO pins of XS128 are limited. At the same time, for battery-powered automotive electronic applications, BCM itself has a low power consumption requirement. When the low power consumption condition is met, it enters the low power consumption mode, and the system shuts down unnecessary modules to reduce power consumption; when the states of several specific switches change, the system needs to start the relevant modules and enter the normal working mode. In this way, it is necessary not only to realize the acquisition of the switch state in the normal working mode and the capture of its state changes, but also to realize the wake-up function in the low power consumption mode.
Some switch signals are collected in a discrete manner, and the rest are implemented using the Freescale programmable multi-way switch detection interface chip MC33993. Its hardware circuit is shown in Figure 2.

b.JPG


MC33993 communicates with the processor via SPI, can detect 22 switch input signals, and can set which switch channels can trigger interrupts. First, XS128 sends a control command word to MC33993 via SPI to initialize the settings, set the working mode of MC33993, and enable the interrupt-triggerable function of the switch channels that are awakened by interrupts. In normal working mode, XS128 reads the switch status of MC33993 through the SPI interface cycle. When the status of the switch channel that can trigger an interrupt changes in low power mode, XS128 can be awakened to enter normal working mode. [page]

2 Software Design
2.1 Software Flow Design
The software design of BCM adopts the software structure of initialization + loop body, and the software flow chart is shown in Figure 3. First, the global variables and the peripherals used (including IO, ADC, SPI, PWM, TIME-R, SCI) are initialized, and then the switch signal detection, LIN communication, RKE communication and load control are carried out in sequence in the loop body. For the load control logic, the switch signal, LIN signal and RKE signal are all input signals that trigger its control operation, and because several switch signals need to be filled into the LIN frame, the load control is placed at the end of the loop body. The order of each software module is shown in Figure 3.

c.JPG


2.2 Switch signal detection software design
In the switch control logic of BCM, the state of the switch signal and its changes are often used as the background conditions and excitation signals of a certain control logic. Therefore, when designing the program, the current state and state jump (including the change from switch closed to open and switch open to closed) of a single physical switch signal need to be determined. Since BCM needs to collect many switch signals, in order to simplify the program and clarify the logic, a structure is defined to unify the various switch signals, and the bit variable characteristics of the structure are used to save variable space, and the uniformity of the structure is used to save code space for the switch signal detection function. The structure is designed as follows:
d.JPG

[page]

In the above structure, Switch represents the current state of the switch signal, Swon_event and Swoff_event represent the changes of the switch from open to closed and from closed to open respectively, and CurSw and Detect_cnt are used for switch signal acquisition and software debounce function. Design a 10 ms timer to periodically read the current state of the switch and confirm 3 times to judge Switch, Swon_event, and Swoff_event. Its code implementation is as follows:
e.JPG
f.JPG
g.JPG

3 Conclusion
A body central controller BCM is designed and implemented using MC9S12XS128. The hardware design of BCM is described from the aspects of processor characteristics, hardware structure, multi-way switch expansion and switch signal detection. The software design of BCM is described from the aspects of software process design, switch signal state monitoring and change capture software implementation. The BCM has been tested on the vehicle and has stable operation and reliable functions. It has entered the small batch pre-production stage and has high practical value.
Keywords:MC9S12XS128  MC33993 Reference address:Design and implementation of automotive BCM based on MC9S12XS128

Previous article:Design of intelligent vehicle system based on MC9S12DG128 path recognition
Next article:Design of Bus-type Automobile Digital Instrument Based on MC9S12HZ256

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号