Development of PROFIBUS-DP technology and communication conversion interface
2026-04-06 04:46:32··#1
Abstract: Addressing the challenge of communication conversion between different devices in industrial control, this paper details the software and hardware methods for implementing a PROFIBUS-DP communication conversion interface using the SPC3 communication protocol chip, taking into account the characteristics of PROFIBUS-DP fieldbus technology. This interface allows instruments and devices with RS485 interfaces to be connected to the PROFIBUS-DP network, enabling communication and control functions. Keywords: PROFIBUS-DP; Communication protocol chip SPC3; Interface Abstract: In view of the communication transformation problem in industrial control and the characteristics of the PROFIBUS-DP fieldbus technology, the design method of the hardware and software of the PROFIBUS-DP communication transformation interface with SPC3 is introduced. Through this transformation interface, the conventional instrumentation with RS485 interface can be connected to PROFIBUS-DP and carry out communication and control functions. Key words: PROFIBUS-DP; Communication protocol chip SPC3; Interface 1 Introduction PROFIBUS-DP is currently the most widely used bus system in Europe and even globally. It is easy to install, has diverse topologies, is easy to implement redundancy, provides real-time and reliable communication, and has relatively complete functions. Its excellent performance makes it suitable for various industrial automation fields. With the increasingly widespread application of PROFIBUS-DP control systems in China, connecting existing equipment that does not conform to the DP standard to the PROFIBUS-DP fieldbus network requires the development of a DP communication conversion interface. Therefore, the development of a DP communication conversion interface is very necessary. This article mainly discusses the hardware and software for implementing the DP communication conversion interface using the SPC3 communication protocol chip. 2 PROFIBUS-DP Fieldbus 2.1 Basic Characteristics of PROFIBUS-DP PROFIBUS-DP is used for high-speed data transmission at the field level. The central controller (such as a PLC/PC) communicates with distributed field devices (such as I/O, drives, valves, and measuring transmitters) via serial connection. The central controller (master station) periodically reads the input information from the slave stations and periodically sends output information to the slave stations. In addition to periodic data transmission, PROFIBUS-DP also provides non-periodic communication required by intelligent devices for configuration, diagnosis, and alarm processing. PROFIBUS-DP has advantages such as speed, plug-and-play, high efficiency, and low cost. 2.2 PROFIBUS-DP Bus Topology PROFIBUS-DP systems have two bus topologies: one is RS-485, using shielded twisted-pair cable, with a bus topology and a communication rate of 9.6Kbps to 12Mbps; the other uses fiber optics, used in applications with high electromagnetic compatibility requirements and long-distance requirements. 2.3 PROFIBUS-DP Bus Protocol The PROFIBUS-DP protocol is based on the ISO 7498 international standard and the Open Systems Interconnection (OSI) reference model. It adopts Layer 1 (Physical Layer), Layer 2 (Data Link Layer), and a user-defined user interface layer from the reference model. Layers 3 through 7 are not used. This streamlined structure ensures fast and efficient data transmission. The Physical Layer defines the physical transmission characteristics; the Data Link Layer defines the bus access protocol, and the Direct Data Link Mapping (DDLM) program provides access to Layer 2; the user interface specifies the application functions of PROFIBUS-DP devices, as well as the behavioral characteristics of various types of systems and devices. In the PROFIBUS-DP bus access protocol, token passing is used between masters, and a master-slave mechanism is used between masters and slaves. The token passing procedure ensures that each master obtains bus access rights (token) within a precisely defined time. In PROFIBUS, token passing only occurs between masters. When a master obtains a token, it can communicate with slaves, and each master can send or read information from slaves. Therefore, there are three system configurations: pure master-slave system, pure master-master system, and hybrid system. The system uses token passing and master-slave methods respectively to complete data communication. 3. Development of PROFIBUS-DP Communication Conversion Interface 3.1 Hardware Design There are two main methods in the design of the interface circuit: one is to use a microprocessor to simulate the PROFIBUS fieldbus protocol using software. This design is low-cost, but requires a thorough understanding of the PROFIBUS-DP protocol and its operating mechanism, involves a large amount of software programming work, is difficult to guarantee reliability, and limits communication speed. The second method is to use a dedicated PROFIBUS protocol chip ASIC. This design is more expensive, has higher technical specifications, and offers greater autonomy; it only requires understanding the working principle of the ASIC. In this communication interface design, the second method is used, employing an ASIC combined with a microprocessor. To make the PROFIBUS-DP interface simple and convenient to implement, and to achieve the goal of quickly providing products, Siemens' dedicated communication protocol chip SPC3 is used to implement the PROFIBUS-DP bus protocol. The SPC3 integrates the complete PROFIBUS-DP protocol, automatically detecting bus baud rates from 9.6Kbps to 12Mbps. It integrates 1.5KB of dual-port RAM, featuring address latching and chip select functions. Upon power-up, it automatically executes the PROFIBUS-DP slave state machine. The SPC3's internal 1.5KB dual-port RAM address space is 00H~5FFH, divided into 192 segments (0~191) of 8 bytes each. Functionally, the SPC3 can be divided into three areas: 00H to 15H is the processor parameter area, including the operating mode register, slave minimum latency register, internal watchdog timer register, interrupt registers, and status registers; 16H to 3FH is the organization parameter area, used to set the pointers (start addresses) and lengths of each buffer block (BUF) in the DP buffer, and these settings must be completed in the offline state of the SPC3; 40H to 5FFH is the DP buffer, which is the buffer for DP data, including 3 input data BUFs, 3 output data BUFs, 2 diagnostic BUFs, 2 auxiliary BUFs, setting parameter BUFs, communication interface configuration BUFs, and readable communication interface configuration BUFs. The SPC3 integrates a watchdog timer, operating in three different states: baud rate monitoring, baud rate control, and DP control. The internal asynchronous serial transceiver (UART) enables the conversion between serial and parallel data streams, the idle timer controls the timing on the serial bus cable, and the microsequencer (MS) controls the entire operation of the SPC3. The PROFIBUS-DP communication conversion interface uses the 89C52 microprocessor as the central processing unit, and the DP interface chip uses the SPC3. The 89C52 is responsible for processing, analyzing, and classifying the signals collected from the field, and then transmitting them to the PROFIBUS-DP bus through the SPC3. Simultaneously, it monitors the SPC3, receives instructions and data from the DP master station, and performs corresponding operations. The circuit structure diagram is shown in Figure 1. [align=center] Figure 1 Circuit Structure Diagram Figure 2 PROFIBUS-DP State Machine[/align] The 89C52 microprocessor expands the data memory (RAM) by 32KB. The clock signal is obtained by frequency division through the SPC3. The peripheral circuits also include a watchdog timer with EEPROM, analog-to-digital (A/D) conversion, digital-to-analog (D/A) conversion, DI/DO interface, and digital display circuitry. The EEPROM primarily stores configuration information such as slave station addresses and ID numbers; the digital display circuit mainly displays slave station information; and the analog-to-digital (A/D) converter, digital-to-analog (D/A) converter, and DI/DO interface enable the communication conversion interface to handle various tasks including AI, AO, DI, and DO. PROFIBUS-DP generally uses RS-485 transmission technology, employing shielded twisted-pair cables to improve electromagnetic compatibility, with a transmission rate of 9.6Kbps to 12Mbps. Connections use a 9-pin D-type connector conforming to the PROFIBUS-DP open standard. Without repeaters, each segment can connect 32 stations; with repeaters, this can be expanded to 127 stations, including repeater stations. When signals are transmitted on the bus, impedance discontinuities can cause signal reflection and distortion. Therefore, terminating resistors are needed at the ends of the transmission lines to eliminate these impedance discontinuities. The resistance value should be as close as possible to the characteristic impedance of the transmission line. To eliminate interference from the neutral line, an optocoupler must be added for isolation between the SPC3 and the RS-485 transceiver. To improve the transmission rate, a high-speed optocoupler RS-485 transceiver should be selected. This design uses the HCPL7720 high-speed optocoupler and the SN75ALS176 bus transceiver. 3.2 Software Design Software design is a crucial and challenging aspect of developing the PROFIBUS-DP communication conversion interface. Developers must understand the PROFIBUS-DP protocol, be familiar with the working principle and state machine principle of the SPC3 chip, and be well-versed in the various DP services of the SPC3. The PROFIBUS-DP state machine describes the behavior of the DP slave under each condition to ensure consistency. The SPC3 integrates the state machine internally, but user control over the state machine is limited. The PROFIBUS-DP state machine is shown in Figure 2. Each ellipse represents a different state, the arrowed lines indicate transitions between states, and the text on the lines indicates the conditions that must be met for the state transition. In the POWER_ON state, the slave station can receive the Set_Slave_Address message from the Class II master station to change its address. Then, the slave station enters the Wait_Prm state, waiting for parameterization. In this state, the slave station can also receive Get_Cfg and Slave_Diag messages. After parameterization is complete, the slave station enters the Wait_Cfg state, waiting for the Check_Cfg message. It can also receive Slave_Diag, Set_Prm, and Get_Cfg messages. If Check_Cfg is successful, the slave station will enter the Data_Exch state for data communication. At this time, the slave station can also receive Writing_Outputs, Reading_Inputs, Gloable_Control, Slave_Diag, Chk_Diag, and Get_Cfg messages. If configuration and data exchange fail, it will return to the parameterization stage. When configuring the slave station in Wait_Prm, its GSD file must be written. The GSD file is the device database file, describing the performance characteristics of the PROFIBUS device. The GSD file consists of three parts: general description (vendor and device name, hardware and software version, supported baud rates, etc.), DP master device-related specifications (such as the maximum number of slave devices that can be connected or offloading capacity), and slave device-related specifications (such as the number and type of I/O channels, diagnostic test specifications, and I/O data consistency information). Standardized GSD data extends communication to the operator control level. Using GSD-based configuration tools, devices from different manufacturers can be integrated into a single bus system, which is simple and has a user-friendly interface. SPC3 integrates the complete PROFIBUS-DP protocol and can independently handle all communication tasks of the PROFIBUS-DP protocol, thus greatly reducing the microprocessor load and ensuring the system's communication speed and data exchange reliability. The microprocessor's main task is to transfer the output data received from the master station by SPC3 based on interrupts generated by SPC3, organize the data to be sent to the master station through SPC3, and organize external diagnostics as required. The PROFIBUS-DP communication service access point (SAP) is automatically established by SPC3, and various message information presented to the user is the internal data of different BUFs. Users can access this internal data through this bus interface. The main program flowchart is shown in Figure 3. SPC3 initialization includes setting enabled SPC3 interrupts, writing the slave identification number and address, setting the SPC3 mode register, setting the diagnostic buffer, parameter buffer, configuration buffer, address buffer, and initial length, and calculating pointers to each buffer and auxiliary buffer based on these initial values. The output buffer and pointer are determined based on the length of the transmitted data (the pointer value is the segment number when assigning values to the buffer pointer variables). The interrupt routine flowchart is shown in Figure 4, mainly used to process PRM, CFG, and SSA messages. The partial initialization program written in assembly language is as follows: MOV DPTR, #R_DIAG_BUF_PTR1 ; If SPC3 is offline, initialize SPC3 MOV A, #D_DIAG_BUF_PTR1 MOVX @DPTR, A ; Diagnostic buffer pointer INC DPTR MOV A, #D_DIAG_BUF_PTR2 MOVX @DPTR, A MOV DPTR, #R_CFG_BUF_PTR ; Configuration buffer pointer MOV A, #D_CFG_BUF_PTR MOVX @DPTR, A MOV DPTR, #R_READ_CFG_BUF_PTR [align=center] Figure 3 Main program flowchart Figure 4 Interrupt program flowchart[/align] 4 Conclusion PROFIBUS-DP has an open protocol, good real-time performance, fast data transmission speed, simple system implementation, and high reliability. It conforms to the trend of modern industrial network development and will surely be widely used in the future. The development of the PROFIBUS-DP communication conversion interface solves the communication conversion problem between different industrial control devices with RS-485 interfaces, improving the automation level of industrial control. Practical operation has proven the rationality of the hardware and software design of this communication conversion interface, ensuring the security, speed, and stability of data transmission. Using the scheme described in this paper, configuring the PROFIBUS-DP interface on self-developed field devices/instruments can well meet the needs of relevant industries and has broad application prospects in practice. The author's innovation lies in developing a PROFIBUS-DP communication conversion interface to address the difficulty of communication conversion between different devices in industrial control. This interface allows instruments and devices with RS-485 interfaces to be easily connected to the PROFIBUS-DP network, realizing communication and control functions. Practical operation has proven the rationality of the hardware and software design of this communication conversion interface, ensuring the security, speed, and stability of data transmission. This solves the communication conversion problem between different industrial control devices with RS-485 interfaces, improving the automation level of industrial control. References [1] Xia Jiqiang, Xing Chunxiang, Fieldbus Industrial Control Network Technology [M], Beijing University of Aeronautics and Astronautics Press, 2005. [2] Zhou Xiaohui, Meng Yanjing, Xu Deyu, Development of PROFIBUS-DP Fieldbus Communication Conversion Interface [J], Microcomputer Information, Vol. 21, No. 7-1, 2005, pp. 31-33. [3] SIEMENS SPC3 and DPS2 User Description [M], 2002. [4] PROFIBUS Development kits Manuals, SIEMENS, 1998.