Share this

CAN-based power control system design

2026-04-06 06:56:22 · · #1
Abstract: This paper introduces the communication implementation in a CAN-based distributed power control system, and explains its hardware and software design, key debugging points, and specific functions. Keywords: CAN bus; TMS320LF2407; distributed power control system; communication CAN bus is a serial communication network that can effectively support distributed control systems. On the one hand, its communication mode is flexible, enabling multi-master operation and various data transmission and reception modes such as point-to-point and point-to-multipoint; on the other hand, it can perform high bit rate data communication over relatively large distances, for example, its transmission rate can reach 20 kb/s over a distance of 3.3 km. Our system is controlled and managed by a host computer for multiple parallel single-power control systems. The distance between the single power supplies is about 100 m, and they must be placed in a high position. Fast data transmission between the systems is required, and the CAN bus can well meet the requirements of this system. 1 System Overall Structure Figure 1 is a schematic diagram of the structure of the distributed power control system. Among them, the CAN0 node is the host computer. This system uses a C51 microcontroller and an external CAN controller SJA1000. It transmits control setpoints to multiple lower-level machines and analyzes and calculates the data sent by the lower-level machines to change the setpoints. Nodes CAN1 to CAN31 (up to 31) are the control parts of each single power supply. We use the TMS320LF2407 chip from TI as the main controller, which integrates a CAN controller module. 2 Introduction to LF2407 and its integrated CAN control module LF2407 is a fixed-point DSP processor launched by TI. It adopts high-performance static CMOS technology, the power supply voltage is 3.3 V, and the instruction cycle can reach 25 ns. It integrates multiple peripheral modules, including the CAN controller and memory, and is suitable for the control of motors and inverter circuits. The CAN controller module is a 16-bit peripheral module integrated into the LF2407. The module has the following characteristics: (1) Supports the CAN2.0B protocol, supports standard identifiers (11 bits) and extended identifiers (29 bits), and supports data frames and remote frames. (2) It is configured with 6 mailboxes: 2 receiving mailboxes (0, 1), 2 transmitting mailboxes (4, 5), and 2 configurable mailboxes (3, 4); the data length of each mailbox is 8 bytes. The receiving mailboxes can be masked. When the identifier bit is masked, there is no need to verify the identifier bit when receiving data frames. (3) It has a programmable bit timer, interrupt service, and CAN bus wake-up function. (4) It can automatically reply to remote requests and has an automatic retransmission function when there is a transmission error or data loss. Each mailbox register contains 7 words of information. Similar to the control registers of each functional module, the LF2407 assigns a fixed data memory address to it. For example, mailbox 0 has the following register allocation: MBX0A~D (4 words of storage space) Address: 7204~7207 Where: the identifier (set in 29 bits) is in the last 13 bits of MSGIDnH and MSGIDnL. 3. Hardware Circuit Design and Debugging When designing the CAN communication circuit of the LF2407, one issue should be noted: the 2407's power supply voltage is 3.3V, and its CAN control module's high-level output is also only 3.3V, which is incompatible with the CAN driver PCA80C250's level (5V). This should be considered when adding isolation optocouplers in the circuit design. Figure 2 shows the CAN communication schematic on the lower-level machine side. Since the TX output optocoupler uses an emitter follower method, our output optocoupler should be a 6N136 (the 137 cannot meet the requirements due to its structure). Figure 3 shows the voltage waveform across R42 obtained during data transmission (output 10101010…). From our settings in the CAN communication controller's bit configuration register BCR1, we know that our sampling point is at 70% of the time interval for each data bit. The output voltage at this point must be within the rated high and low level setting range. We selected R42 = 5 kΩ and obtained the above waveform, which satisfies that the high level at the sampling point is ≥3.5 V and the low level is ≤1.5 V. 4 Communication Protocol and Software Implementation In the system, the host computer sends the running setpoint and start/stop signal to the slave computer, and periodically queries the running status of each single machine to make corresponding adjustments to its status. The specific communication process is divided into two categories: (1) The host computer transmits operation commands and setpoints to the slave computer. The host computer sends data frames. After the host computer sends the data frame, if the slave computer receives the data frame, it sends an acknowledgment frame to the host computer, and the data frame transmission ends. If the transmission fails, the host computer waits for a period of time and does not receive an acknowledgment frame, and then automatically retransmits the data frame. (2) The host computer queries the running status and various record setpoints of the slave computer. The host computer sends remote frames. The remote frame only contains data type and no data content. After the slave computer receives the remote frame, it transmits data to the host computer according to the data type required by the host computer. At the same time, it waits for the acknowledgment frame from the host computer. If no acknowledgment frame is received, the data is retransmitted periodically. This system communicates using standard frames, employing an 11-bit identifier. The definitions of each bit are as follows: ID0-ID4: Node identifier; a 5-bit node identifier allows the network to accommodate 32 nodes. ID5-ID7: Data type; various data types need to be transmitted. Uploaded data frames are defined into 7 types (including acknowledgment frames), corresponding to 6 types of remote frames and 6 types of data frames. At least 3 bits are needed to determine the data type. ID8-ID10: Frame count; the largest data type contains 17 words, and each frame can transmit a maximum of 4 words, so at least 5 frames are needed to transmit this type of data. Frame counting is required to determine the specific data type, hence at least 3 bits are needed for frame counting. Since the LF2407 has a dedicated CAN module interrupt, and a dedicated CAN interrupt flag and mask register are designed in the CAN control module, interrupt-driven CAN controller reception and transmission can be easily initiated. When setting up the CAN controller, it is necessary to first enable the change data request bit CCR and then restore it after the change. It is worth noting that many register bits in the TMS320LF2407 need to be cleared to "0" by writing "1", and some bits can only be read and cannot be directly modified by the program. For example, the MIFn (0~5) flag for mailbox interrupt (including receive and send) should be cleared after entering the interrupt response. However, this bit is a read-only bit. The user program can only achieve the clearing purpose by writing 1 to the TAN bit of the TCR register (for the send mailbox) and writing 1 to the RMPn bit of the RCR register (for the receive mailbox). 5 Implemented functions The functions implemented through this communication system include: fixed value transmission (data frames transmitted from the host computer to the slave computer): (1) Time synchronization: data specific to hours, minutes and seconds. (2) Transmission of operating settings: including flashover parameters (flashover coefficient KSP, given spark rate SPARK_NUM), charging parameters (given peak value Up, rise rate RISE-NUM, charging time limit Ton-max), and discharging parameters (average voltage Vg, average current Ig, discharge time limit Toff-max). (3) Protection settings: including open circuit parameters (voltage, current, delay), short circuit parameters (voltage, current, delay), undervoltage, delay, overload current, bias excitation, IGBT temperature, oil temperature, etc. (4) Channel parameters: including primary current, output voltage and current, IGBT temperature, oil temperature, input current (three-phase), and DC voltage. Operating setting query (host computer sends remote frame): including system status, fault record, operating settings, protection settings, channel coefficient, etc. 6 Conclusion This system has been debugged. In our initial one-to-one system (host computer with 1 control system), it can resist strong interference and work normally under large data transmission volume.
Read next

CATDOLL 135CM Vivian

Crafted with attention to detail, this 135cm doll offers a well-balanced and realistic body shape that feels natural in...

Articles 2026-02-22