Application of the hottest can bus in locomotive m

2022-10-22
  • Detail

Application of CAN bus in locomotive monitoring system

[Abstract] Taking SJA1000 of Philips company as an example, this paper introduces the characteristics of CAN field bus, the function and structure of controller and the basic content of CAN2.0B bus protocol, and expounds a locomotive monitoring system based on CAN bus, its system performance requirements, system hardware construction, software design ideas and application results, This paper explains the advantages of CAN bus and a general design process for industrial field control system

Keywords: can, fieldbus, SJA1000 initialization, locomotive monitoring system, signal detection, local area

1 introduction

for a solid locomotive monitoring system for train work, the rapidity, accuracy, reliability and flexibility of data measurement/transmission are of great importance. The previous locomotive data monitoring only provided the display and alarm of on-site data, and intelligent instruments were added to each equipment, which was relatively scattered, making it inconvenient to observe the locomotive operation and carry out timely maintenance, and the locomotive operation data could not be saved, and these data were an important basis for identifying the causes of locomotive faults and maintenance; Various operations of intelligent instruments, such as zero adjustment, limit value and accuracy, affect the display and alarm functions of simple instruments due to environmental and human factors. In addition, the poor working environment (high temperature, vibration, electromagnetic radiation, etc.) leads to poor timeliness and accuracy. With the development of domestic fieldbus technology, it is necessary to update the original detection system in time

the locomotive monitoring system itself has dozens of data acquisition nodes (using single-chip microcomputer AT89C51), and an upper industrial computer is responsible for data storage and recording. Due to the large number of acquisition points and high acquisition frequency (20Hz), the data on the bus is usually crowded, and the system has particularly high requirements for the accuracy of data transmission and the real-time of alarm data. In view of this, we choose CAN Fieldbus to build a data platform, It has the advantages of flexibility, real-time, accuracy and reliability

can is the abbreviation of controller area net. It is a serial communication protocol developed by German Benz Automobile Company in the 1980s. It is mainly used for data communication between multiple control devices and multiple instruments and meters in the automobile. The link layer adopts CAN2.0B protocol. Now, it has been widely used in various industrial sites, especially for optimization, analysis and maintenance systems. In the 1990s, China began to study the application of CAN bus. At present, can bus technology has been applied in many fields

this system is a local area built according to CAN2.0B. The bus controller adopts SJA1000 of Philips company in Germany, and the driver is its matching PCA82C250. The lower computer and the upper computer communicate in both directions through canh and canl twisted pair. The whole hardware structure of this system can be used as a standard node of can network to form a tree network, which is the minimum composition and typical application of CAN bus system

2 introduction to the characteristics of CAN bus

the biggest feature of CAN bus is that each node in the network works in a multi master mode, and each node can send information to other nodes point-to-point and point to multipoint at any time, regardless of master and slave, with good flexibility

the data transmitted simultaneously on the CAN bus adopts non-destructive arbitration. The data with small ID is transmitted first, and the data with low priority is sent late, which is very effective for the network with heavy load to solve network paralysis, network congestion and improve efficiency

can also has strong verification function, and the wrong data is automatically re sent, with high reliability

in addition, twisted pair is selected as the can communication medium, and the on-site space of the locomotive is narrow, so the on-site wiring, installation and disassembly of twisted pair are relatively simple. The maximum communication distance is 10km, and the bit rate can reach 1Mbps (when the communication distance is large, the bit rate will be reduced), and 16 messages can be transmitted at the same time. The working temperature range of SJA1000 of Philips company is - 40 ℃ ~ + 125 ℃, and the storage temperature range is - 65 ℃ ~ + 150 ℃

for the sja10000 can controller selected by the system, its functional modules mainly include: interface managementlogic, receive FIFO stack, acceptance filter, transmit buffer and can core block, The structure is shown in Figure 1 (see the information of Philips Semiconductors: applicationnote - SJA1000 stand alone can controlleran970761997)

the interface management logic mainly deals with the signal exchange with the microcontroller, and reads and writes data with the microcontroller through control signals such as CS, ale/as, RD, WR, int, etc. The can core module is the executive part of CAN2.0B

the receiving filter receives the data converted by the can core module, and filters the data through the acceptance code register (ACR) and the acceptance maskregister (AMR). Only the data that meets the ID requirements can be received. ACR provides the local ID, and AMR provides the significant bit information during ID filtering. The receive FIFO stack is used to temporarily store the received data filtered by the filter

the transmission buffer (TB) stores the data to be sent, and the can core module reads from the transmission buffer and sends the data according to CAN2.0B protocol

3 system functions and hardware implementation

in addition to the functions provided by the conventional system, this system also has the functions of adjustable module priority (ID adjustable), adjustable alarm limit, and the storage of alarm historical data

the working site is composed of several analog instruments and some switching signals. Each instrument is equipped with a data acquisition board, and the acquisition of switching values is completed by a separate module similar to the analog acquisition board. The lower computer adopts AT89C51 micro single chip microcomputer of ATMEL company, which is mainly used to collect communication data, make simple judgment and prepare for data transmission; The communication part is composed of bus controller SJA1000 and its supporting driver PCA82C250, which can complete all the work of data link layer and physical layer; In addition, the upper industrial control computer, with a 5m byte flash memory E2PROM, can provide 100000 erasures and a 10-year data storage period to store the data of 1min before and after the alarm of each acquisition module. After the end of each operation cycle of the locomotive, the data in E2PROM will be exported for future performance analysis; The monitoring alarm module is used for real-time data display and alarm. In order to prevent the bottleneck phenomenon of the upper computer, the alarm tasks of each module are distributed to the lower computer to complete, and sending data to the upper computer only needs to reset the position of the alarm flag; The bus terminal is connected with a resistance of 100 Ω ~ 120 Ω to suppress signal reflection and ensure communication reliability. Twisted pair wire connects each module node to form a local area of multi master control. In addition, in order to prevent the unexpected operation of the system, X25045 (the peripheral device of American XICOR company, which integrates the three functions of watchdog, reset controller and CMOS serial E2PROM array with block lock) is added as a watchdog. 4KB SPI (serial peripheral interface) E2PROM can store some important data such as the alarm limit of this node, such as Zhang Kejian, deputy director of the Bureau of science, technology and industry for national defense. The system topology is shown in Figure 2

4 data communication of upper/lower computers

sja1000 supports CAN2.0B standard protocol, and has two working modes: basiccan and Pelican. This system adopts basiccan

each AT89C51 single chip microcomputer actively sends data to the upper computer every 0.05s, and the CPU of the lower computer is not too busy compared with the upper computer. Therefore, in order to prevent the error alarm caused by the external interference signal, the lower computer digitally filters the data before sending the data: 0.05s is divided into five times of collection, and the average value is sent, so as to avoid the false alarm of the instantaneous high-frequency interference signal

the data sent by the upper industrial control computer to the lower computer is generally a command for a lower computer, and the lower MCU receives the data with an external interrupt INT0. The upper computer monitors all the lower microcontrollers at all times, and the lower computer also monitors the upper computer at all times to receive commands sent to itself

when SJA1000 receives data in the basiccan working mode, it is loaded into the filter first, and the sequence is as follows:

among them, after the high eight digit receiving AMR code of ID is shielded, it is compared with the eight digit receiving code of ACR, and if it meets the requirements, it is transmitted to the receiving FIFO, otherwise it will not be received. Since the smaller the ID in CAN2.0B protocol, the higher the priority is, the highest ID ID10 can be set as the flag of alarm data (this bit is zero when the data exceeds the limit), so as to ensure that the module data with alarm is transmitted first. For the upper computer, to receive all the data of the lower single-chip microcomputer, the upper eight bits of the ID should be shielded, and the lower three bits Id2 ~ id0 are used as the flag bits for the upper industrial control computer to send commands to the lower single-chip microcomputer (such as modifying the alarm limit value, etc.). Therefore, during the system operation, the limit values of each module can be adjusted by the upper computer sending commands

when sending data, the lower computer first reads the limit value from the register to judge whether it is over limit. If it is over limit, ID10 is set to 0, otherwise it is set to 1. Then fill in the ID number of this module in id9 ~ ID3, and set the sending command bit to the low result level. After that, the MCU will not participate in the data sending process, and other work will be completed by SJA1000 and PCA82C250. Because the ID can also determine the priority of data, when the MCU is reset, it always reads the external 8-bit toggle switch from the P2 port as the ID, so that the priority of each module can be changed artificially, which enhances the flexibility of the system

at89c51 sends data to the upper computer in the main program, receives the command of the upper computer in the 0 # external interrupt program, and uses the lower three bits of ID to judge the meaning of the agreed command, which is not described in detail here. Only the initialization program flow of the main program and SJA1000 is given, in which, at the beginning of each main program, in order to prevent all the lower computers from being reset due to the time, acquisition cycle The software is consistent, which leads to uneven load on the bus, and the workload of the upper computer is sometimes a big problem. The main program specially arranges different time delays for each lower computer reset, so that the time when each module sends data can be evenly distributed

after receiving the data, the upper computer first checks the alarm flag bit to determine whether there is an alarm. If so, write the data in the register for the first minute and the corresponding time to E2PROM, and continue to write the received real-time alarm data until one minute after the alarm stops. Otherwise, add the current time to the data and store it in the register in a queue. When the register is full, the oldest data will be brushed out

the monitoring alarm module receives data as the upper industrial computer, but each instrument module corresponds to an alarm device. N alarm devices display the over limit state of each instrument in real time, and there is another LCD screen that displays the real-time data of the alarm module, and the real-time data of the module with the smallest ID when there is no alarm

the above is the basic process and principle of communication between a separate lower acquisition module and the upper computer. The whole system is composed of several relatively independent and similar lower modules and an upper computer, and there is no communication between the lower computers temporarily

5 conclusion

this system is developed for a company in Xi'an to improve the locomotive console. After testing, software debugging and trial operation (20 acquisition modules), it shows that the performance is stable, the fluctuation range of collected data is less than 0.05%, the data transmission rate is set to 125kbps during trial operation, there is no data loss, there is no data transmission error between the upper computer and the lower computer, and the maximum bit rate can reach 1MB

Copyright © 2011 JIN SHI