We have briefly introduced the HART protocol physical layer Specification Based on Software Design in the previous article. By understanding the OSI model and the knowledge about the HART protocol, we know that the specifications at the data link layer are still complex. Now let's take a look.
HART protocol data link layer Specification
1 device type
Communication protocols can identify three different types of devices. The most common and basic types are from devices that receive and provide digital signals with measured values or other data, except for specific requirements, that is, the device always acts as a slave device in the master-slave relationship. From equipment such as field instruments, pressure transmitters, temperature transmitters, actuators, etc.
The second type of device is the burst mode device, which sends a digital signal response with a measured value or other data at a fixed interval without containing the data specially requested, that is, the device is usually used as an independent broadcast device.
The third type of device is the master device. The master device is responsible for initializing, controlling, and terminating the interaction with the slave device or the burst mode device. The primary device is divided into the primary device and the secondary master device to use the two primary devices at the same time on the HART communication link, the same Protocol rules must be used for primary and secondary primary devices in addition to the time limit for separating them. The primary device usually refers to the upper PC, and the secondary master device refers to the hand operator of the HART device.
2 frame format
The sender of each frame can be divided into master-slave frames and master-slave frames. The frame length can be divided into long frames and short frames. Note: Each lattice represents one byte, and the highest and lowest bits in each byte are in the order from left to right.
① Preambles)
All frames sent from the master device, slave device, or burst mode have a specific number of hexadecimal "FF" characters before them. These characters are called the first character of a frame. Some physical layer protocols require them to act on modem circuits. There may be multiple pioneer characters before the delimiters, but the Protocol stipulates that only the delimiters after two consecutive delimiters mark the beginning of a frame.
② Delimiter)
The lower three bits of this field indicate different frame types. The highest bits indicate whether the frame is a long frame or a short frame, and the remaining bits are retained.
③ Addressing
Each HART frame requires an address field to indicate its source and destination addresses.
1) long frame format address: it is actually the unique identifier of each slave device. The lowest 38 BITs except the maximum two bits indicate this unique identifier. The highest bit indicates the master device associated with the frame. The Level 1 primary device is "1", and the Level 2 primary device is "0 ". The slave device must return this field unchanged. Indicates whether the slave device is in BURST mode. If yes, this bit is "1"; otherwise, it is "0 ".
2) Short frame format address: only the 0 short frame command supports the short frame address. This address specifies the network address between the host and the on-site device. When the link is initialized, the short frame No. 0 command returns the unique identifier of all on-site devices connected to the specified network, that is, the network port address of these devices.
④ Command domain
Only one byte indicates the HART command number encapsulated by the frame. The byte value of the command returned from the device should be the same as the command number in the frame sent by the master device.
⑤ Data bytecode Field
Only one byte indicates the number of data bytes between this byte and the last verification byte of a frame.
⑥ Data domain
In a master-slave frame, this domain stores user request data for the device. That is, to obtain the return value of the slave device, you must set the value of the slave device.
In the slave-master long frame, this domain stores the data returned by the on-site device in response to the host computer of the master device.
7. Verify byte
This byte is used to store results of radial Longitudinal Parity verification for all bytes in the frame excluding this byte. In HART communication, the transmitted information is verified on two dimensions.
1) The radial check value is the result obtained after the bitwise XOR of all bytes;
2) Vertical Parity) value is the result of hardware's automatic Parity check on all bits of each byte during communication. That is, the odd parity bit in the data stream format specified in the previously mentioned HART protocol physical layer specification.
Response code segment
This field contains 2 bytes and only appears in the master-long frame. It specifies the HART communication status. If the highest BIT7 value of the first byte of the response code is 1, the communication between the master and slave devices is incorrect. The rest of the byte lists the summary of the communication errors. When BIT7 is 0, the rest of the bytes provide a summary of the response of the field device to the command corresponding to the frame.
The 2nd bytes of the response code indicate the working status of the on-site device. This byte is valid only when BIT7 of the first byte of the response code is 0, that is, there is no communication error.