A CAN bus fiber optic transmission interface design
2026-04-06 03:33:38··#1
Abstract: Based on the analysis of the characteristics of CAN bus twisted-pair and fiber optic transmission, this paper proposes a fiber optic transmission interface design scheme based on a fiber optic transceiver module and a CAN bus controller SJAl000. The selection of the fiber optic transceiver and the implementation of the transmission interface are described in detail. According to the requirements of the fiber optic transceiver module for signal source clock extraction and the non-destructive bus arbitration characteristic of the CAN bus, a CAN bus signal encoding and decoding method is designed and implemented using FPGA. The correctness of the design scheme is verified through actual communication experiments, and the transmission performance of the CAN bus under the two media is compared based on experimental data. Keywords: CAN bus; fiber optic; transmission interface; FPGA Introduction As a mature fieldbus technology, CAN (Controller Area Network) bus has been widely used in industrial control fields such as automotive, power, machinery, and chemical industries. The CAN protocol standard specifies two transmission media supported by the CAN bus—twisted-pair and fiber optic. Currently, the vast majority of CAN bus systems use twisted-pair transmission. Optical fiber is generally used in high-capacity, high-speed transmission. However, for fieldbus communication like CAN bus, which has a lower transmission rate and smaller data volume, the advantages of optical fiber transmission cannot be fully utilized, so its application is still limited. Many research institutions at home and abroad have conducted research on CAN bus optical fiber transmission, but mainly based on methods using discrete optical fiber transceiver components. This paper introduces a scheme using an integrated optical fiber transceiver module combined with encoding and decoding algorithms to implement a CAN bus optical fiber transmission interface; based on the characteristics of the CAN bus and experimental data, the improvement of CAN bus transmission performance under optical fiber media is analyzed. 1 CAN Bus Twisted Pair and Optical Fiber Transmission 1.1 CAN Bus Twisted Pair Transmission The typical network topology of the CAN bus is a bus structure. The international standard ISO 11898, promulgated in 1993, made recommendations on the characteristics of the CAN bus transmission medium based on twisted pair: the bus can have two logic states, namely recessive (logic "1") or dominant (logic "0"). Figure 1 shows the CAN twisted pair transmission network structure based on the CAN bus controller SJA1000 and the bus driver PCA82C250. The CAN bus twisted-pair transmission interface is characterized by its ease of implementation and low cost; theoretically, the number of nodes is unlimited, and it has a certain ability to suppress environmental electromagnetic radiation. However, with the increase of frequency, the attenuation of the twisted-pair wire pairs increases rapidly; twisted-pair also suffers from so-called near-end crosstalk, which is electromagnetic coupling interference between the "transmitting pair" and the "receiving pair". In addition, the transmission rate of twisted-pair is significantly limited by distance. These defects make the CAN bus unsuitable for use as a transmission medium in situations with strong interference, high speed, and long distance. 1.2 CAN Bus Fiber Optic Transmission The CAN protocol supports fiber optic as a transmission medium. However, since the CAN bus network generally adopts a bus structure, and its bus arbitration uses priority-based non-destructive CSMA (Carrier Sense Multiple Access), while fiber optic signal transmission is unidirectional, the simplest and most practical method is to use fiber optic media on some bus branches, with the entire CAN network using a hybrid of twisted-pair and fiber optic transmission media. The structure is shown in Figure 2. As a transmission medium, fiber optic has many superior characteristics compared to twisted-pair in terms of anti-interference, transmission capacity, and speed. Therefore, in certain harsh environments, geographically widespread, and high-speed CAN bus systems, fiber optic transmission can be used on corresponding branches to ensure the performance of the entire CAN network. 2 Fiber Optic Transmission Interface Implementation Scheme 2.1 Selection of Fiber Optic Transceiver Modules A crucial step in implementing fiber optic transmission is completing the photoelectric conversion of bus signals, which can be achieved using dedicated fiber optic transceiver devices. Currently, there are two types of fiber optic transceivers: one is based on discrete components, where the optical receiving and transmitting modules are independent. This type of transceiver module is relatively simple; the optical transmitting section mainly consists of a light source and bias control circuit; the optical receiving section mainly consists of a photodetector and shaping amplifier circuit, and generally uses plastic or multimode fiber for transmission. The other type is an integrated fiber optic transceiver module. Based on advancements in light source, photodetector, optical device packaging, driver integrated circuits, and amplifier integrated circuits, it integrates receiving and transmitting into a single optoelectronic system that conforms to telecommunications transmission standards. It uses a higher-performance light source in the optical transmitting section and incorporates clock and regeneration decision circuits in the receiving section, and generally uses single-mode fiber for transmission. Therefore, fiber optic transceiver modules offer significant improvements in signal conversion speed and stability compared to discrete fiber optic transceivers. They also offer easier interfacing with external devices, and single-mode fiber exhibits lower dispersion and power consumption compared to multimode fiber. This design utilizes a TTL fiber optic transceiver module with a standard industrial 1×9 pin configuration, powered by a single +5V power supply, operating in single-mode fiber optic transmission mode, and using a standard ST-ST fiber optic interface. The module's driver interface is shown in Figure 3. 2.2 Design Scheme Since the fiber optic transceiver module contains a clock extraction circuit, the converted signal stream must contain rich clock information to ensure accurate frequency capture. Therefore, the signal stream should not contain long strings of consecutive "1"s or "0"s. However, the CAN bus exhibits long strings of "1"s or "0"s during idle periods and when transmitting certain frame types, especially at low baud rates. The duration of consecutive identical voltage levels increases, potentially causing the receiver to fail to capture the accurate baud rate of the signal stream, resulting in inaccurate or even erroneous bit timing in the converted signal. Therefore, preprocessing of the CAN signal stream before conversion is necessary. The most common method is encoding. The encoded signal stream contains rich clock information and avoids long strings of consecutive "1"s or "0"s. It is then decoded and restored after transmission through optical fiber. In other words, a codec is added between the CAN controller, driver, and photoelectric conversion module. Based on this, a CAN bus optical fiber transmission interface scheme based on the CAN bus controller SJA1000 and an integrated optical fiber transceiver module is proposed, as shown in Figure 4. The interface is divided into a transmitting end and a receiving end. The transmitting end consists of the CAN bus controller SJA1000, a signal codec, and an integrated optical fiber transceiver module; the receiving end consists of the CAN bus driver PCA82C250, a signal codec, and an integrated optical fiber transceiver module. When a CAN node sends data to the bus, the transmit signal TX from the transmitting end bus controller SJA1000 is encoded by an encoder and then sent to the fiber optic transceiver module for electro-optical conversion. The signal is then transmitted via fiber optic cable to the receiving end RX. The receiving end fiber optic transceiver module first converts the received optical signal to electro-optical conversion, then the decoder restores the encoded signal. Finally, it connects to the bus via the bus driver PCA82C250 to complete the data transmission process. The data reception process is similar. 3. Photoelectric Conversion Encoder and Decoder Design 3.1 Requirements of the CAN Bus Arbitration Mechanism for the Encoding and Decoding Scheme The principle of the non-destructive bus arbitration mechanism of the CAN bus is as follows: when the bus is idle, any unit can send a message; if two or more nodes start sending messages simultaneously, a bus conflict will occur. For bus access conflicts, bit-by-bit arbitration can be performed using the identifier ID. During arbitration, each transmitter compares the transmitted bit level with the level detected on the bus: if they are equal, the node continues to transmit; if they are not equal, it indicates that the node has lost arbitration and stops sending messages. Only the node with the highest bus access priority continues to send messages. Other nodes with lower priority lose arbitration and actively stop sending messages. Message transmission can only resume when the bus is idle. Therefore, a CAN node must listen to the data on the bus to see if it matches the transmitted data for each bit of data it sends. Without considering signal attenuation during transmission through optical fiber and the limitations of the CAN node itself, to ensure normal CAN bus communication, the signal delay must not exceed the allowable value of the CAN bus. This is mainly determined by the bit timing and synchronization functions of the CAN bus physical layer. The bit time of the CAN bus is defined as the duration of one bit. One bit time can be divided into four non-overlapping time segments: the synchronization segment (SYNC_SEG), the propagation segment (PROP_SEG), phase buffer segment 1 (PHASE_SEG1), and phase buffer segment 2 (PHASE_SEG2). The CAN bus consists of several segments: a synchronization segment for synchronizing different nodes on the bus (requiring a transition edge); a propagation segment for compensating for physical delays within the network (including signal propagation time on the bus and internal node delays); and phase buffer segments 1 and 2 for compensating for edge-phase errors. Since the clocks of different nodes on the CAN bus may be inconsistent, resynchronization is necessary. Resynchronization causes phase buffer segment 1 to lengthen or phase buffer segment 2 to shorten, and the internal bit timing restarts from the synchronization segment. The sampling point is located at the end of phase buffer segment 1; at the sampling point, the CAN node reads the bus level. Bus timing can be optimized by programming the sampling point position. In summary, assuming the signal transmission time in the optical fiber is t<sub>transmission</sub>, the delay caused by photoelectric conversion during signal transmission is t<sub>photoelectric delay</sub>, and the CAN node synchronization and internal delay is t<sub>internal delay</sub>, then the following relationship should be satisfied: t<sub>transmission</sub> + t<sub>photoelectric delay</sub> + t<sub>internal delay</sub>. In this formula, for a given length and baud rate, the optical fiber transmission time and the node's internal delay time are fixed. Therefore, the photoelectric conversion delay time should be minimized, which places special requirements on the CAN signal encoding and decoding algorithm, requiring the encoding and decoding delay time to be minimized. 3.2 Encoding and Decoding Schemes Commonly used signal encoding methods in optical fiber transmission include CMI codes, scrambling codes, and 8B/10B codes. Although these encodings can provide rich clock information, the priority-based non-destructive CSMA arbitration of the CAN bus dictates that the signal delay after encoding and decoding should be as small as possible. A 1B/16B encoding method is proposed, and the encoding and decoding rules are as follows: (1) Encoding rules: Logic "1"——1110101010101010 Logic "0"——0001010101010101 Specifically, each bit of the bitstream to be encoded is sampled at a clock frequency that is 16 times the baud rate of the bitstream to be encoded. Each bit is sampled 16 times, and then encoded according to the agreed encoding rules. In this way, one bit of the original bitstream is encoded into a new 16-bit transmission. The length of each bit is 1/16 of the original bit time, while the total bit time remains unchanged. The encoded signal will not have long consecutive "1"s or consecutive "0"s (the longest consecutive "1"s or consecutive "0"s is 4 bits). (2) Decoding rules: Logic "1" - sample 3 consecutive "1"s; Logic "0" - sample 3 consecutive "0"s. Specifically, the encoded signal is sampled using a clock frequency that is 3 times the baud rate of the encoded bitstream (i.e., each bit is sampled 3 times, and the result of the sampling is taken as the result of the sampling if 2 or more of the same bits are obtained). If 3 consecutive "1"s are obtained, the decoding output is "1"; if 3 consecutive "0"s are obtained, the decoding output is "0". From the 1B/16B encoding and decoding method, it can be seen that after encoding, there are no long-term signals with the same level in the CAN signal stream, and there are abundant transition edges for the clock extraction circuit to capture the signal frequency; during decoding, the characteristic code in the encoded signal stream is used, that is, 3 or more consecutive signals with the same level. The decoding result is obtained by sampling 3 consecutive "1"s or 3 "0"s. In fact, with this encoding and decoding method, after one bit is encoded into 16 bits, only the first 3 bits are useful information, and the rest are redundant codes; however, this can shorten the encoding and decoding delay time to meet the requirements of the CAN bus arbitration characteristics. 3.3 Implementation of Encoder and Decoder This design uses programmable logic devices to implement signal encoding and decoding, specifically Altera's FLEX10K10 series FPGA; the software development platform used is Quartus II 5.0 and Modelsim SE5.8 (a third-party simulation tool); the development language used is the hardware description language VHDL. The hardware logic structure of the encoder and decoder is shown in Figure 5. The waveform simulation results of the logic function are shown in Figure 6. 4 Experimental Verification The correctness of the CAN fiber optic transmission interface was verified through communication experiments between two CAN nodes. The experimental platform structure is shown in Figure 7. The CAN communication node uses fiber optic media to communicate with the USB-CAN communication node, and the communication status is displayed on the PC. Transmit and receive experiments were conducted on the two nodes at various baud rates on the CAN bus, and the results proved that the CAN fiber optic transmission interface principle is correct and feasible. The measured delay time (t<sub>photoelectric delay</sub>) of signal encoding, decoding, and photoelectric conversion is shown in Table 1. 5. Improvement of CAN Bus Communication Performance by Using Optical Fiber Based on the experimental data obtained from the photoelectric conversion experiment, we will briefly discuss the improvement in CAN bus communication performance when optical fiber is used instead of twisted pair as the communication medium. At a given baud rate, the maximum transmission distance L of optical fiber and the signal transmission time t in the optical fiber satisfy the following relationship: L = V<sub>fiber</sub> × t<sub>transmission</sub> Where: V<sub>fiber</sub> is the propagation speed of the signal in the optical fiber. The propagation speed of electromagnetic waves in a medium is V = C/n (C is the speed of light, n is the refractive index of the medium). The propagation speed of light in optical fiber is approximately 260 m/μs, while the propagation speed of electromagnetic waves in twisted pair is approximately 200 m/μs. Taking t<sub>internal delay</sub> = 0.4 × t<sub>bit time</sub>, we can estimate the maximum distance of the CAN bus when using optical fiber transmission, as shown in Table 2. Using optical fiber as the transmission medium can increase the maximum transmission distance of the CAN bus by approximately 40%. As shown in Table 2, due to the low communication rate of the CAN bus and its non-destructive bus arbitration, the increase in transmission distance using optical fiber as the transmission medium is not very significant, failing to fully utilize the advantages of optical fiber's high capacity and long distance transmission. However, the use of optical fiber still has enormous potential: ① Because the spectrum of general electromagnetic radiation is far removed from the spectrum of light waves, it will not superimpose on or mix with the optical signal, and it is difficult for it to enter the optical fiber core and affect the transmission of the optical signal. Therefore, optical fiber communication systems are particularly suitable for use in areas or occasions with strong electromagnetic interference, such as communication systems in power systems and electrified railways. ② Because the main material of optical fiber is silicon dioxide, it has stronger resistance to chemical corrosion and oxidation than copper-based cables, meaning that optical fiber has good chemical stability and a long lifespan, making it particularly suitable for use in corrosive areas (such as chemical plants). ③ Optical fiber is small in size and light in weight; therefore, optical fiber communication systems are particularly suitable for use in places with limited space, such as ships, aircraft, vehicles, rockets, and missiles. This is of great significance in national defense and military applications. Conclusion The CAN bus is increasingly widely used and can adapt to increasingly complex environments, especially in applications with strong interference, long distances, uneven geographical distribution, and harsh working environments. Traditional twisted-pair cables can no longer meet the needs. Using fiber optic media not only solves these problems but also brings greater flexibility to CAN bus applications. A key point in realizing fiber optic transmission is the design of the fiber optic transmission interface. This paper proposes an interface scheme based on a fiber optic transceiver module and its implementation. The correctness of the design is verified through experiments. This has certain practical value for using fiber optic transmission in low-speed fieldbuses such as CAN bus.