Zigbee Lock
Last updated
Last updated
The Tuya Zigbee serial port general protocol is a Tuya customorize Zigbee module serial port general protocol, which is mainly used for Tuya Zigbee module, it directly connected to other MCU serial ports for serial communication. Its block diagram is shown in Figure 1 below.
The Tuya Zigbee module and MCU control both use DC 3.3V power supply.
The baud rate of UART communication between Tuya Zigbee module and MCU is 115200-8-N-1, and there is no data flow control. The UART interface pins use the standard logic. In the idle state, the TXD and RXD pins are both high level, the low level is the start bit and the high level is the stop bit. The pin stays high even even the device in hibernation.
There is a GPIO port reserved between the Tuya Zigbee module and the MCU, use as the module to wake up the MCU. The default setting is the internal pull-up state, which is effective when pulled down to 10ms. The MCU wakes up the Zigbee module by waking up the serial command. If the device is a strong current device, the MCU only needs to make a handshake connection when the device is powered on for the first time. If the device is a weak current device with dormant, apart from making a handshake connection when power on, the MCU needs to connect to the handshake connection before each active command is initiated.
UART respond timeout time:500ms.
When the serial port of the module receives the wake-up frame of the MCU or the response frame of the wake-up frame, it will wake itself up for 500ms. At this time, the MCU can send other data. If the data interval between the two frames is 500ms, a wake-up frame needs to be added in the middle.
After the module sends the wake-up frame, the MCU needs to respond within 20ms, otherwise the module will continue to resend it, twice each time. When the response frame of MCU is not received after 3 transmissions, the data to be transmitted will be stored in the transmission queue, and wait for the next wake up to send again.
The UART communication data frame between the Tuya Zigbee module and the MCU consists of the frame header (Front), version (Ver), serial number (Seq), command word (Cmd), data length (Length), data (Data) and checksum (Check) composition, definition and description are shown below. 2
Octets:2
1
2
1
2
Variable
1
Front
Ver
Seq
Cmd
Length
Data
Check
Field
description
Front frame(Front)
2 byte leading character, fixed to 0x55aa
Version (Ver)
Serial communication protocol version, for upgrading and expansion, the current version is 0x03
Serial number(Seq)
The serial number(1~0xfff0)
Command (Cmd)
The specific frame type, pls check sheet3
Data length(Length)
Transmitted effective data length
Data (Data)
Transmitted effective data
Revise (Check)
Data revise, byte-to-byte summation from the beginning of the frame, more than 256
Sheet 1:Frame format description
Note: The serial number (seq) is to check each frame. It is not necessary to use the same one. The range of seq is limited to (1 ~ 0xfff0). When the MCU needs to respond to the data sent by the module, the seq in the response frame uses the seq issued by the module. When the MCU needs to send data to the module actively, each time the data is issued, the seq needs to be incremented within the specified range.
Cmd ID
description
direction
0x00
Dormant wake up
(Zigbee<—>mcu)
Wake up response
(mcu<—>zigbee)
0x01
Product info check
(zigbee—>mcu)
Product info response
(mcu—>zigbee)
0x02
Zigbee status inquire
(mcu—>zigbee)
Zigbee status inquire response
(zigbee—>mcu)
0x03
Zigbee device reset
(mcu—>zigbee)
Zigbee device reset response
(zigbee—>mcu)
0x04
Data instruction issued
(zigbee—>mcu)
Data instruction issued response
(mcu—>zigbee)
0x05
Data report
(mcu—>zigbee)
Data report response
(zigbee—>mcu)
0x06
Zigbee status notice
(zigbee—>mcu)
0x07
Request dynamic password
(mcu—>zigbee)
Request a dynamic password response
(zigbee—>mcu)
0x23
Record-type status reporting Data format (including time stamp)
(mcu—>zigbee)
Response to data format for record-type status reporting
(zigbee—>mcu)
0x24
Mcu time synchronization request
(mcu—>zigbee)
Time synchronization request
(zigbee<—>mcu)
Sheet 2:Cmd description sheet
Description:
All data larger than 1 byte is transmitted in big-endian mode
In general, the command word one send and one receive synchronization mechanism is adopted, that is, one party sends a command and the other responds. If the sender does not receive the correct response packet after timeout, the transmission timeout
Note: The specific communication method is subject to the “detailed protocol”
The module control command is issued and the MCU status is reported in asynchronous mode. Assuming that the module control command is issued with the "command word" as x and the MCU status is reported with the "command word" as y, as shown below:
1) Module control command is issued:
2) MCU status report:
MCU status reporting is divided into two cases: passive reporting and active reporting;
I. Passive reporting: The module sends a data command to the MCU. The MCU responds to the control command first, and then executes the command. The MCU reports the final result to the module. After receiving the module, it sends a response and the data exchange ends.
II. Proactive reporting: MCU status changes (physical operation or restart after power cut, etc.), reporting the current status to the module actively; MCU actively reporting as asynchronous operation, there is no status report response frame received within the timeout period, or the status of the response frame is unsuccessful, MCU must retransmit.
1) datapoint The command / status data unit is as follows:
Data
longth(byte)
description
Dpid
1
Datapoint serial number
Type
1
Corresponds to the specific data type of a datapoint on the open platform, identified by the following "representation value"
type
Expressed value
length(byte)
explanation
raw
0x00
N
Corresponds to raw datapoint (module transparent transmission)
bool
0x01
1
Value range:0x00/0x01
value
0x02
4
Corresponding int type,大端表示
string
0x03
N
Corresponds to a specific string
enum
0x04
1
Enumerated type,range 0-255
bitmap
0x05
1/2/4
When the length is greater than 1 byte,大端表示
Len
2
Length corresponding number of bytes
Value
1/2/4/N
Hex means,Big-endian transmission should be used if more than 1 byte
2) Except for the "raw" type, the datapoint command / status data unit all belongs to the "obj" type datapoint.
3) The "command issuance" may include multiple datapoint "command data units".
4) "Command issuance" is an asynchronous processing protocol, corresponding to the "status report" of the MCU's datapoint.
Description:
Zigbee wakes MCU or MCU wakes zigbee with this command
This command will be resent 3 times until a response package is received. After being awakened, it will start to accept data. The maximum time for accepting is one second, and it will go sleep mode after more than 1 second.
This instruction is preceded by 7 BYTE preambles.
Module transmission:
Word
length(byte)
explanation
Frame head
2
0x55aa
version
1
0x03
Serial number(Seq)
2
55AA(固定序列号)
Command word
1
0x00
Data length
2
0x0000
Check the sum
1
Byte-by-byte sum from the beginning of the frame,the result is remainder of 256.
MCU return:
Word
length(byte)
explanation
Frame head
2
0x55aa
Version
1
0x03
Serial number(Seq)
2
55AA(fix serial number)
Command word
1
0x00
Data length
2
0
Check the sum
1
Byte-by-byte sum from the beginning of the frame,the result is remainder of 256
Note: When the module actively wakes up the MCU, the serial number is fixed at 55 AA, and the ACK number returned by the MCU is also 55 AA;
When the MCU actively wakes up the module, the serial number is fixed at 00 00, and the module's ACK serial number returned by the MCU is also 00 00;
example:
1、Module wake up MCU:
Note: When the module actively wakes up the MCU, the serial number is fixed at 55 AA, and the ACK number returned by the MCU is also 55 AA;
When the MCU actively wakes up the module, the serial number is fixed at 00 00, and the module's ACK serial number returned by the MCU is also 00 00;
example:
The module wakes up the MCU:
Module send:
0x00 00 00 00 00 00 00 55 AA 03 55 AA 00 00 00 01
Leading code frame head version Seq command word data length checksum
MCU reply:
0x55 AA 03 55 AA 00 00 00 01
frame head version Seq command word data length checksum
2、MCU wake up module:
MCU send:
0x00 00 00 00 00 00 00 55 AA 03 00 00 00 00 00 02
Leading code frame head version Seq command word data length checksum
Module reply:
0x55 AA 03 00 00 00 00 00 02
frame head version Seq command word data length checksum
Explanation:
1) product ID: Corresponds to the Tuya Developer Platform PID (Product Identification), which is generated by the Tuya Cloud Developer Platform and is used to record product related information in the cloud.
2) Product information consists of product ID and MCU software version.
3) MCU software version number format definition: in dotted decimal form, "x.x.x" (0 <= x <= 99), x is a decimal number.
Module send:
Word
length(byte)
explanation
Frame head
2
0x55aa
Version
1
0x03
Serial number(Seq)
2
In order
Command word
1
0x01
Data length
2
0x0000
Data
0
no
Check the sum
1
Byte-by-byte sum from the beginning of the frame,the result is remainder of 256
Example:0x55 AA 03 33 77 01 00 00 AD
Frame head *version Seq command word data length check sum*
MCU return:
Word
length(byte)
explanation
Frame head
2
0x55aa
Version
1
0x03
Serial number(Seq)
2
The module issued seq
Command word
1
0x01
Data length
2
N
Data
N
{“p”:”AIp08kLI”,“v”:”1.0.0” }
Data
1
Support OTA or not, 1 support,0 not support
Check sum
1
Byte-by-byte sum from the beginning of the frame,the result is remainder of 256
Example:0x55 AA 03 33 77 01 00 1C 7B 22 70 22 3A 22 38 73 34 75 71 75 79 78 22 2C
Frame head *version Seq command word data length { " p " : " 8 s 4 u q u y x " ,*
22 76 22 3A 22 31 2E 30 2E 30 22 7D 01 7F
*" v " : " 1 . 0 . 0 " } check sum*
P means product ID is 8s4uquyx
V means MCUversion is 1.0.0
Support OTA
Device status ID
Description
0x00
Device is not connected to the gateway
0x01
Device connected to the gateway
0x02
Device is entered server
0x03
The device is connected to the gateway and entered the server
0x04
Device is not connected to the sever
0x05
The device is connected to the gateway but has not entered the server
0x10
Transmission report successful
0x20
Transmission report fail
0x40
Transmission report timeout
0x80
Transmission report busy
Picture 4 module status sheet(8421)
explanation:
1) The device is not connected to the network: When the device is powered on for the first time, or fails to connect to the network, or is disconnected from the network, the device status is not connected to the network, this status will send to MCU.
2) The device is in the networked status: After the device is successfully connected to the network, the device is in the networked status; the status is sent to the MCU.
3) When the module detects the process of MCU restart or MCU disconnect then online again, it will actively send the module network status to the MCU.
4) When the network status of the module changes, it will actively send the network status of the module to the MCU.
MCU sends
Word
length(byte)
explanation
Frame head
2
0x55aa
Version
1
0x03
Serial number(Seq)
2
MCU effects
Command word
1
0x02
Word length
2
0x0000
Data
0
no
Check sum
1
Byte-by-byte sum from the beginning of the frame,the result is remainder of 256
example: 0x55 AA 03 00 00 02 00 00 04
Frame head *version Seq command word data length check sum*
Module return:
word
Length (byte)
description
Frame head
2
0x55aa
Version
1
0x03
Serial number(Seq)
2
MCU send SEQ
Command word
1
0x02
Data length
2
0x0001
Data
1
Indicate module working status:Zigbee status,check picture 4
Check sum
1
Byte-by-byte sum from the beginning of the frame,the result is remainder of 256
例:0x55 AA 03 00 00 02 00 01 03 08
Frame head *version Seq command word data length data check sum*
Description:
1) If the device is a low-voltage device, the MCU needs to send a wake-up command to the module first, and then send a configuration command to the module; a strong-power device directly sends a configuration command to the module.
a. There are two types of commands for configuring the Zigbee module, as shown in the figure below.
command
description
0x00
Reset the module to factory default status (not connected to the network)
0x01
Configure the module to start network configuration
MCU send:
word
length(byte)
description
Frame head
2
0x55aa
version
1
0x03
Serial number(Seq)
2
MCU effects
Comand word
1
0x03
Data length
2
0x0001
Data
1
0x00/0x01
Check sum
1
Byte-by-byte sum from the beginning of the frame,the result is remainder of 256
Example:0x55 AA 03 00 00 03 00 01 01 07
Frame head *version Seq command word data length data check sum*
Module return:
word
length(byte)
explanation
Frame head
2
0x55aa
version
1
0x03
Serial number(Seq)
2
MCU send SEQ
Command word
1
0x03
Data length
2
0x0001
data
1
0x00:OK,0x01:error
Check sum
1
Byte-by-byte sum from the beginning of the frame,the result is remainder of 256
example:0x55 AA 03 00 00 03 00 01 00 06
Frame head *version Seq command word data length data check sum*
Module send:
word
length(byte)
explanation
Frame head
2
0x55aa
version
1
0x03
Serial number(Seq)
2
Effect in order
Comand word
1
0x04
Data length
2
Depends on "command data unit" type and number
Data
N
“2.3data command unit”
Check sum
1
Byte-by-byte sum from the beginning of the frame,the result is remainder of 256
example:“doorbell select”,
0x55 AA 03 00 1C 04 00 05 0E 04 00 01 00 3A
Frame head *version Seq command word data length dpID dp type data length data check sum*
mcu返回:
word
length(byte)
explanation
Frame head
2
0x55aa
version
1
0x03
Serial number(Seq)
2
The seq issued by module
Comand word
1
0x04
Data length
2
0x0001
Data
1
0x00:OK,0x01:error
Check sum
1
Byte-by-byte sum from the beginning of the frame,the result is remainder of 256
例:0x55 AA 03 00 1C 04 00 01 00 23
Frame head *version Seq command word data length data check sum*
Explanation:
1) After the MCU receives the 04 command, it must reply the 04 command immediately, and the reply is receivingcorrect or failed;
2) After receiving the 04 instruction successfully, the MCU will process the 04 instruction and send the processed result to the module through the 05 instruction, and inform the module of the 04 instruction execution status;
3) The module will immediately return ACK to the MCU after receiving the datapoint information of the 05 instruction;
4) Multiple datapoint "command data units" may be included. For details of the datapoint status data unit, see "Section 2.3", but the data frame length cannot exceed 64 bytes.
MCU send:
word
length(byte)
explanation
Frame head
2
0x55aa
version
1
0x03
Serial number(Seq)
2
MCU effects
Comand word
1
0x05
Data length
2
Depends on the type and number of "status data unit", including SeqNum and data
N
“2.3status data unit”
Check sum
1
Byte-by-byte sum from the beginning of the frame,the result is remainder of 256
Example:“doorbell ring”,
0x55 AA 03 00 00 05 00 05 0E 01 00 01 01 1D
*Frame head version Seq command word data length dpID dp type data length data check sum*
Module return:
word
Length (byte)
Explanation
Frame head
2
0x55aa
version
1
0x03
Serial number(Seq)
2
MCU send SEQ
Comand word
1
0x05
Data length
2
0x0001
Data
1
Zigbee status,check picture 4
Check sum
1
Byte-by-byte sum from the beginning of the frame,the result is remainder of 256
Example:0x55 AA 03 00 00 05 00 01 10 18
Frame head *version Seq command word data length data check sum*
Note: zigbee asynchronous notification or network status change notification
Module sends:
word
length(byte)
description
Frame head
2
0x55aa
version
1
0x03
Serial number(Seq)
2
Effects in order
Comand word
1
0x06
Data length
1
0x02
Data
1
Zigbee status,check picture 4
Check sum
1
Byte-by-byte sum from the beginning of the frame,the result is remainder of 256
Example:“network status”effects:
0x55 AA 03 00 77 06 00 01 05 85
Frame head *version Seq command word data length data check sum*
MCU returns:
word
length(byte)
explanation
Frame head
2
0x55aa
version
1
0x03
Serial number(Seq)
2
Seq issued by module
Comand word
1
0x06
Data length
2
0x0001
Data
1
Zigbee status,check picture 4
Check sum
1
Byte-by-byte sum from the beginning of the frame,the result is remainder of 256
Example:“network status”respnse:
0x55 AA 03 00 77 06 00 01 10 90
Frame head *version Seq command word data length data check sum*
Note: (1) The time data in the protocol is used to calculate the current dynamic password. The dynamic password calculation time here is the current Green Time. The device needs to give the module Green Time data.
(2)On the APP side, you can set a mixed calculation whether the device currently needs to add the administrator password to the participate dynamic passwords. Every time the device requests to verify the dynamic password again, it needs to lock all the current door of the module. Administrator password.
(3) The data length of the sending package is at least 15 bytes, time data + password + the number of administrator password groups transmitted (not including the optional administrator password).
MCU sends:
word
length(byte)
explanation
Frame head
2
0x55aa
version
1
0x03
Serial number(Seq)
2
MCU effects
Comand word
1
0x07
Data length
2
xx xx
Data
4
Data length is 4bytes: the current device green time: data[0]-data[3]
8
Password data entered by the user: Data[4]Data[11] the data content range‘0’’9’ data transmmit ASCLL code
1
The number of administrator password groups (0 ~ 10), numbers of groups of administrator passwords are followed by the corresponding group number data
1
The length of the first password (up to 8)
n
The first group of administrator password (the password is composed of numbers) The data content range is ‘0’ ~ ’9’ The data transmission uses ASCLL code
1
The length of the second set of passwords (no more than 8)
n
The second group of administrator password (the password is composed of numbers) The data content range is ‘0’ ~ ’9’ The data transmission uses ASCLL code
…
…
Check sum
1
Byte-by-byte sum from the beginning of the frame,the result is remainder of 256
Example:
55 AA 03 00 00 07 00 1D 5B BC 3A 41 33 37 32 32 34 32 30 31 02 Frame head *version Seq command word data length time stamp active password Administrator password numbers*
06 30 31 32 33 34 35 08
*First set of password length The first administrator password Second set of password length* 31 32 33 34 35 36 37 38 30
*The second set of administrator passwords check sum*
Module return:
word
length(byte)
explanation
Frame head
2
0x55aa
version
1
0x03
Serial number(Seq)
2
MCU issued SEQ
Comand word
1
0x07
Data length
2
0x0001
Data
1
0x00(password check successful) 0x01(Password check failed) 0x02(device not get seckey) 0x03(Data length error)
Check sum
1
Byte-by-byte sum from the beginning of the frame,the result is remainder of 256
Example:55 AA 03 00 00 07 00 01 00 0A
Frame head *version Seq command word data length data check sum*
Note: The RF test method of the module is performed by loopback test between DUT (equipment under test) and GU (golden unit). That is, the DUT sends packets, and the GU sends the packets to DUT. Perform statistics and report the results to the MCU through the serial port. Round trip time interval is 3S.
1) Send the production test command within 300ms after power on.
MCU send:
word
length(byte)
explanation
Frame head
2
0x55aa
version
1
0x03
Serial number(Seq)
2
MCU effects
Comand word
1
0x09
Data length
2
0x0001
Data
Data
Channel value(11-26)
Check sum
1
Byte-by-byte sum from the beginning of the frame,the result is remainder of 256
Example:0x00 00 00 00 00 00 00 55 AA 03 00 00 09 00 01 19 25
Preamble Frame head *version Seq command word data length data check sum*
Module return:
word
Length(byte)
explanation
Frame head
2
0x55aa
version
1
0x03
Serial number(Seq)
2
MCU下发的SEQ
Comand word
1
0x09
Data length
2
0x0001
Data
2
RFreceive0-100%(Suggested success rate80%)
Check sum
1
Byte-by-byte sum from the beginning of the frame,the result is remainder of 256
Example:0x55 AA 03 00 00 09 00 02 01 3C 4A
Frame head *version Seq command word data length data check sum*
Note:****:support firmware version:1.0.4****
The MCU ota process is as follow:
**MCU version check**
If MCU upgrade is supported, this command must be implemented, and the MCU can also report actively;
Query scenarios: 1. During network distribution 2. When the MCU upgrade process is abnormal;
Proactive reporting scenarios: 1. After network pairing successful (must be added) 2. Upgrade finished;
Module send:
word
Length(byte)
explanation
Frame head
2
0x55aa
version
1
0x03
Serial number(Seq)
2
Module effects
Comand word
1
0x0A
Data length
2
0x0000
Data
0
Check sum
1
Byte-by-byte sum from the beginning of the frame,the result is remainder of 256
Example:0x55 AA 03 00 f0 0A 00 00 26
Frame head *version Seq command word data length check sum*
MCU response or module send:
word
Length(byte)
explanation
Frame head
2
0x55aa
version
1
0x03
Serial number(Seq)
2
MCU issued SEQ
Comand word
1
0x0A
Data length
2
0x0001
Data
1
Version number (current version)01.00.0001 à1.0.1
Check sum
1
Byte-by-byte sum from the beginning of the frame,the result is remainder of 256
Module send
word
Length(byte)
explanation
Frame head
2
0x55aa
version
1
0x03
Serial number(Seq)
2
Module effects
Comand word
1
0x0B
Data length
2
0x000F
Data
8
Data[0]~ Data[7] PID
Data
1
Version number (update version)01.00.0001 à1.0.1
Data
4
Firmwware size at most 64K
Data
4
Firmware checksum:Byte-by-byte sum from the beginning of the frame,the result is remainder of 2^32
Check sum
1
Byte-by-byte sum from the beginning of the frame,the result is remainder of 256
Example:0x55 AA 03 00 1C 0B 00 0F 30 31 32 33 34 35 36 37 41
Frame head *version Seq command word data length PID V*
MCU corresponding:
word
Length(byte)
explanation
Frame head
2
0x55aa
version
1
0x03
Serial number(Seq)
2
Module issued seq
Comand word
1
0x0B
Data length
2
0x0001
Data
1
0x00:OK,0x01:error
Check sum
1
Byte-by-byte sum from the beginning of the frame,the result is remainder of 256
Example:0x55 AA 03 00 1C 0B 00 01 00 23
Frame head *version Seq command word data length data check sum*
MCU send:
word
Length(byte)
explanation
Frame head
2
0x55aa
version
1
0x03
Serial number(Seq)
2
0x0000
Comand word
1
0x0C
Data length
2
0x0006
Data
8
PID
Data
1
Version number (update version) 01.00.0001 à1.0.1
Data
4
Offset of data package (location of firmware)
Data
1
Data package size
Checksum
1
Byte-by-byte sum from the beginning of the frame,the result is remainder of 256
Example:0x55 AA 03 00 f0 0C 00 06 26
Frame head *version Seq command word data length checksum*
Module corresponding:
word
length(byte)
explanation
Frame head
2
0x55aa
version
1
0x03
Serial number(Seq)
2
0x0000
Comand word
1
0x0C
Data length
6+N
0x0006+N
Data
1
Status 0 succeed 1:fail
Data
8
PID
Data
1
Version number (update version) 01.00.0001 à1.0.1
Data
4
Offset of data package (location of firmware)
Data
N
Data
checksum
1
Byte-by-byte sum from the beginning of the frame,the result is remainder of 256
Example:
55 AA 03 00 39 24 00 08 00 00 0D 2B 00 00 7D AB C7
Frame head *version Seq command word data length standard time* *local time check sum*
Note: This result is reported after the MCU upgrade is completed; no matter whether the MCU upgrade is successful or failed, as long as the upgrade action is initiated, the upgrade process must be terminated through the result report command;
MCU sends:
word
Length(byte)
explanation
Frame head
2
0x55aa
version
1
0x03
Serial number(Seq)
2
MCU issued SEQ
Comand word
1
0x0D
Data length
2
0x0004
Data
1
Status 0 succeed 1:fail
Data
8
PID
Data
1
Version number (update version) 01.00.0001 à1.0.1
Checksum
1
Byte-by-byte sum from the beginning of the frame,the result is remainder of 256
Example:
0x55 AA 03 00 f0 0C 00 06 26
Frame head *version Seq command word data length checksum*
Module corresponding:
word
Length(byte)
explanation
Frame head
2
0x55aa
version
1
0x03
Serial number(Seq)
2
MCU下发的SEQ
Comand word
1
0x0D
Data length
2
0x0001
Data
1
0x00:OK,0x01:error
Check sum
1
Byte-by-byte sum from the beginning of the frame,the result is remainder of 256
Example:0x55 AA 03 00 1C 0D 00 01 00 23
Frame head *version Seq command word data length data checksum*
Explanation:
1) When the MCU data changes , such as various door opening actions, various alarm information, local password changes, etc., which involves the local operation of the door lock, the door lock MCU needs to use this command to send the corresponding DP data to the module;
2) When reporting the frame data, the frame needs to carry a time stamp. If the MCU has time data locally, the time stamp needs to be included in the data;
3) Multiple datapoint "command data units" can be included. For details of the datapoint status data unit, see "Section 2.3", but the data frame length cannot exceed 64 bytes.
MCUsend:
word
Length(byte)
explanation
Frame head
2
0x55aa
version
1
0x03
Serial number(Seq)
2
MCU effects
Comand word
1
0x23
Data length
2
Depends on the type and number of "status data unit"
Data
5
Data[0]: whether use mcu time or not0:use gateway time1:Time reported using mcuData[1]~ Data[4] time stamp
N
“Status data unit”
Checksum
1
Byte-by-byte sum from the beginning of the frame,the result is remainder of 256
Example:“Fingerprint unlock”:
0x55 AA 03 00 00 23 00 0D 01 5B F6 67 B1 01 02
Frame head *version Seq command word data length MCU time time stamp dpID dp type*
00 04 00 00 00 0B AE
*data length data checksum*
“Password + fingerprint combination unlock”:
0x55 AA 03 00 00 23 00 15 00 5B F6 67 B1 02
Frame head *version Seq command word data length gateway time time stamp dpID(password)*
02 00 04 00 00 00 01 01 02 00 04 00 00 00 05 B8
*Dp type data length data dpID(pingerprint) dp type data length data checksum*
Data return:
word
Length(byte)
explanation
Frame head
2
0x55aa
version
1
0x03
Serial number(Seq)
2
MCU issued SEQ
Comand word
1
0x23
Data length
2
0x0001
Data
1
Zigbee status,check picture 4
Check sum
1
Byte-by-byte sum from the beginning of the frame,the result is remainder of 256
Example:0x55 AA 03 00 00 23 00 01 10 36
Frame head *version Seq command word data length* data checksum
The data format of the record-type status report includes the record number and the timestamp when the record occurred.
1, timestamp: the timestamp of the record, using the standard timestamp, that is, 00 January 00 10:00 00: 00 GMT (Beijing time 01 January 1970 08: 00 00 00 minutes Total seconds from now
MCU sends:
word
Length(byte)
Explanation
Frame head
2
0x55aa
version
1
0x03
Serial number(Seq)
2
MCU产生
Comand word
1
0x24
Data length
2
0x0000
Data
0
Check sum
1
Byte-by-byte sum from the beginning of the frame,the result is remainder of 256
Example:0x55 AA 03 00 00 24 00 00 26
Frame head *version Seq command word data length check sum*
Module response or module send:
word
Length(byte)
Explanation
Frame head
2
0x55aa
version
1
0x03
Serial number(Seq)
2
MCU issued SEQ
Comand word
1
0x24
Data length
2
0x0008
Data