Research on optical fiber CAN bus self-healing ring network

The CAN bus is a serial data communication protocol developed by Bosch in Germany in the early 1980s to solve many data exchanges in automobiles. Thanks to its outstanding features, the CAN bus is recognized as one of the most promising fieldbuses. The transmission medium of the CAN bus can be twisted pair, optical fiber and coaxial cable. At present, the twisted pair CAN bus has been widely used, and various technologies have matured. The twisted pair CAN network is easy to implement in technology, low in cost, and has a certain ability to suppress environmental electromagnetic radiation. However, when the working environment is particularly complicated, its anti-interference ability is not very satisfactory. For example, in the electric vehicle field, the situation is more complicated, and the on-board electrical system will generate strong electromagnetic interference, which will cause the twisted pair CAN network to not work properly. Compared with twisted pair and coaxial cable, the superior performance of fiber - strong EMI resistance has attracted people's attention. In order to further improve the performance of the CAN network, optical fibers should be used as the transmission medium. Due to the short transmission distance of the vehicle-mounted LAN, and in order to reduce the cost of the automotive fiber-optic CAN network, plastic optical fiber (POF) can be used as the transmission medium. Plastic optical fiber has low cost, easy connection, good wrapability and light weight in high-speed short-distance communication transmission, so the networking cost is low. The German BMW company launched the in-vehicle LAN in 50m POF in the "BMW7 Series", the most advanced new car launched in March 2002.

As an industrial underlying control LAN, the optical fiber CAN network has the same topology as the common LAN. The basic topology has a bus shape, a ring shape and a halo shape. In a fiber-optic single-loop CAN network, the loop signal is self-excited due to the delay of the device, causing the ring CAN network to be blocked (or locked). In order to comply with the protocol of the CAN bus controller at the link layer, a fiber optic CAN single loop network dedicated logic control unit LCU should be designed. The function of the unit is: the transceiver control is implemented for the CAN bus data, that is, the master node does not forward the received data, and when the data returns to the original sending node along the fiber loop, it is immediately rejected; the slave node performs the forwarding of the received data. At the same time, the self-excitation phenomenon of the ring-shaped optical fiber CAN bus network can be eliminated, and the ring network is not blocked.

In a Q fiber single-loop network, the failure of a node or link may cause network failure. In order to improve the survivability of the fiber ring network, a fiber-optic double-loop self-healing network with self-healing function should be constructed.

figure 1

1 Fiber optic self-healing ring CAN network overall design

1.1 Fiber self-healing ring structure

The fiber self-healing ring CAN network is shown in Figure 1. The network has two fiber loops—clockwise and counterclockwise. Each node CAN controller SJAl000 is connected to the double-loop fiber network through the interface circuit. The interface circuit is a complex programmable logic device (CPLD) EPM7128S produced by Altera Corporation. Two optical transmitters LEDR and LEDL, two optical receivers, PINR and PINL.

1.2 Interface circuit function

The function of the optical fiber self-healing ring CAN network interface circuit is: (1) When the optical double-loop communication is normal (as shown in Fig. 2(a)), the right-end optical transmitter LEDR of each node transmits the data of the left-end optical receiver PNL, and the signal is smooth. The hour hand transmits; the same LEDL transmits the data of the PINR, and the signal is transmitted counterclockwise, that is, the transmitter selects the opposite side data forwarding. (2) When a single fiber fails (as shown in Figure 2(b)), the downstream C-node interface circuit implements loopback. Since the left-side optical receiver PINL has no signal, the right-end optical transmitter LEDR selects the same-side optical receiver. PINR data forwarding. (3) When two fibers fail between any nodes (as shown in Figure 2(c)), if the fibers between the BC nodes are cut off, the two nodes B and C are connected to the fiber cut-off point to perform the loopback function. At this time, the signal AC from A to C is first clockwise looped to B, and then looped through A and D counterclockwise to reach C. The signal CA is still transmitted in a clockwise loop. This self-healing function ensures that the continuity of the loop is maintained even in the event of a fault. After the fault is removed, the switch automatically returns to its original position. (4) Implement node CAN controller data selection and reception. The principle is: for the cis and counterclockwise data received by each node, the data reception first arrived in the PINL and the PIN. (5) Implement node data selection and transmission. The principle is: when the bus is idle, the CAN signal of the CAN controller of the node is selected to transmit data, which can eliminate the self-excitation phenomenon of the ring-shaped optical fiber CAN bus network, and ensure that the ring network is not blocked; when the CAN controller of the node is the receiving node Select the opposite side data transmission; when the local node CAN controller is the receiving node, and the opposite side fiber channel fails, select the same side data transmission. (6) Discriminate the start of each frame and the end of the frame, and discriminate whether the bus is idle and whether the network is faulty. If it is determined that the left photometric receiver PNL has a data frame being transmitted, the left transmission data flag flag_l and the network communication status flag sync_l are generated.

2 interface circuit design

The self-healing function and transceiver control function of the fiber-optic CAN self-healing network are realized by programmable logic device (ALTERA EPM7128SLC84-15), and the programming adopts VHDL language. The following is a detailed introduction.

2.1 Input and output settings

FIG. 3 is a schematic diagram of an I/O port of the interface circuit CPLD. Wherein, the input and output pins_l, led_l, 1ed_r, and pin_r are respectively connected to the optical/electrical conversion modules PINL, LEDL, LEDR, and PinR: txd and rxd are respectively connected to the data transmitting end TX and the receiving end RX of the CAN controller; flag_txd=1 On behalf of the node CAN controller TX0 is transmitting a data frame; flag_l=1 means that the left channel is transmitting a data frame; flag__r=1 means that the right channel is transmitting a document frame. Sync_l is the left network communication status flag, and sync_r is the right network communication status flag. When the left channel is normal, the output sync_1="l", the driving network state LED D_sl is bright; when the right channel is normal, the output sync_r="1", the driving network state LED D_sr is bright; if the network state LED D_sr or D_sl Off, indicating that the network corresponds to a Fibre Channel failure. When the CAN controller of the node selects the left channel data reception, the output terminal rx_l/r is at a high level; when the CAN controller of the node selects the right channel data reception, the output terminal rx_l/r is at a low level. The input reset is the reset terminal, active low; clk0 is the clock input, and the input clock frequency is 20MHz.

figure 2

2.2 CPLD functional structure

The CPLD is a control loop network self-healing interface unit, and the control circuit is composed of a frequency divider, a central state machine, a transmit data selector, and a receive data selector, as shown in FIG. 4 .

2.3 Divider

The communication interface CPLD clock frequency is 20MHz. In the fiber-optic CAN self-healing ring network, the CAN controller SJAl000 and CPLD interfaces of each node use independent working clocks. In order to synchronize the signal of the flag generated by the state machine with the data transmission of the CAN controller to ensure the switching of the two data selectors and the synchronization of the data transmission, the clock of the state machine should be correctly selected. In this paper, the CAN network data transmission baud rate is 125kbit/s, state. The rate of the machine clock rxclk is designed to be 8 times the baud rate of the data transfer, that is, 1 Mbit/s, which ensures that the data can be read multiple times in one CAN data bit period, improving the anti-interference ability. So the function of the divider is to generate a 1MHz clock frequency.

2.4 Central State Machine

According to the CAN 2.0B protocol, the CAN network data frame consists of seven different bit fields, namely frame start, arbitration field, control field, data field, CRC field, response field, and frame end. The data field length can be 0-8 bytes. The start bit of the frame is a dominant bit low power "quot; 0"; the end of the frame is a sequence consisting of 7 recessive bits "1"; in data frame transmission, bit-filling technology coding is used to ensure data frame bits. There are no 5 consecutive "1'' or ''0') in the stream.

The central control state machine is the core unit of this design. The function of the central state machine is: (1), detecting the start of the frame of the CAN data frame and the end of the frame, and generating corresponding transmit data flag signals flag_txd, flag_r and flag_l. (2) Generate network communication status flags sync_r and sync_l. The central state machine consists of three state machines: the local CAN controller state machine, the left channel state machine, and the right channel state machine. They separately determine whether each channel (TX, PIN_L, and PIN_R) has data transfer. The following explanation of each state machine takes the CAN controller state machine of this node as an example.

Each state machine has 61 states, namely idle, S1, S2, S3, ..., S60. When the bus is idle, the state machine is in the idle state idle, and the upper edge of rxclk arrives. When txd=0 is detected, the state machine turns to S1, and the data flag set signal flag_txd="1" is sent at the same time; The state machine unconditionally turns to S2; when the third upper edge, the state machine unconditionally turns to S3; when the fourth upper edge, the state machine unconditionally turns to S4; when the fifth upper edge comes, this time is the central position of the data bit, the data is stable, The data is read again. If the condition of txd="0" is still true, it indicates that the frame starts, the state machine turns to S5; otherwise, flag_txd="0", and the state machine turns to the idle state idle, waiting for the start of the frame.

When the state machine is at S5, after every one clock cycle of rxclk (1MHz), the state machine state goes further (S6, S7, S8, S9, S10, S11, S12, ..., S58, S59, S60); The data bits on the CAN bus are detected once (S12, S20, S28, S36, S44, S52, S60) in 8 clock cycles, ensuring that each detection is in the center of the data bit (bit period). When 7 times txd="1", detecting "1" indicates that "frame end" is coming, the transmission data flag resets flag_txd="0", waiting for the arrival of the next frame start; otherwise, the state machine returns to state S5, Wait for the end of the frame to arrive.

The network communication status sync_r and sync _l are important basis for self-healing of the ring network. As described above, when the left and right channels transmit the data status flag flag="1'', the network communication status sync="1" of each channel, the network status LEDs D_sr, D_sl are on; when the frame ends, flag="0" Start the network communication status count group count, its clock is rxclk=1MHz, when the counter is 30000 (30ms), sync="0", the network status LEDs D_sr, D_sl are off. This means that after a data frame is transmitted, if If the start of other data frames is not detected, the network is faulty. If the data frame start (flag set) can be detected within 30ms, the network communication status flag sync continues to be "1". The counter reaches the full value. Should be the estimated minimum time interval between frames.

2.5 data selector

The function of the transmit data selector and receive data selector is to implement link setup (ie channel selection). To ensure proper network operation, the CAN network delay should be less than one data width (bit period). To keep the link setup time as short as possible, use the highest clock frequency (20MHz) to control the two data selectors.

In the transmit data selector, the CPLD detects the three-way channel data txd, pin_l, and pin_r. Each channel data has a different priority. The priority setting is: when the node sends data (txd="0" or flag_txd="1''), the left and right channels send CAN control 鞣 (7) the data of the X, ie led_r=txd, led_l=txd. If the node does not send data, the data is sent according to sync_r and sync_l. When the left and right channels are normal, the opposite side data transmission is selected, led_r=pin_l, led_l=pin_r. If a channel fails and no peer data is received, then select This side of the data transmission, led_l = pin_l, led_r = pin_r. According to this, not only achieve network self-healing, but also eliminate the ring network blocking problem.

In the receive data selector, the left channel is set as the preferred receive channel; when the left channel data is not reached (flag_l="0'') or the left channel is faulty, the right channel reception is automatically selected without human intervention. It realizes the reception optimization (selecting the priority arrival channel data reception) and the self-healing function of the optical fiber CAN bus double loop network.

The optical fiber CAN self-healing ring network is built in the electric vehicle, and the plastic optical fiber is used as the transmission medium. The plastic optical fiber has a low loss window in the visible light region, and the optical/electrical conversion module with the working wavelength of 650 nm (red light) is selected, which is produced by Agilent. Optical transmitter HFBR-1528 and optical receiver HFBR--2528. Each node CAN controller uses SJAl000 or TMS320LF2407 DSP chip with CAN controller to form a four-node automotive fiber CAN self-healing ring network. The data transmission rate of the CAN network is set to 125kbit/s. When a channel failure is set, the network can realize the self-healing function as shown in Figure 2(b); when setting two fiber failures between any nodes, the network can The self-healing function shown in Fig. 2(c) is realized. When the CAN node fails, the interface circuit can still ensure the normal operation of the dual ring network; however, when the interface circuit fails, the node will be disconnected from the bus, and other nodes realize the network self-healing, forming a single ring network. The waveform is observed by the oscilloscope, and the transmitting node competes to send data through the bus; the receiving node can send the response signal to the bus; the node data returns to the original node through the 4-node fiber CAN self-healing loop for less than 100 ns. After testing, the channel failure network self-healing time is 301ms

12V 100AH LiFePO4 Battery Pack

12v lifepo4 battery pack,12v 100ah lifepo4 battery,100ah lifepo4 battery,lifepo4 battery pack,quality lifepo4 battery pack 12v 100ah

Shenzhen Jiesai Electric Co.,Ltd , https://www.gootuenergy.com