Design of DSP-based CAN bus communication technology for electric vehicles
2026-04-06 06:25:28··#1
Abstract: Based on the high real-time performance and high reliability requirements of electric vehicle (EV) communication, this paper introduces a CAN bus communication technology scheme based on the TMS320LF2407 DSP, utilizing the CAN bus module embedded in the DSP to achieve real-time communication within the EV. The paper analyzes the CAN bus physical layer hardware interface and the software implementation of the controller. Keywords: DSP, controller, CAN bus, electric vehicle. To solve numerous control and data exchange problems in modern vehicles, Bosch, a German company, developed a CAN (Controller Area Network) fieldbus communication structure. The CAN bus has simple hardware connections and good reliability, real-time performance, and a good price-performance ratio. The CAN bus can meet the needs of modern automation communication and has become one of the most active branches in the field of industrial data bus communication. Its main features are: ① The CAN bus is a multi-master bus, where each node can actively send information to other nodes on the network at any time, without master-slave distinction, making communication flexible; ② The CAN bus adopts a unique non-destructive bus arbitration technology, where nodes with higher priority transmit data first, meeting real-time requirements; ③ The CAN bus has point-to-point, point-to-multipoint, and global broadcast data transmission functions. ④ Each frame on the CAN bus has a maximum of 8 valid bytes and includes CRC and other checksum measures, resulting in an extremely low data error rate. In the event of a serious error in a node, it can automatically disconnect from the bus without affecting other operations. ⑤ The CAN bus uses only two wires, allowing for easy expansion by simply connecting new nodes to the bus, thus reducing wiring and facilitating flexible system expansion and modification. ⑥ The CAN bus boasts high transmission speeds, reaching a maximum transmission rate of 1Mb/s over distances less than 40m. These unparalleled advantages of the CAN bus make it an ideal bus for electric vehicle control systems. 1. Electric Vehicle Communication Network Requirements Electric vehicles, due to their limited energy storage capacity, require stringent energy management during operation. Efficiency is a crucial indicator of electric vehicle system performance. The National 863 "15th Five-Year Plan" for major electric vehicle projects requires a rated efficiency of 85% for the motor system and 95% for the controller. The dynamic information of electric vehicle electronic control systems must be real-time. Subsystems need to share common vehicle data in real time, such as motor speed, wheel rotation, accelerator pedal position, and brake pedal position. However, different control units have different control cycles, data conversion speeds, and control command priorities. Therefore, a data exchange network with a priority contention mode and extremely high communication speed is required. Furthermore, as a means of passenger transport, electric vehicles must offer good comfort, and the vehicle communication system must have strong fault tolerance and rapid processing capabilities. Currently, the development of electric vehicles has received high attention from various countries, and electric vehicles have become the mainstream direction of future automotive development. Electric vehicles contain numerous electrical components, requiring a large amount of data to be transmitted and shared in real time. Improving the real-time performance, reliability, and emergency response capabilities of electric vehicle communication is a key challenge. We use the TMS320LF2407 DS as the main processor of the electric vehicle communication system, leveraging the DSP's excellent fast processing capabilities to improve data processing speed, thereby improving real-time communication performance. We use the CAN bus module embedded in the DSP as the CAN controller, reducing the complexity of hardware circuitry and thus improving communication reliability. We enhance the emergency response capabilities of electric vehicles by shielding secondary factors in emergency situations through software design. 2. Control Scheme For the electric vehicle powertrain control, we adopt advanced fuzzy control, using a TMS320LF2407 DSP controller. The collected braking signal, acceleration signal, and feedback speed signal are fuzzy processed to obtain the desired speed signal. This speed value is then transmitted to the motor control mechanism via the CAN bus to control the motor and meet the driver's driving intentions. Simultaneously, the lighting system and screen display system are managed. The screen display system shows the real-time operating status of the electric vehicle. The specific control scheme is shown in Figure 1. Figure 1: Electric Vehicle Control System Structure Diagram 3. Electric Vehicle CAN Bus Communication Scheme Electric vehicle control requires good communication coordination and operational reliability. A good communication system is key to the reliable operation of electric vehicles. The CAN bus structure is an effective serial communication network that supports distributed or real-time control. Figure 2 shows a typical electric vehicle CAN bus structure diagram, including multiple devices such as the main motor controller of the vehicle's powertrain, the battery management system, and the electric vehicle screen display system. These subsystems communicate and transmit commands via CAN. Each node device can independently complete its own system operation without the CAN bus, thus meeting the needs of vehicle operation safety. Meanwhile, the CAN bus will not experience system structural collapse due to the disconnection of a single device. Figure 2 shows the CAN bus structure of an electric vehicle. 4. CAN Bus Module The CAN bus module is a 16-bit peripheral of the DSP and is a complete CAN controller. In addition to the basic functions of the CAN bus, it also has some unique functions, such as: six mailboxes with data lengths of 0 to 8 bytes, including two receiving mailboxes (0, 1), two transmitting mailboxes (4, 5), and two configurable as either receiving or transmitting mailboxes (3, 4); automatic response to remote requests; programmable CAN bus wake-up function; self-test mode function, etc. Access to the CAN bus is divided into access to the control/status register and RAM access to the mailboxes. The memory space allocation diagram of the CAN bus control module is shown in Figure 3. Figure 3 shows the CAN bus memory space allocation. The CAN controller sends two types of information frames: data frames and remote frames. The transmitting mailboxes are mailboxes 4 and 5, as well as mailboxes 2 and 3 configured for transmitting. When sending a data frame, after the data is written to the data area of the sending mailbox, if the corresponding send request bit is enabled, the data frame is sent to the CAN bus. The data area of the data frame can be set to 1 to 8 bytes by software. The format of the data frame is shown in Figure 4. Figure 4 CAN Bus Data Frame. The CAN bus controller has mailboxes 0 and 1, and mailboxes 2 and 3 configured for receive mode. When receiving information, the CAN controller first compares the identifier of the received information with the identifier of the corresponding receiving mailbox. Only information with the same identifier can be received. The CAN bus controller's receive register allows the receiving mailbox to ignore more bits to receive information. However, if the receive mask enable bit (AME) is 0, the local receive mask register will be disabled. Only mailboxes 2 and 3 configured for send mode can receive auto-acknowledgment remote frames. When a mailbox receives a remote frame, the receiving node will automatically send a data frame as an acknowledgment. 5 Interface Circuit Design Since the DSP itself has a built-in CAN bus module, a dedicated CAN controller is not required. The DSP itself does not have CAN functionality. The transceiver requires an external CAN transceiver 82C250, with an opto-isolator 6N137 used in between. If the distance is very short, the opto-isolator can be omitted. The hardware connection diagram of the DSP, opto-isolator, and CAN transceiver is shown in Figure 5. Figure 5: Hardware Connection Diagram of DSP and CAN Bus Figure 6: Software Implementation of CAN Communication in Electric Vehicle Assembly Controller The electric vehicle assembly controller is the heart of the electric vehicle. It needs to frequently receive and send data for real-time control and monitoring. Information transmission uses a polling method, and information reception uses an interrupt method. The order of information reception and transmission is determined by setting different priorities for different events. An emergency event handling program is added to improve the controller's ability to handle emergency events and ensure vehicle and personal safety. The emergency event handling program temporarily blocks low-priority events, such as battery level detection and the LCD display system, when an emergency occurs, such as actuator failure, sudden braking, or sharp turning, giving the controller sufficient time to handle the emergency, thus improving the controller's real-time control and emergency handling capabilities. The controller software flowchart is shown in Figure 6. Figure 6: Controller Software Flowchart Figure 7: Conclusion Currently, fieldbus technology is rapidly developing in the field of automation. CAN bus, as a highly influential fieldbus, has adopted many new technologies and designs, making it one of the most promising fieldbuses. With its high real-time performance, high reliability, and high flexibility, CAN bus is increasingly used in industrial automation control. This paper applies a DSP controller as the microprocessor for the CAN bus, utilizing the strong data processing capabilities of the DSP and the high transmission rate and reliability of the CAN bus to propose a solution for the complex communication system in electric vehicles. Experiments demonstrate that this system not only solves the real-time requirements of electric vehicle communication but also improves reliability and stability.