Serial communication protocol---HART protocol

In practical applications, the HART protocol is the standard closest to a unified field bus after the Modbus protocol. It mainly superimposes digital signals on top of 4~20mA current signals. The physical layer uses Bell 202 standard FSK technology to successfully implement analog signals and digital signals. Two-way simultaneous communication without mutual interference. The HART protocol specifies the physical form of transmission, message structure, data structure and a series of operating instructions. It is a master-slave protocol that allows the existence of two hosts in the system (one for system control and the other for HART communication handheld devices). ), up to 15 slave devices can be connected on a pair of cables.


HART protocol, namely ==Highway Addressable Remote Transducer Protocol ==, addressable remote sensor highway protocol, superimposes FSK digital signal on 4~20mA analog signal, and can transmit analog signal and digital signal.

HART loads the 1200 b/s FSK (Frequency Shift Keying, Frequency Shift Keying) signal on the 4~20 mA analog signal for communication. Its mean value is 0, and this FSK signal has no impact on the analog signal. In purely digital communication, HART allows up to 15 field devices to be loaded. The HART protocol makes special provisions for receiver and transmitter sensitivity in order to continue communication despite signal degradation, which also reduces the possibility of interference and inter-symbol crosstalk.

One of the distinguishing features of the HART protocol is that it allows for simultaneous analog and digital communication. For many years, the field communication standard used by devices has been analog current signals of 4-20 mA. In most applications, they use values ​​between 4 and 20 mA to represent measured parameters such as temperature and pressure. The HART protocol is not only in the transmission processMeasurement parameters, and also uses digital signals superimposed on analog signals to transmitcontrol information. In this way, the HART protocol can support most smart devices and a large number of existing analog devices.

In FSK frequency shift keying technology, logic 1 is represented by 1200HZ frequency, logic 0 is represented by 2200HZ frequency, and the message transmission rate is 1200b/s.


The HART communication structure model
is based on ISO's open interconnection model and is divided into three layers, corresponding to the application layer, data link layer and physical layer of OSI.

Insert image description here
HART communication structure model

OSI layers HART level
Application layer HART command
data link layer Protocol specifications
physical layer BELL 202

HART protocol physical layer

The Bell 202 communication standard was originally a standard for digital communication over telephone lines. It used telephone lines to transmit digital signals, which is the communication protocol used by fax machines. Although the modulation/demodulation of the HART signal also adopts the same Bell 202 standard as the fax machine, the regulations on impedance and signal level of HART are different from those of the fax machine, especially the 4 mA low power consumption requirement of HART. Modulation/demodulation of HART signals requires the use of specialized modulator/demodulator chips to meet these special performance requirements.

The HART protocol stipulates that the master device (single master device control system or handheld communication system) transmits a voltage signal, while the slave device transmits a current signal. The usual two-wire transmission is used to control the current of the loop, sample it through some control systems, and perform analog/digital signal conversion. This conversion requirement cannot affect the existing HART signal.


HART protocol data link layer
The purpose of the data link layer protocol specification is to establish a reliable two-way data communication channel with slave devices such as field instruments.

The data link layer specifies the format of the HART protocol, and the addressable range is 0-15. When the address is 0, it is in 20mA and digital signal point-to-point mode. A specific serial communication is used between the field instrument and two digital communication masters (also known as communicators or masters), which include a PC or control system and a handheld communicator. In the single-point mode, the main variable (process variable) can be output in analog form or read out in digital communication mode, and the polling address is always 0 when read out in digital mode. In other words, in single-point mode, the digital signal and the 4~20 mA analog signal are valid at the same time.

HART protocol frames can also be communicated in an all-digital manner over a twisted pair. When the address is 1-15, it is in full digital communication state and works in point-to-multipoint mode. A link can support 15 short-address slave devices. If a long address is used, the number of devices can be unlimited, it only depends on the required query rate on the communication link. The communication modes include question and answer mode and burst mode (point-to-point, automatic and continuous sending of information). The data update rate when working in question-and-answer mode is 2-3 times. The data update rate when working in burst mode is 3-4 times/s.

When the full digital mode or multi-point mode is adopted, the 4~20 mA analog output signal is no longer valid (the power consumption of the output device is the smallest at 4 m, mainly for the power supply of the transmitter, and each field device is connected in parallel), the system uses digital The communication method sequentially reads the measured values ​​(or other data) of multiple field instruments connected in parallel on a pair of transmission lines. If the control system is constructed in this way, it can significantly reduce the cost of field wiring and reduce the input interface circuit of the main equipment, which is of great value to the control system. The HART protocol adopts an automatic repeat request sending mechanism based on redundant error detection code information. The data error caused by line noise or its "interference" is eliminated, and the error-free transmission of data can be realized.

The HART protocol divides all devices into 3 categories: slave devices, burst mode devices and master devices. The slave device is the most common and basic type of device. It receives and provides digital signals with measured values ​​or other data. Field smart instruments are generally slave devices. A burst-mode device responds by sending out a digital signal at regular intervals with measurements or other data that does not contain specifically requested data, usually as a stand-alone broadcast device. The master device is responsible for initiating, controlling and terminating interactions with slave or burst mode devices. The master device can be divided into the first master device and the second master device. The first master device usually refers to the control system, and the second master device refers to the handheld device of the HART protocol.


HART Protocol Application Layer
The application layer of the HART protocol provides a programming interface in the form of commands, and all read and write operations are completed in the form of commands. In addition, some functions of the protocol itself such as link management are also implemented by commands.

During communication, a command is assembled into a complete HART protocol frame according to the command format, and then sent out at once. The data link layer specifies the HART format, but the data link layer does not interpret the meaning of the data segments in HART. This work is performed by The application layer of the HART protocol is implemented. The application layer specifies three types of commands in the HART message package: the first is a general command, which is applicable to all products that comply with the HART protocol and provides functional descriptions for devices that comply with the HART protocol. The second type is a common command that is suitable for devices that comply with the HART protocol. For most products, when the device has certain functions, this command is used to describe these functions; the third category is special commands, which are suitable for special products that comply with the HART protocol and provide some special function description commands. For products with special functions produced by manufacturers, HART also provides Device Description Language (DDL) to ensure interoperability.


Functional relationship between layers
The basic task of the physical layer is to provide qualified physical signal waveforms for data transmission, and directly connect with the transmission medium. As an electrical interface, the physical layer receives information from the data link layer, converts it into physical signals and transmits them to the transmission medium of the field bus, and plays the role of a sending driver; on the other hand, it converts the information from the bus transmission medium The physical signal is converted into information and sent to the data link layer, which plays the role of a receiver. When it receives data information from the data link layer, it needs to add preambles and delimiters to the data in accordance with the HART protocol specifications. etc., and encode data on it, and then transmit the generated physical signal to the transmission medium of the bus through the sending driver. On the other hand, it receives physical signals from other devices from the bus, removes the preamble and delimiter and decodes them, and sends the data information to the data link layer. The data link layer specifies the interface between the physical layer and the application layer. This layer also controls access to the transmission medium, deciding whether and when it can be accessed.


HART message frame structure

The RS-232 serial communication protocol is a protocol for transmitting one byte (Byte), while Modbus is a protocol for continuously transmitting multiple bytes at a time through the serial port. HART is another protocol that uses a serial port to continuously transmit multiple bytes at a time. A HART includes multiple bytes, and a byte includes multiple bits (Bit). A byte of serial communication generally contains 11 bits: 1 start bit, 8 data bits, 1 odd/even parity bit and 1 stop bit. The HART protocol borrows the byte definition of serial communication, that is, 1 byte uses 11 bits, and the baud rate is 1200 b/s (slower)。

Insert image description here
The general HART structure includes preamble (preamble) byte, start byte, address byte, command byte, byte count, status byte, data byte and check byte, etc. Each part consists of multiple bytes, each byte has 11 bits.


Usually, the HART protocol communicates
in the master-slave mode. The communication is initiated by the master device, and the slave device first "listens" and then "answers". The first master device and the second master device access the communication link in turn with the same priority, but Different timing time constants are set to prevent "deadlock" and prevent two master devices from accessing the link at the same time. When a master device finishes communicating, it needs to listen to the carrier first, and wait for a period of time to ensure that another master device can access the communication link. If there is a carrier on the communication link, the master device will give up using the communication link; After the time expires, the master device can continue to access the communication link. When there is a burst mode device on the communication link, the master device can access the communication link only after the burst communication between the burst mode device and another master device ends. The HART protocol uses the burst function as an optional feature of field instruments.


HART operating commands
HART protocol operating commands can be divided into three categories: general commands, ordinary commands and special commands. Among them, common commands and ordinary commands are collectively referred to as standard commands.
Common commands

  • Read out the manufacturer and product model:
  • Read out the main variable and unit;
  • Read output current and its percentage:
  • Read up to 4 predefined dynamic variable names;
  • Read or write the 8-character tag number, 16-character description and date, etc.;
  • Read or write information of 32 characters;
  • Read out the range, unit and damping time constant of the transmitter;
  • Read out the number of sensors connected in series and their limitations;
  • Read or write the last assembly number;
  • Write polling address, etc.

Ordinary commands

  • Read up to 4 dynamic variables;
  • Write damping time constant;
  • Write the transmitter range;
  • Calibration (set zero point and span);
  • Complete self-test;
  • Complete master device reset;
  • Micro D/A converter main variable zero point;
  • Write the main variable unit;
  • Micro D/A converter zero and gain;
  • Write the transmission type (square root/linear);
  • Write the number of sensors in series;
  • Read or write dynamic variable assignment, etc.

special command

  • linear calibration;
  • temperature calibration;
  • Read or write the square root small signal cutoff value;
  • Start, stop or clear the accumulator;
  • Select the main variable (mass, flow or density);
  • Read/write configuration information;
  • Fine-tune sensor calibration, etc.

Next time I will study RS-485

Guess you like

Origin blog.csdn.net/Wangwenshuaicsdn/article/details/129959993