Skip to content

PTL-D01-IoT Terminal Application Layer General Protocol V1.3 ​

1. Protocol Description ​

The purpose of this protocol is to establish an application layer communication standard for IoT terminals. The design of this protocol primarily considers future compatibility and scalability. The port rules and protocol specifications mentioned below may not all be used in a single project, but reserving the extension space and fields of the protocol reduces compatibility issues caused by a lack of specifications in the future.

2.1 Data Transfer Unit (DTU) ​

Data Transfer Unit (hereinafter referred to as DTU) refers to a device used for data forwarding. In this protocol, it refers to a device that reads water and electricity meters and other sensor data via RS-485 and then forwards it through a wireless network.

2.2 Terminal Device ​

Refers to the end collection device, such as electricity meters and water meters, which are all terminal devices. Some sensors come with wireless transmission functions, in which case the sensor has the attributes of a collection device.

2.3 Collection Device ​

A collection device refers to a device that communicates with a base station or gateway for data, such as a DTU. The DTU communicates with terminal devices to obtain sensor data from them and communicates with the platform through a wireless network.

2.4 Multi-Application Platform (MAP) ​

Multi-Application Platform (hereinafter referred to as MAP) communicates with the core network to achieve business layer data management, device management, parameter configuration, device firmware upgrades, and other functions.

2.5 Unconfirm Data Packet and Confirm Data Packet ​

LoRaWAN network layer concept. Both unconfirm and confirm data packets have a retransmission mechanism. When sending a confirm data packet, if the node does not receive an ACK from the server, it considers the transmission failed and retransmits. When the node receives an ACK, it considers the transmission successful. Unconfirm data packets do not require ACK confirmation. Both confirm and unconfirm data packets can set the number of retransmissions.

Data uplink refers to data sent from a terminal device or collection device to the MAP platform.
Data downlink refers to data sent from the MAP platform to a terminal device or collection device.

2.7 Port ​

LoRaWAN network layer concept. Each LoRaWAN data packet carries 1 byte of port attribute. Ports 0, 200-255 are reserved ports.

2.8 Manufacturer ID ​

Each vendor in the network has a unique ID. Each device has a unique serial number, which includes the manufacturer ID.

2.9 Device Model ​

The corresponding model of the collection device or terminal device.

2.10 Hardware Version Number ​

Refers to the hardware version number of the collection device or terminal device. When upgrading the device, it must correspond to the appropriate hardware version.

2.11 Operating System Version Number ​

Operating System Version Number (hereinafter referred to as OS Version Number) refers to the version number of the operating system of the embedded device, mainly used for device upgrade control.

2.12 Software Version Number ​

Software Version Number refers to the version number of the software in the embedded device. In this protocol, it refers to the software version number of the DTU.

3. LoRaWAN Network Parameter Configuration ​

When a terminal or DTU uses the LoRaWAN network as a communication method, it must meet the following network parameter requirements:

3.1 Port Allocation ​

LoRaWAN has 1-200 available application layer ports. This protocol ensures data type segmentation through ports and reserves its extensibility.

Port NumberFunction Description
11-20 (Uplink data, can be selected according to different data types, default is 11)Regular data reporting port
21-30 (Default 21)Encrypted data reporting port
31-40 (Uplink data, default 31)Threshold trigger port
41-50 (Default 41)Threshold trigger encrypted reporting port
51 (Uplink + Downlink data)Transparent transmission mode port
61 (Uplink data)DTU heartbeat reporting port
71 (Uplink + Downlink data)Parameter configuration and control port
81 (Uplink + Downlink)Firmware upgrade port

3.2 ADR Function ​

LoRaWAN nodes have an ADR function, which can adjust the communication rate according to the actual network environment to maximize network utilization. This protocol standard requires the node side to enable the local ADR function to automatically adjust the rate.

3.3 Time Synchronization Function ​

LoRaWAN has the function of synchronizing time with the Server side. This protocol requires node devices to achieve a local time deviation of <5 seconds/day. Time synchronization can use the LoRaWAN application layer standard function, or the deviceTimeReq MAC layer command can be used for time synchronization.

3.4 Data Type ​

For data that can tolerate packet loss, unconfirm data packets are used for uplink. For important data, confirm data packets are used.

3.5 Working Mode ​

For battery-powered devices, ClassA working mode is adopted. For always-on devices, ClassC working mode is adopted.

There are three data uplink methods: active reporting, event triggering, and passive polling.

  • For sensor data and heartbeat data, active reporting is performed periodically. After the device is powered on again, it actively collects and reports heartbeat data and sensor data once each, and then enters the normal collection and reporting cycle. Note that the DTU should adopt a random hash delay sending mechanism to ensure that a large number of devices do not cause congestion due to simultaneous data reporting when powered on at the same time.
  • For alarm data and other non-periodic data, uplink is performed by event triggering. Events can include threshold triggers or alarm information triggers.
  • For attribute information, passive polling can be performed or sent by heartbeat.

3.7 Default Parameters ​

  • The default number of unconfirm packets sent is 1.
  • The default number of retransmissions for confirm data packets is 5.
  • The ADR function is enabled by default.

4. Basic Data Format ​

4.1 Basic Format Definition ​

Version IdentifierControl WordData IdentifierData
1 byte1 byte1 byten byte

4.1.1 Version Identifier ​

The version identifier is 1 byte long and defines the communication protocol version.

bit 76:43:0
DescriptionVersion Identifier EnableRFU

Example: If the protocol version number is 2.0, the binary number for this field is 1000 0010, which is 0x82.

4.1.2 Control Word ​

The control word is 1 byte long and defines different functions of the message.

bit 7654
DescriptionMessage SourceOperation ModeInstruction Execution Result

Message Source: 0 message from device side (uplink), 1 message from control side (downlink).
Operation Mode: 0 control side reads device data, 1 control side writes data to device.
Instruction Execution Result: 0 instruction execution failed, 1 instruction execution successful.
Data Response Type: 0 no response data, 1 has response data.
Control Word Function: Used as industry identifier.

4.1.3 Data Identifier ​

The data identifier is 1 byte long and is used to identify the data format of the data segment. The DTU's data identifier inherits the definition from the coal-to-electricity project. In the future, DTUs will continue to use the general format in various scenarios.

TypeValue
Parameter0x01
Heartbeat0x03

4.1.4 No Response Data Format ​

Version IdentifierControl WordData IdentifierData
1 byte1 byte1 byten byte

4.1.4 Data Format with Response ​

Version IdentifierControl WordData IdentifierRegister Start AddressNumber of Operation Bytes
1 byte1 byte1 byte1 byte1 byte

4.1.5 Response Data Format ​

Version IdentifierControl WordData IdentifierRESULTRegister Start AddressNumber of Operation Bytes
1 byte1 byte1 byte1 byte1 byte1 byte

The response data is feedback to the data with response. [RESULT] is the execution result of sending data. [RESULT] = 0 means successful execution. If it is a read operation, it will carry [Start Address], [Number of Operation Bytes] and [Data] afterwards. If [RESULT] is not 0, the operation failed, [RESULT] shows the reason for failure, and [Data] content is empty. See Appendix "RESULT List" for failure reasons.

5. Parameter Modification ​

This chapter describes functions that only apply to ManThink LoRaWAN devices. LoRaWAN device parameters can be modified by sending commands through the LoRaWAN NS platform.

The premise for modifying device parameters through the NS platform is that the LoRaWAN device must be online, there must be a gateway nearby that can cover the device, and it must be connected to the NS platform.

For ClassA devices, the data to be modified can only be sent after an uplink data packet is received. For ClassC devices, configuration parameters can be sent through the LoRaWAN channel at any time.

5.1. Parameter Format ​

5.1.1. Port ​

Device parameter modification is done by sending data through LoRaWAN port 214. The device also replies to parameter modifications through port 214.

5.1.2. Device Reply ​

If the parameter modification is successful, the device will reply "[Function Code & 0x7F] 01 00" on port 214.
If the parameter modification fails, the device will reply with an error code.
If the device does not receive the sent parameters, there will be no reply message.

5.1.3. Command Format ​

5.1.3.1. Format Description ​
FunctionExampleBytesDescription
Function Code0xCF1The function code for modifying frequency points is 0xC2, and the function code for modifying business parameters is
Control Word0x041The control word for modifying frequency points is 0x2A, and the control word for modifying business parameters is
Start Address0x3D1According to the different addresses of the parameters, refer to the specific device manual
Byte Lengthn22 bytes length
Modification Contentnn bytes
5.1.3.2. Example ​

For example, to modify the heartbeat period:

Function Code = 0xCF, Control Word = 0x04, Start Address = 0x3D, Byte Length = 2 bytes, modification period is 08 07 (1800 minutes, refer to the specific device manual). Then the command to send is 0xCF043D020807 through port 214.

After successful modification, the device will reply 0x6F 01 00.

5.1.4. Special Command Description ​

The following commands are supported by ManThink devices. The commands for modifying frequency points are the same for all devices.

The heartbeat period commands SE72, RDI21, RDO21 are all supported. Other devices need to refer to their specific device manuals.

5.1.4.1. Modify Frequency Points ​

The method for modifying frequency points for all ManThink LoRaWAN devices is the same:

Function Code = 0xC2
Control Word = 0x2A

Its parameter addresses are as follows:

FunctionStart AddressExampleBytesDescription
channelMap60x00FF2Bit-wise enable frequency points, default is
Frequency Point 180x1C083560 (decimal 470300000)4Little-endian format;Unit: Hz
DRRange1120x521DR,DR5-DR2
Frequency Point 2130x1C0B42A1 (decimal 470500001)4Little-endian format;Unit: Hz
DRRange2170x521DR,DR5-DR2
Frequency Point 3180x1C0E4FE2 (decimal 470700002)4Little-endian format;Unit: Hz
DRRange3220x521DR,DR5-DR2
Frequency Point4230x1C115D23 (decimal 470900003)4Little-endian format;Unit: Hz
DRRange4270x521DR,DR5-DR2
Frequency Point5280x1C146A60 (decimal 471100000)4Little-endian format;Unit: Hz
DRRange5320x521DR,DR5-DR2
Frequency Point** **6330x1C1777A1 (decimal 471300001)4Little-endian format;Unit: Hz
DRRange6370x521DR,DR5-DR2
Frequency Point 7380x1C1A84E2 (decimal 471500002)4Little-endian format;Unit: Hz
DRRange7420x521DR,DR5-DR2
Frequency Point 8430x1C1D9223 (decimal 471700003)4Little-endian format;Unit: Hz
DRRange8470x521DR,DR5-DR2

As above, if you want to modify the values of 8 frequency points, send the command:

C2 2A 08 28 60 35 08 1C 52 A1 42 0B 1C 52 E2 4F 0E 1C 52 23 5D 11 1C 52 60 6A 14 1C 52 A1 77 17 1C 52 E2 84 1A 1C 52 23 92 1D 1C 52

  • Successful configuration will reply 0x620100.
5.1.4.2. Device Reset ​

Some parameter modifications require a device reset to take effect.

Function Code = 0xCF

Control Word = 0x03
Start Address = 0x09
Byte Length = 0x01
Content to write is 0x01

Sending 0xCF 03 09 01 01 through port 214 will reset the device.

Successful reset will reply 0x6F0100.

5.1.4.3. Heartbeat Period ​

Function Code = 0xCF
Control Word = 0x04
Start Address = 0x3A
Byte Length = 0x02, 2 bytes little-endian mode, unit is minutes

For example, to modify the period to 1800 minutes = 0x0708, the byte content should be sent as 0x0807. The command content to send should be 0xCF043A020807.

Modifying the heartbeat period separately requires a device reset to take effect.

Successful sending will reply 0x6F0100.

6. Transparent Data ​

Transparent data description:

  • DTU does not process data, it is completely forwarded to the platform or terminal.
  • Port number = 51
  • Sent as unconfirm packet.

7. Contact Us ​

Website: www.manthink.cn
Email: info@manthink.cn
Phone: +86-15810684257