The battery management system is an important electronic control unit in hybrid electric vehicles. It has the function of ensuring the normal, reliable and efficient operation of the battery and is a bridge between the battery and the electrical equipment. During the development and mass production process, its internal control parameters need to be matched and calibrated offline or online, and the battery management system needs to collect and process a large amount of data. This article uses TMS320LF2407 as the CAN controller for calibration. As a CAN node on an electric vehicle, it needs to receive CAN messages sent by the vehicle to execute control commands for external relays, fans, batteries and other devices. This article uses SJA1000.
Dual CAN hardware circuit and
CPLD Logic Design
Dual CAN hardware circuit design
TMS320LF2407 is based on enhanced Harvard structure, and is a microprocessor with separate address and data lines. After multiplying the crystal oscillator, the frequency is as high as 40MHz. The multiplexing of address and data lines of SJA1000 increases the difficulty of reading and writing data between DSP and SJA1000, which is also the difficulty of this system design. The conventional design method is to add a level conversion bidirectional buffer driver between DSP and SJA1000, and its structural block diagram is shown in Figure 1. According to the circuit designed in this way, when reading and writing operations on SJA1000, first configure the I/O port of DSP, pull ALE high, latch the address, and then pull down and () through the I/O port of DSP to read (write) data, and finally pull high and (). In this way, each time the value in the SJA1000 register is read and written, the ALE, and () signals need to be set through the program, which increases the program source code. If the flash memory space of the controller is relatively tight, it is obviously not advisable to adopt this hardware connection method. Moreover, in order to read and write the status bits of the status register correctly, a certain delay needs to be added to the program when reading and writing CAN messages, which will affect the real-time performance of the battery management system.
Figure 1 General dual CAN controller hardware structure diagram
In order to minimize the program source code, save precious storage resources and improve the real-time performance of the battery management system, this paper uses CPLD to connect the interface circuit of the dual CAN controller to realize the CAN message transmission and reception. Its hardware structure is shown in Figure 2.
Figure 2 Hardware structure of dual CAN controller based on CPLD
Logic Design of CPLD
CPLD has the advantages of fast speed, small size, strong driving ability, and online programming. The logic control circuit based on CPLD is suitable for completing the decoding task. This paper selects the EPM7064 chip and completes the logic selection control of the SJA1000 input signal through the software design of the decoding circuit.
The input signal of CPLD is the signal sent by DSP, which consists of high-order address A[15…13], I/O space selection pin and write/read signal. Among them, address line A13 is used as the address and data selection line of SJA1000, and address lines A14 and A15 are used as chip selection signals after decoding. Address line A13 and I/O space selection signal generate address latch signal SJA_ALE of SJA1000, and address line A13 and read/write signal generate data and address read/write signal of SJA1000. The logical relationship of input/output signal of CPLD is shown in Table 1.
Dual CAN software programming
The transceiver program of the CAN controller consists of two parts: the CAN transceiver program of the DSP and the CAN transceiver program of the SJA1000. Each CAN transceiver program mainly consists of three functions: CAN initialization program, CAN message receiving program and CAN message sending program. Since the CAN transceiver program of the DSP is relatively easy to design, you only need to set the corresponding bits in the CAN controller register to realize the transceiver of the CAN message. Therefore, this article mainly introduces the design of the CAN message transceiver program of the SJA1000.
As can be seen from Table 1, the registers of SJA1000 are mapped to the I/O space of DSP. This paper selects 0x8000 as the SJA1000 address input port and 0xA000 as the SJA1000 data input/output port. The program mainly consists of three sub-functions: SJA1000 initialization, SJA1000 receiving message and SJA1000 sending message. The flow of its receiving and sending function is shown in Figure 3.
Figure 3 SJA1000 message sending program flow chart
SJA1000 initialization
By writing 0x01 to the CAN controller SJA1000 mode register, it enters the reset mode, and then sets the SJA1000 clock frequency division register, error alarm limit register, interrupt enable register, receive code and receive mask register, bus timing register and output control register respectively, and finally writes 0x08 to the mode register to enter the normal working mode. The initialization procedure is as follows:
#define SJA1000_Data_Port portA000
ioport unsigned int portA000; //define data input/output port
#define SJA1000_Address_Port port8000
ioport unsigned int port8000; //define address input port
…
SJA1000_WRITE(REG_MODE, 0x01);
TempData= SJA1000_READ(REG_MODE);
//Write 0x01 to the mode register to enter reset mode
while((TempData & 0x01) != 0x01); //Wait for SJA1000 to reset
…
do
{
SJA1000_WRITE(REG_MODE, 0x08);
TempData= SJA1000_READ(REG_MODE);
}while ((TempData & 0x01)!=0x00); //Wait for SJA1000 to enter normal working mode
Send CAN message
The CAN message sending function is responsible for the battery management system to send messages to the vehicle controller. When sending, the data to be sent needs to be combined into a frame message according to the CAN protocol format, sent to the SJA1000 sending buffer, and then the sending command is started. The CAN sending program is as follows:
if((TempData & 0x10) != 0x10) //CAN controller is idle
{
if((TempData & 0x08) != 0x0) //The last send was successful
{
if((TempData & 0x04) == 0x04)
//CPU can write messages to the send buffer
{
…… //Configure sending message
SJA1000_WRITE(REG_ COMMAND,0x01); //Send message command
}
}
}
Receiving CAN messages
The CAN message receiving function is mainly responsible for receiving the control instructions sent by the vehicle controller to complete the control of the charging and discharging relays, fans, batteries and other devices. The CAN receiving program is as follows:
if(TempData != 0)
{
if((TempData & 0x80) == 0x80) //bus off
{
…… //Bus close processing
}
if((TempData & 0x02) == 0x02) //Data overflow
{
…… //Data overflow processing
}
if((TempData & 0x01) == 0x01) //RXFIFO contains a complete and valid message
{
…… //Read the message in the buffer
}
}
Conclusion
The CPLD-based dual CAN controller designed in this paper has been used in practical applications. The battery management system operates reliably, and the CAN message transmission and reception are stable, which is completely suitable for the use of hybrid vehicles.
References:
1. Liu Yongjiji. Research and development of nickel-hydrogen battery management system for hybrid electric vehicles[D]. Beijing: Beijing University of Aeronautics and Astronautics, 2007.03
2. Liu Heping, Wang Weijun, Jiang Yu, Deng Li. TMS320LF240x DSP C language development and application [M]. Beijing: Beijing University of Aeronautics and Astronautics Press, 2006.03
3. Wu Hongjie. Nickel-hydrogen battery management technology for hybrid electric vehicles [D]. Beijing: Beijing University of Aeronautics and Astronautics, 2005,10
Previous article:Design of analog meter for digital closed-loop fiber optic gyroscope based on FPGA
Next article:Design and implementation of variable parameter RS encoder IP core
- Popular Resources
- Popular amplifiers
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
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
- Design scheme for realizing communication between upper and lower computers via USB
- Which parameters in the datasheet of the five devices, diode, triode, MOS tube, op amp, and optocoupler, can reflect...
- I want a Zircon A4 FPGA board (without downloader). If you have one, please contact me.
- Overview of TI Power Supply EMI Specifications
- Is inductance or magnetic beads used to isolate the digital power supply from the analog power supply?
- Introduction to RISC-V Toolchain
- Crazy Shell AI open source drone GPIO (LED flight status light, signal light control)
- FPGA Entry Series Digital Tube
- Analog Dialogue Volume 55 Issue 3 is now online! Come and get your source of inspiration~
- 51 delay problem