Design of Body Control Module Based on Single Chip Microcomputer MC9S12XS128

Freescale's S12 series of 16-bit MCUs are widely used in body control systems for body controller BCMs, door lock modules, RKE receivers, smart actuators, lighting modules and other body ECUs. In the body control module developed by an OEM, the MC9S12XS128 is used as the central processor to realize most of the functions of the body control, including door lock control, lighting control, wiper control, window control and anti-theft alarm. The CAN/LIN gateway function, which receives the vehicle speed and collision signals via the CAN bus for safe driving and emergency operation, receives signals from the rain sensor via the LIN bus, and controls the fast, slow or intermittent operation of the wiper. The following is an introduction to the application of the MC9S12XS128 in BCM from the key technical aspects of hardware design and software design.

This article refers to the address: http://

1 hardware design

1.1 Introduction to MC9S12XS128

The MC9S12XS128 is a high-performance 16-bit microcontroller for the automotive electronics market with fast speed, high functionality, low cost and low power consumption. Its chip resources and features are as follows:

1) Bus speeds up to 40 MHz;

2) 128 KB program Flash and 8 KB DataFlash for program and data storage, all with error correction code (ECC);

3) Configurable 8-bit, 10-bit or 12-bit ADC with 3μs conversion time;

4) The embedded MSCAN module is used for CAN node application, and the enhanced SCI module and SPI module supporting LIN protocol are embedded;

5) 4-channel 16-bit counter;

6) Excellent low-power characteristics, with interrupt wake-up function 10, to achieve the function of wake-up sleep system;

7) 8-channel PWM for easy motor control.

1.2 System Structure

The structure of the BCM hardware system 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 passed through the intelligent power. In the device implementation, in addition to realizing the power drive to the load, the intelligent power device can also provide a mirrored working current, so that the load can be monitored by the mirrored working current sampling ADC conversion.

11.jpg

Figure 1 BCM hardware system structure based on S12XS128

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 most important control mode. Due to the wide variety of switching signals, the control load of BCM is controlled by 10 ways. In this way, when the IO pin of the XS128 is limited, how to complete the monitoring of multiple switch states becomes a major challenge in the design. At the same time, for battery-powered automotive electronics applications, BCM itself has low power consumption requirements. When low power consumption conditions are met, the low power mode is entered, the system shuts down unnecessary modules, reduces power consumption; when several specific switches When the state changes, the system needs to start the relevant module and enter the normal working mode, so that not only the switching state acquisition and the state change capture in the normal working mode but also the wake-up function in the low power mode are needed.

Some of the switching signals are collected in a discrete manner, and the rest are implemented using the Freescale programmable multiplexer detection interface chip MC33993. The hardware circuit is shown in Figure 2.

22.jpg

Figure 2 hardware circuit diagram

The MC33993 communicates with the processor via the SPI to detect 22 digital input signals and can set which switching channels can trigger an interrupt. First, the XS128 sends a control command word to the MC33993 through the SPI, performs initial setting, sets the working mode of the MC33993, and enables the trigger interrupt function of the switch channel that wakes up. In the normal working mode, the XS128 reads the switching state of the MC33993 through the SPI interface cycle. When the state of the switching channel that can trigger the interrupt changes in the low power mode, the XS128 can be woken up and enter the normal working mode.

2 software design

2.1 Software Process 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 sequentially performed in the loop body. For the load control logic, the switching signal, the LIN signal and the RKE signal are the input signals that trigger their control operations, and since several switching signals need to be filled into the LIN frame, the load control is placed at the end of the loop body, each The software module sequence is shown in Figure 3.

33.jpg

Figure 3 software flow chart

2.2 Switch signal detection software design

In the switching control logic of the BCM, the state of the switching signal and its changes are often used as the background conditions and excitation signals of a certain control logic. Therefore, in the programming, a single physical switching signal needs to determine its current state and state transition (including The switch is closed to open and the switch is open to closed change). Because the BCM needs to collect more switching signals, in order to simplify the program and clear the logic, define a structure to unify the switching signals, use the bit variable characteristics of the structure to save the variable space, and use the uniformity of the structure to save the switching signal. Detect the code space of the function. The design structure is as follows:

1.jpg

In the above structure, Switch represents the current state of the switching signal, and Swon_event and Swoff_event represent the change of the switch from open to closed and from closed to open, respectively, and CurSw and Detect_cnt are used for software signal debounce of switching signal acquisition. Design a 10 ms timer, periodically read the current state of the switch, and confirm it 3 times to determine Switch, Swon_event, and Swoff_event. The code is implemented as follows:

Dd.jpg

3 Conclusion

The MC9S12XS128 design realizes a body central controller BCM, which describes the hardware design of BCM from the aspects of processor characteristics, hardware structure, multi-switch expansion and switching signal detection, from software flow design, switch signal status monitoring and change capture. The software implementation of the BCM is described in the software implementation. The BCM has been loaded and tested, stable in operation and reliable in function. It has entered the stage of small batch pre-production and has high practical value.

Brake Disc For SUZUKI

China leading manufacturers and suppliers of Suzuki Brake Disc,FOR Suzuki Auto Brake Disc, and we are specialize inFOR Suzuki Car Brake Disc,FOR Suzuki Automobile Brake Disc, etc.

Suzuki Brake Disc,Suzuki Auto Brake Disc,Suzuki Car Brake Disc,Suzuki Automobile Brake Disc

Zhoushan Shenying Filter Manufacture Co., Ltd. , https://www.renkenfilter.com

Posted on