R-Watch Communication protocol-EN
R-Watch Communication protocol-EN
com
1、 Introduction
The R-Watch protocol is for the RS485 communication protocol between R-Watch and the host.
2、Protocol description
R-Watch should receive a protocol frame that is not its own ID and should be discarded.
The serial port parameters communicated with the host are fixed as: baud rate 57600, 8 data
bits, 1 stop bit, no parity.
The communication byte order is high before the special description, such as a 32-bit data
0x12345678, and the transmission order is 0x12, 0x34, 0x56, 0x78.
其中:
word
Data length 2 Length of data content High position
in front
Data N Actual data to be transferred
content
End of 1 Protocol frame fixed frame end 0x7F Fixed to 0x7F
frame
Destination path, device ID, and command word are prohibited from using 0x7D, 0x7E, and
0x7F。
The highest bit of this field is fixed at 1. This field is used to identify the serial forwarding link.
R-Watch does not care about this field when receiving, and fills in the default value of 0x80 when
sending.
The Data Length field in the function frame indicates how many bytes the data content field
has. This length is described in the specific command word, but since the command and its contents
may continue to be supplemented, the processing is handled as long as the actual required length.
(Data content expansion should not destroy the original data content arrangement)
2.3 Escape
Since the protocol frame uses fixed characters as the frame header (0x7E) and the end of the
frame (0x7F), the fixed characters (0x7E and 0x7F) cannot appear directly between the frame
header and the end of the frame, and if they appear, they need to be escaped, and The escape
character itself also needs to be escaped. The escaping relationship is as follows:
When the protocol frame is sent, the frame is first escaped and then sent. After the protocol
frame is received, it must be inverted and parsed.
example:
Original frame:
7E 80 8E 0E 01 78 00 0B 01 23 7D 45 67 7E 89 AB 7F CD EF 7F
7E 80 8E 0E 01 78 00 0B 01 23 7D 03 45 67 7D 01 89 AB 7D 02 CD EF 7F
The data length and checksum are calculated before the escaping (after the inversion is received).
3、R-Watch command
The <Data> in the beginning of the peripheral upgrade is divided into two parts: the
identification string and the length of the upgrade file.
Peripheral upgrade
0x02 <N> <Data> Down
begins
Upgrade start reply 0x02 5 <Result> Up
The <Data> in the beginning of the peripheral upgrade is divided into two parts: the serial
number and the upgrade data package.
Data [0:3]: serial number, uing32_t type, the high position is first, the value starts from 1, and
each packet is incremented by 1. The retransmission packet does not increment the serial
number, and the re-upgrading serial number is reset to 1;
Data [4:N]: Upgrade the packet. The packet length must be a multiple of 4.
The <Result> in the upgrade data reply is divided into two parts: the upgrade package
receiving result and the serial number.
Data [0]: The packet receives the result, 0x00=Receive failed, 0x01=Received successfully;
Data [1:4]: The serial number corresponds to the peripheral upgrade data, indicating that the
reply is for the serial number.
The <Data> in the end of the peripheral upgrade is divided into two parts: the identification
string and the upgrade file verification.
Note 1: The upgrade end command only indicates that the upgrade file has been delivered. Cannot
be used to stop the upgrade.
The R-Watch heartbeat timeout is 10 seconds. If the command is not received after the timeout,
3.5 Reboot(0x06)
This command is sent when the device is abnormal or after the upgrade is completed.
The <Data> in the buzzer control contains three parts: the single tweet opening time, the single
tweet closing time, and the number of tweets.
Data [0:1]: The single tweet open time Ton, the high byte first, the unit is 10ms;
Data [2:3]: Single tweet off time Toff, high byte first, unit is 10ms;
Data [4]: Number of tweets;
Different combinations of single tweet opening time, single tweet closing time and number of
tweets can achieve different effects, as shown in the following table:
Single turn on time Single turn off time Number of tweets duration
Ton Toff Cnt
Turn off the 0 Arbitrary value Arbitrary value 0
buzzer
Continuous long >0 0 0 ∞
sound
Long sound for a >0 0 >0 Ton×Cnt
while
Continuous >0 >0 0 ∞
periodic tweet
a periodic tweet >0 >0 >0 (Ton+Toff)×Cnt
The <Data> in which the display brightness is set includes two parts: the brightness adjustment
mode and the brightness level.
Data [0]: brightness adjustment mode, 0 is automatic, 1 is manual; when it is automatic mode,
R-Watch automatically adjusts the backlight brightness according to the ambient brightness
sensor. When it is in manual mode, it controls the backlight according to the Data[1] field.
brightness;
Data [1]: This field is valid only in manual mode, setting the display brightness to the specified
level; the brightness level ranges from 0 to 8, where 0 is the backlight is turned off, and 1 to 8 is
the different brightness, the larger the value, the brighter;
The <Data> in the brightness state contains two parts: the brightness adjustment mode and the
brightness level.
Data [0]: The currently set brightness adjustment mode, 0 is automatic and 1 is manual;
Data [1]: the currently set brightness level;
The <Data> in the ambient brightness level contains one part: the ambient brightness level.
Data [0]: Ambient brightness level obtained by the current ambient brightness sensor. The value
ranges from 1 to 8. The larger the value, the brighter it is;
The <Data> in the overall information display of the ADAS/DSM contains 8 parts: Area 1 to
Area 8 display information.
Area 1 is a full screen and areas 2 to 7 form a home page. When the area 1 display content type
is valid, other areas are ignored; when the area 1 display content type is invalid, the areas 2 to 7 are
displayed; the area distribution is as follows:
Area 1
Area 2 to Area 8
Area blanking
Flash type Not supported, reserved as 0
Display parameter 1 Reserved as 0
Display parameter 2 Reserved as 0
other instructions
Front car collision warning
Flash type Support
This value is valid in area 4, and area 1 ignores the value.
Icon color index
0x01: green
Display parameter 1
0x02: yellow
0x03: orange
0x04: red
0x05: gray
Other: invalid
Display parameter 2 Reserved as 0
other instructions Only zone 1 and zone 4 are supported
Lane departure
Flash type Support
Display parameter 1 Lane line color index:
0x00: white
0x02: yellow
0x03: orange
0x04: red
0x10: light gray
0x11: dark gray
Other: invalid
Display parameter 2 Lane line status:
0x00: normal
0x01: thickened and dashed
0x02: thinner
0x03: thick solid line
other instructions Only supports zone 6 and zone 7
Distance monitoring
Flash type Support
Icon color index
0x00: white
0x01: green
0x02: yellow
Display parameter 1 0x03: orange
0x04: red
0x10: light gray
0x11: dark gray
Other: invalid
Distance value, when the value is 255, it means no car, the interface only
Display parameter 2 shows the point; when the value is 0 to 99, the distance time is displayed, the
unit is 0.1 second; other values are invalid.
other instructions Only support area 5
DSM alarm
Flash type Support
DSM alarm type
0x01: Leaving the post
0x02: Distraction
Display parameter 1 0x03: fatigue
0x04: Calling
0x05: Smoking
0x06: camera occlusion
The <Data> in the overall information display of the ADAS/DSM contains five parts: the area
index, the display content type, the blinking type, the display parameters, and the number of blinks.
among them
Data [0]: area index, the value range is 1 to 8, corresponding to area 1 to area 8, respectively.
For regional planning, see the overall information display of ADAS/DSM;
Data [1]: Display content type, the definition is the same as the overall information display of
ADAS/DSM;
Data [2]: Flash type, the definition is the same as the overall information display of
ADAS/DSM;
Data [3:4]: display parameters, the definition is the same as the overall information display of
ADAS/DSM;
Data [5]: number of flashes. When the field is not 0, the number of flashes is valid; when the
number of flashes is 0, it means that the number of flashes is not limited; when other values
flash to the number of times, the area is blanked.
The <Data> in the beginning of the file update contains 4 parts: file type, update mode, file size,
and file name. among them
Data [0:2]: The file type, that is, the file suffix name, such as the file type of "test.bmp" is
"bmp". Fixed 3 bytes, and 0 if not enough.
Data [3]: update mode, 0 is added or replaced, 1 is
Data [4:7]: file size, actual file size, file size cannot exceed 99999 bytes.
Data [8:N-1]: The file name is the part before the ".suffix name". For example, the file name of
"test.bmp" is "test". Up to 8 bytes long.
When the update mode is Delete, the file size field is filled with 0.
The <Data> in the file update data contains three parts: the serial number, the data length, and
the data content. among them
Data [0:3]: The serial number, the serial number starts from 1, and is incremented after a packet
is successfully sent.
Data [4]: Data length, the data length of this packet, ranging from 1 to 250.
Data [5:N-1]: Data content, the data content of the packet.
The <Data> in the reply contains 2 parts: the serial number and the result. among them
Data [0:3]: The serial number corresponds to the file data update issued.
Data [4]: Result, 0 is the file data reception failure, and 1 is the file data reception success.
The <Data> in the end of the file update contains 2 parts: control word and data check. among
them
Data [0]: Control word, 0 is the file issuance completed, 1 is the cancellation file update.
Data [1:4]: CRC check value of all file data; when canceling file update, ignore file data CRC
check value.
The <Data> in the query file information contains 2 parts: file type and file name. among them
Data [0:2]: The file type, that is, the file suffix name, such as the file type of "test.bmp" is
"bmp". Fixed 3 bytes, and 0 if not enough.
Data [3:N-1]: The file name is the part before the ".suffix name". For example, the file name of
"test.bmp" is "test". Up to 8 bytes long.
The <Data> in the file information report contains three parts: the query result, the file size, and
the file check value. among them
Data [0]: Query result, 0 is the query failed, 1 is the query success.
Data [1:4]: File size, this field does not exist when the query result is failed.
Data [5:8]: File CRC check value. This field does not exist when the query result is failed.
The <Data> in the request file data contains 4 parts: file type, offset, read length, and file name.
among them
Data [0:2]: The file type, that is, the file suffix name, such as the file type of "test.bmp" is
"bmp". Fixed 3 bytes, and 0 if not enough.
Data [3:6]: Offset, the offset of the data to be read in the file, if the offset exceeds the file size,
the read fails.
Data [7]: Read length, the length of the file data to be read, ranging from 1 to 250.
Data [8:N-1]: The file name is the part before the ".suffix name". For example, the file name of
"test.bmp" is "test". Up to 8 bytes long.
The <Data> in the file data report contains three parts: the read result, the read length, and the
read data content. among them
Data [0]: Read the result, 0 is the query failed, 1 is the query success.
Data [1]: The length read, indicating the length actually read; this field does not exist when the
read result is failed.
Data [2:M-1]: The data content read, this field does not exist when the read result is failed.
fcw_l.bmp
ADAS Front collision alarm (area 1 full screen display)
front car
collision
warning
fcw_s.bmp
You can set the display color as needed.
New UI's fcw_s.bmp
ADAS pcw_l.bmp
pedestrian Pedestrian collision alarm (area 1 full screen display)
collision
warning
pcw_s.bmp
You can set the display color as needed.
New UI pcw_l.bmp
New UI pcw_s.bmp
n24x40.fnt
ADAS
n24x40.fnt
distance
New UI n24x40.fnt
New UI n24x40.fnt
dsm1_l.bmp
Off-duty icon (area 1 full screen display)
DSM left
the post
dsm1_s.bmp
Off duty small icon (area 3 display)
dsm2_l.bmp
Distraction big icon (area 1 full screen display)
DSM
Distraction
dsm2_s.bmp
Distraction small icon (area 3 display)
dsm3_l.bmp
Fatigue big icon (area 1 full screen display)
DSM
fatigue
dsm3_s.bmp
Fatigue small icon (area 3 display)
dsm4_l.bmp
Call the big icon (area 1 full screen display)
DSM make
phone call
dsm4_s.bmp
Call small icon (area 3 display)
dsm5_l.bmp
Large smoking icon (area 1 full screen display)
DSM
smoking
dsm5_s.bmp
Smoking small icon (area 3 display)
dsm6_l.bmp
The camera blocks large icons (area 1 is displayed on the
DSM
whole screen)
camera
occlusion
dsm6_s.bmp
Camera occlusion small icon (area 3 display)
dsm7_l.bmp
DSM
Play mobile phone big icon (area 1 full screen display)
playing
mobile
phone
dsm7_s.bmp
Play mobile phone small icon (area 3 display)
dsm7_s.bmp
DSM is not Play mobile phone small icon (area 3 display)
wearing a
seat belt
dsm8_s.bmp
Not wearing a seat belt small icon (area 3 display)
boot.bmp
startup screen
Boot Logo
boot.bmp
Neutral boot screen
Communic no_comm.bmp
ation The icon is displayed when the message is not received for 1
disconnecti minute, or the message is not received 10 seconds after the
on normal communication, and blinks.