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.
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.
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.
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:
[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: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.
Previous article:Design of intelligent vehicle system based on MC9S12DG128 path recognition
Next article:Design of Bus-type Automobile Digital Instrument Based on MC9S12HZ256
- 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
- [FS-IR02 + D1CS-D54] - 5: Linking with MCU (D1CS-D54)
- Qorvo Acquires UWB Software Provider 7Hugs Labs SAS
- Please tell me how to draw the differential line of this USB
- How is the burning of OTP chip carried out after SMD?
- MSP430FR2355 Mixed-Signal Microcontroller
- Timing Analysis 1 Static Analysis Basics
- MicroPython v1.19 is coming soon
- [EEWorld invites you to play disassembly] PISEN fast charging power bank 10500mAh 22.5W
- Application of Single Chip Microcomputer in Inverted Pendulum Control System
- 【XMC4800 Relax EtherCAT Kit Review】+ Getting Started with DAVE, Timer Interrupt and UART Simple Application