Abstract: This article in view of the complete bikes to the battery management system management system proposed that the double CAN correspondence’s request, has designed the double CAN controller which by CPLD, TMS320LF2407 and SJA1000 constitutes. In the article introduced its hardware circuit and the software flow. Key word: Mix power electric automobile; Battery management system management system; Double CAN controller
The battery management system management system is mixes in the power automobile the important electronic control unit, has safeguards the battery normal, reliable and the highly effective work function, is between the battery and current collector’s bridge. In develops as well as in the volume production process needs to carry on the off-line or the online match demarcation to its internal control parameter, but the battery management system management system needs to gather and to process the massive data, this article selects TMS320LF2407 to use the CAN controller as the demarcation. As an electric automobile’s on CAN node, needs to receive the CAN news which the complete bikes sends to carry out to exterior component’s and so on relay, ventilator as well as battery control commands, this article selects SJA1000.
Double CAN hardware circuit sum
CPLD logical design
Double CAN hardware circuit design
TMS320LF2407 based on the enhancement Harvard structure, is the address wire and the data line separation microprocessor, after crystal oscillator frequency multiplication, the frequency reaches as high as 40MHz. But the SJA1000 address wire and the data line multiplying, increased between DSP and SJA1000 the read-write data difficulty, this is also this system design difficulty. The conventional design way is adds a level switch bidirectional cushion actuation between DSP and SJA1000, its structure diagram as shown in Figure 1. According to this way design electric circuit, when carries on the read-write operation to SJA1000, disposes DSP the first I/O port, pulls high ALE, the lock saves the address, then and () will pull lowly through the DSP I/O port, will carry on reads (writes) the data, finally will pull () the sum high. According to this way each time read-write SJA1000 register’s in value, must through the procedure to ALE, and () the signal carries on the establishment, increased the procedure source code. If the controller dodges saves the space to be quite tight, adopts this hardware connection mode not to be possible to take obviously. Moreover, to cause the condition register’s status byte read-write to be correct, when CAN text read-write must add certain time delay in the procedure, this will affect the battery management system management system’s timeliness.

Figure 1 general double CAN controller’s hardware structure drawing
To reduce the procedure source code as far as possible, saves the precious memory resources and enhances the battery management system management system’s timeliness, this article uses CPLD to connect the double CAN controller’s interface circuit, realizes CAN text receiving and dispatching. Its hardware architecture as shown in Figure 2.

Figure 2 based on CPLD double CAN controller hardware structure drawing
CPLD logical design
CPLD has the speed to be quick, the volume is small, driving force strong, may merits and so on online programming. Suitable to complete the decoding task based on the CPLD logical control electric circuit, this article selects the EPM7064 chip, through decoding circuit’s software design, completes the SJA1000 input signal the logical selection control.
The CPLD input signal is the DSP transmission signal, of high address A[15…13], the I/O space selection pin as well as writes/reads the signal make-up. And, address wire A13 takes SJA1000 the address and the data choice line, address wire A14 and A15 after the decoding the achievement selects patches or strips of land as worth saving for seed the signal. Address wire A13 and the I/O space gating signal produces the SJA1000 address lock to save signal SJA_ALE, address wire A13 and the read-write signal has the SJA1000 data and the address read-write signal. Its CPLD input/output signal logical relation as shown in Table 1.
Double CAN software routine design
This CAN controller’s receiving and dispatching procedure including two parts: DSP CAN receiving and dispatching procedure and SJA1000 CAN receiving and dispatching procedure. Each CAN receiving and dispatching procedure is mainly composed of three functions: CAN initialization routine, CAN text receive procedure and CAN text calling order. Because the DSP CAN receiving and dispatching procedure is quite easy to design, only need establish in the CAN controller register’s corresponding position, may realize CAN text receiving and dispatching. Therefore, this article mainly introduces SJA1000 the CAN text receiving and dispatching programming.
From table 1 may see that the SJA1000 register maps DSP the I/O space. This article chooses 0×8000 to take the SJA1000 address input port, 0xA000 takes the SJA1000 data feeds/output port. Its procedure mainly by the SJA1000 initialization, the SJA1000 receive text and the SJA1000 transmission text three sub-functions is composed. Its receiving and dispatching function’s flow as shown in Figure 3.

Figure 3 SJA1000 transmission message procedure flow chart
SJA1000 initialization
Through pattern register writes 0×01 to CAN the controller SJA1000, lets it enter the replacement pattern, then to the SJA1000 clock frequency division register, the wrong warning quota register, the interrupt enables the register, the code reception and the receive shield register, the main line succession register and the output control register establishment separately, finally writes 0×08 to the pattern register, enters the normal work pattern. The initialization routine is as follows:
#define SJA1000_Data_Port portA000
ioport unsigned int portA000; // definition data feeds/output port
#define SJA1000_Address_Port port8000
ioport unsigned int port8000; // definition address input port
……
SJA1000_WRITE (REG_MODE, 0×01);
TempData= SJA1000_READ(REG_MODE);
// writes 0×01 to the pattern register, enters the replacement pattern
while ((TempData & 0×01)! = 0×01); // waits for the SJA1000 replacement
……
do
{
SJA1000_WRITE (REG_MODE, 0×08);
TempData= SJA1000_READ(REG_MODE);
} while ((TempData & 0×01)! =0×00); // waited for that SJA1000 enters the normal work pattern
Transmits the CAN text
The CAN text transmission function is responsible for the battery management system management system to the complete bikes controller transmission text, when the transmission must wait the transmission the data to combine a text according to the CAN agreement form, sends in the SJA1000 transmission buffer, then start routing directive. The CAN calling order is as follows:
if ((TempData & 0×10)! = 0×10) //CAN controller is idle
{
if ((TempData & 0×08)! = 0×0) the // recent transmission has succeeded
{
if ((TempData & 0×04) == 0×04)
//CPU may to transmit the buffer to write the text
{
…… // disposes the transmission text
SJA1000_WRITE (REG_ COMMAND,0×01); // transmission text instruction
}
}
}
Receives the CAN text
The CAN text receive function primary cognizance receive complete bikes controller transmits the control command, completes to component’s and so on charging and discharging relay, ventilator as well as battery controls. The CAN receive procedure is as follows:
if (TempData! = 0)
{
if ((TempData & 0×80) == 0×80) // main line closure
{
…… // main line closure processing
}
if ((TempData & 0×02) == 0×02) // data overflow
{
…… // data overflow handling
}
if ((TempData & 0×01) == 0×01) //RXFIFO has the complete effective text
{
…… // read buffer text
}
}
Conclusion
This article designs has utilized based on the CPLD double CAN controller in the practical application, the battery management system management system movement is reliable, CAN text receiving and dispatching is steady, suits the mix power automobile’s use completely.
Reference:
1. Liu Yongji lucky. Mix power electric automobile nickel hydrogen battery management system management system’s development [D]. Beijing: Beijing University of Aeronautics and Astronautics, 2007.03
2. Liu Heping, Wang Wei is handsome, river Chongqing, Deng Li. TMS320LF240x DSP the C language development applies [M]. Beijing: Beijing University of Aeronautics and Astronautics Publishing house, 2006.03
3. Wu Hongjie. Mix power electrically operated passenger vehicle nickel hydrogen power battery managerial technique [D]. Beijing: Beijing University of Aeronautics and Astronautics, 2005,10