WIFI Interface
WIFI Interface
V1.2.3
Change Log
Version State of
Description of modification point Author Date
number change
Realize basic wifi module protocol Wang
V 1.0 C 2019-12-15
function Jintai
Wang
V1.1 A Add scanning hotspot function 2019-12-30
Jintai
1. Add UDP broadcast protocol
2. Added instructions for using UDP
V1.2.1 A Li Jianmin 2020-4-15
broadcast protocol, please refer to the
instructions for 5.6
1. Increase write-back to IP
Wang
V1.2.2 A 2. Increase the configuration of the 2020-4-20
Jintai
port
V1.2.3 A Modify 487 address description Li Jianmin 2020-6-4
1. Overview
In order to make DWIN smart LCD Module easy and convenient to connect to the
Internet, DWIN set up its own cloud server and integrated the interface to connect to
the Internet on the DGUS system, so that it will be very simple and convenient to
develop DWIN smart LCD Module with network function in the future .
Currently supported LCD Module platforms are T5UID1, T5UID2 and T5L_ASIC.
Supported products are 86 box series products and network screens, etc.
The advantages of the DWIN WIFI solution are mainly reflected in the following
three aspects:
1. Development efficiency
Based on the DGUS architecture, after the stand-alone function is realized, the Single
Chip Microcomputer zero code can realize network configuration and data upload.
The engineer only needs to plan the data address. The complex JSON protocol parsing
is processed in the cloud to save the resources of the Single Chip Microcomputer and
improve the development efficiency. Customers can focus on the core functions of the
product.
2. Stability
The solution has opened the protocol between the main chip (GUI), WIFI module,
and MQTT server to form a UI+IOT integrated solution, reducing the number of
customer development links, reducing communication costs, and reducing the
uncertainty in development, so that the entire solution Stability is improved.
3. Cost
As a part of DWIN's IoT solution, WIFI module faces tens of thousands of customers
in different industries, forming a scale advantage. Direct cooperation with the original
WIFI chip manufacturer to ensure cost advantage.
1. With a simple configuration, the Smart LCD Module equipped with the DWIN
WIFI module will connect to the MQTT server through the "Connect A" channel.
2. The WIFI module will upload or download the DGUS register variables of the
DWIN Smart LCD Module and the corresponding DGUS variables on the server.
3. Mobile terminal and background management through the MQTT server for data
communication and interaction between servers. The mobile terminal mainly
implements remote UI functions and variable modification functions. The background
management can realize the function of variable modification control and file
upgrade.
4. The third-party server can be the client's server, and the DGUS variable can be
operated by providing an interface to upgrade the file.
(2) Support 802.11 (2.4 GHz), frequency range 2.4G ~ 2.5G (2400M ~ 2483.5M)
(5) Serial transmission rate 921600bps (transmission data rate on the device side)
WIFI module should have VCC (3.3V), GND, TXD, RXD, C/D, TXD_C, /RST 7
pins.
C/D: WIFI module download enable, internal pull-up resistance 10K. When the
module is powered on, the pin is low, indicating that the boot mode is entered.
Use suspension normally
/RST: Reset pin, which needs to be connected to reset chip for reliable reset. Low
level reset WIFI module.
The definition of V2.0 hardware package is as shown above, and the foot pitch is
2.0mm.
the difference:
DL/SDA: WIFI module download enable, internal pull-up resistor 10K. When the
module is powered on, this pin is low, it means to enter the boot mode. Normal
use can be suspended.
SDA of the I2C interface, if the I2C interface is enabled, the TX function of
UART1 needs to be disabled
In the end, only UART1 was used, and the rest were not used.
T5L ASIC
WIFI Module IO Explanation
IO
Connect the resistor, the hardware
IO18 C/D
configuration download is enabled
IO19 TXD_C Debug information output, don't care
UART1_TX RXD Serial data
UART1_RX TXD Serial data
2. Development steps
2.1. Determine the platform
Platform Explanation Examples of products
1. The 22.bin file needs to be configured
and uploaded TR028C11W04
22. Bin file. TC035C21W04
T5UID1,T5UID2
2. The 8283 instruction needs to be TR028C12W00
implemented in the OS. can TC035C22W00
Use the given routine code.
Just configure 22.bin file and load 22.bin
T5L ASIC
File
Write 22.bin file to meet network access requirements, including product ID, display
network connection status icon, etc., display version number and MAC address, etc.
The external device reads and writes the bus interface of DGUS system through
UART, mainly 82H, 83H instructions.
Data block 1 2 3 4 5
CRC calibration
Definition Frame header Data length instruction Data
(optional)
Data length 2 1 1 N 2
Including
Explanation 0×5AA5 instructions, data, 0×82/0×83
calibration
Example (no
5A A5 04 83 00 10 04
calibration)
Example
5A A5 06 83 00 10 04 25 A3
(calibration)
It should be noted that the length of the 82H/83H instruction is only 1 byte, that is, the
maximum is 256 bytes. With the removal of the frame header and frame tail and the
CRC, the general payload is about 240 bytes. Therefore, if there is a large amount of
data interacting with the DGUS system, it needs to be broken into small packages for
interaction. For example, the 4K data in the cloud is sent to the WIFI module. The
WIFI module needs to be disassembled into small packages and written into the
DGUS system variables in turn.
The definition address of the network part in the DGUS system is in the area of
0x400-0x4FF, which is defined as follows:
Lengt
h Recommended
Definition Address Instructions
(word value(hex)
)
0x5AA5 indicates that the network communication interface is enabled
Recommended value description: Generally 0x5AA5 is written as a
fixed value to 22 file.
Network switch
0x400 1 5AA5 It is also possible to use the configuration button to return or
interface
incremental regulation and other touch controls to write the trigger key
value 0x5AA5 to address 0x400 to achieve the opening of the network
interface.
D5-D4:0x5AA5 enable the RMA spatial data uploading immediately.
D3-D2: RMA variable memory address to be uploaded.
D1-D0: the word length of the RMA variable memory to be uploaded.
(Currently up to 4KByte)
RAM ALARM 0x401 3 All are 00 Recommended value description: It is used to transmit the data of the
variable address on the screen to the cloud server, which is usually
applied to the cloud call view of the alarm history information and other
parameters. If you do not need to use this function, you can fill in 0000
by default in 22 file.
Reserve 0x404 12 All are 00 Reserve.
High byte: 0x5A indicates that the device description is valid.
Low byte: the encoding method and length of the device description
text.
.7-.6: encoding 0x00=UNICODE 0x01=GBK, GBK is recommended.
0x410 1 5A45
.5-.0: describes the text length 0x00-0x34.
Recommended value description: Write the configuration at a fixed
value of the 22 file corresponding address, the encoding method GBK
written here, the text length is 5
Device manufacturer ID, assigned by DWIN factory, 0xFFFF: 0000 -
0x411 2 00000001 0xFFFF: FFFF segment is reserved. After the device is added to the
Device DWIN cloud platform, it is automatically generated by the platform.
description The classification of each manufacturer's equipment is according to the
DWIN classification standard equipment classification.
0x413 1 0001
After the device is added to the DWIN cloud platform, it is automatically
generated by the platform.
The individual device number of each type of device.
0x414 2 user-defined After the device is added to the DWIN cloud platform, it is automatically
generated by the platform.
Device description text, up to 52Bytes.
44475553325F543
Recommended value description:
0x416 26 555494431(behind
44445553325F543555494431, corresponding to the ASCII code
all 00)
character DGUSII_T5UID1, has been written as a fixed value written in
22 file. The user can also make a text variable address association for
display.
Example of cloud platform interface:
whether the 22 file initialization variable buffer function is enabled, the underlying layer will
Different network modules and devices have different definitions. The following is
the definition of WIFI module.
Length Recommended
Definition Address Instructions
(word) value (hex)
D31: 0x5A indicates that the communication device description data
is valid.
D30: The encoding method and length of the device description text.
.7-.6 encode mode 0x00=UNICODE 0x01=GBK, GBK is
recommended.
.5- .0 Description: The length of the text is 0x00-0x14.
D29: Communication device category 0x01=WiFi D28:
Communication device status, bit definition
Communication
.7 Equipment working status 0=Configuration 1=Normal;
device 0x480 16 User-defined
.6-.3 undefined, write 0;
description
.2- .0 signal quality, 0x00-0x07 A total of 8 files, 0x00 means the
worst, 0x07 means the best.
D27-D22=6Bytes MAC address of communication equipment,
D21-D20 are reserved.
D19-D0: The description information of the communication device in
text format, up to 20Bytes.
Where D19:D18 is fixed in position indication "OK", D17-D0 wifi
module version number
Restart WIFI module is valid
D15-D14: The baud rate setting is reserved. Currently fixed at
921600bps, it cannot be set.
WIFI D13-D9: keep the local IP address
hardware D13: 5A means the IP address is valid
0x490 8 User-defined
parameter D12-D9: IP address XX.XX.XX.XX (such as decimal
Set up 192.168.10.150)
D8: WIFI module switching Debug firmware 5A means valid.
D7: D0: WIFI module type identification information Default
"DWD100".
D7: Writing 5A means starting the WIFI configure network, and the
configure network is completed. The value is cleared to 0.
D6: 0x5A means to start the network name and password to connect
WiFi_Config 0x498 4
to the router (the network name and password are saved at 0x4B0)
D6:0XA5 indicates that start scanF scan function result is placed at
0x4D0
D7-D6, as long as it is started once, D7-D6 will be cleared at the
same time after completion. The two Internet access modes cannot
be started at the same time. If they are all 5A, the one-click configure
network takes precedence.
D5: Network time 5A means the screen comes with RTC (0x9C); 5B
means RTC library RTC (0xF430)
D4-D2: D4:0x5A means the UDP port setting is valid
D3-D2: UDP port number
D1: The WIFI module is automatically upgraded. 5A means enable.
D0: Soft reset. 5A initiates reset and reset is cleared to 0.
The user can design the configure button in the UI.
Start manual configure network touch button (press to return 0x498
address write 0x005A)
Start one-key configure network touch button (press to return 0x498
address write 0x5A00)
Reserve 0x49C 4 All are 00 reserved
D15-d14 (0x4A0) reserved, the wifi version number is displayed at
the 0x487 position ASC code
D13-d12: configure network status feedback
00: unmatched network
01: start configure network
02: in the configure network
03: configure network success
0F: configure network failure
D11-d10: network connection status
00:user name and password not obtained
01:WIFI router connection is successful
network status 0x4A0 8
02: WIFI module self-upgrade
03: connect to the server
04: logged in to the server
05: connected to the cloud
D9-D8: (0x4A3) network strength (same as 481)
D7-D6: Reserved
D5-D2: Reserved
D1-D0: (0x4A7) Keep the counter, and each cycle period (<1s) will
increase by 1. DGUS finds that the value has not changed for a long
time, and it can be considered that the WIFI module has crashed.
For the next step
D7: state machine.
Program
0x4A8 4 D6: UART state machine.
running status
D3-D0: remaining stack space.
D7:5A means the time is valid.
Network RTC 0x4AC 4
D6-D0:Year Month Day Week (0-6) Hours Minutes Seconds
Network 0x4B0 32 0x4B0: SSID, the end must end 0xFF.
parameters 0x4C0: SN, the end must end at 0xFF.
0x4D0 48 0x4D0: Save, the name of the SSID split by \n
The registers that DGUS sends commands to WIFI such as 400H, 490H, etc., will be
actively read by the WIFI module every 0.1s-0.2s.
The status of the WIFI module is 480H, 4A0H. These registers will be written into the
DGUS register every 3-5 seconds.
Instructions:
Edit the 22.bin file template and modify the values you need
The router's network name and password settings: 498H register write 005AH
enable, 4B0H set SSID and password; you can also do not set, start one-click
network configuration in the application.
The T5UID1 platform requires the 8283 instruction code added to the OS, and an
interrupt is required to detect the WIFI serial port, please refer to the routine for
details. The T5L platform does not require any processing.
indication)
Touch: start one-key network configuration button (press to return to 0x498 address
and write 0x5A00)
Display:
WIFI connection status icon (0x4A2 address: 00 User name and password not
obtained 01: WIFI router connected successfully 02: WIFI module self-upgrade
03: connected to the server 04: logged into the server 05: connected to the cloud)
WIFI module MAC address (0x482-484 address: hexadecimal display, 12 bytes
ASCII length display)
WIFI module version number: (0x487 address: ASC code string display, length
18 bytes)
Touch:
Network name text input (0x4B0 address), network password text input (0x4C0
address)
Start to connect to the network button (Press to return to 0x498 address and write
0x005A)
Display:
WIFI connection status icon (0x4A2 address: 00 User name and password not
obtained 01: WIFI router connected successfully 02: WIFI module self-upgrade
03: connected to the server 04: logged into the server 05: connected to the cloud)
WIFI module version number: (0x487 address: ASC code string display, length
18 bytes) After that, the WIFI module will automatically surf the Internet and
start data synchronization
E. High priority 4: file upgrade. When the first file upgrade package is received,
normal task scheduling will be suspended to ensure that resources are sent to
DGUS in MQTT and serial port as much as possible. Allow other 82H/83H
instructions to be generated.
Determine whether to upgrade the WIFI module. If you need to upgrade the WIFI
module, upgrade the WIFI module. After the upgrade is successful, it will
automatically restart
Access the REG registration API through the HTTP protocol and get the user
name and password to log in to the MQTT server
Re-establish the connection and log in to the MQTT server with the user name
and password
After the data channel is established, you can perform 82H and 85H read and
write instructions with the server, synchronize the registers, and use 92H and 93H
instructions to perform file buffering.
The maximum buffer of one frame left in the WIFI module is 5K (5120), that is, the
maximum packet length with the server is 5K
5.1. Overview
The data is centered on the device, and the data of the device is the basis. The
device itself has an automatic timing reporting mechanism. The data on the
mobile phone is only used for UI display and cannot reflect the real device status.
The data uses a full packet transmission mechanism. That is to say, when the
device sends data to the server, every frame tries to pass all the data as far as
possible.
If the mobile phone controls a certain operation and the device does not receive it,
the mobile phone can first lock the display data to the request state, and then
display the real value and overwrite the display value after the timeout (for
example, 5 seconds). The data on the mobile phone is considered unreliable data,
and the real data will always be reported and synchronized by the device.
The automatic data convergence is mainly achieved by the device actively reporting
and periodically reporting.
However, after the server writes data to the device, it may also receive new data
immediately. After the device finds that the variable has changed, it automatically
triggers the automatic reporting function and issues the 0x85 command, which is
the variable upload of the entire block.
If the data sent by the server to the device is not updated, it will not be reported
automatically. The command was not answered originally. The device did not find
the variable change, nor will it immediately trigger the report, so the server will
not receive the 0x85 command
If the instructions distinguish between writing and reading, they are all for
transferring registers.
The commands currently supported by the WIFI module and the server:
The server writes data 0x82 to the device, and the WIFI module receives the
server's instruction 82, then writes data to the device. There is currently no
response to this command (if it is answered, it should be 0x83 according to the
protocol, and the response is "OK" (4F 4B).
The server requests 0x84 to read data from the device, and the WIFI module
receives the command type 0x84 from the server. After receiving this instruction,
the WIFI module replies to the server 0x85 to answer the instruction, and at the
same time brings the data. After the server receives the 85 instruction, it needs to
write the data into the server's mapped memory block.
In fact, in the end, data only needs to be transmitted from the device to the server, or
from the server to the device. The function described by the device writing data to the
server is replaced by the 0x85 instruction. The function described by the device
reading data from the server is replaced by the 0x82 instruction.
Finally, only 0x82 instructions, 0x84, 0x85 instructions were reserved. 0x82
implements data transfer from the server to the device, 0x85 command implements
data transfer from the device to the server, and 0x84 command implements server
actively querying the device's registers.
Mainly use RAM to write, especially the server writes to the device RAM
Frame header Frame length
Frame type Address (2B) Word data flow
(2B) remaining (2B)
AA55 Max 5117 0x82: write XXXX
sender
Server to device
Response
WIFI and server operation process: (mainly communicate through DGUS business
theme)
After WIFI is powered on, use the content of 0x411-0x413 as PID and MAC
address as DID to register with the registration server, get the login information,
and then log in to the server.
Write the 0x400-0x4FF data in DGUS to the server through the DGUS business
theme.
After the initialization is completed, all the data frame structures will be in the
topic in the future.
5.4 Data communication
RMA operation, frame type is 0x82 or 0x83.
The communication frame header with the server is 0xAA 55 data stream.
After receiving the data stream from the server, the WIFI module is converted into a
DGUS frame structure and reads and writes to DGUS.
The server converts the corresponding address (4G space) according to the DGUS file
rules. Then form a BUF application frame.
Set the length of the data to be uploaded at 0x403 For example: 0x0010
The data will be broadcast to all devices in the local area network through UDP. Other
devices will get the data and write the data to the local 3800 address to overwrite the
original data. The specific data will be determined by the device.
Frame header Frame length Frame type Address (2B) Word data flow
(2B) remaining (2B)
AA55 Max1024 0x72: write XXXX