Hi-Link HLK-RM58S User manual

Shenzhen HI-Link Electronic Co.,Ltd
User Manual
Version: V1.1 Revised date: 2017-1-16 Copr by Hi-link Electronic Co., Ltd.

Content
1. Product profile .......................................................................................................................................................... 1
1.1 Overview ........................................................................................................................................................ 1
1.2 Product Characteristics ................................................................................................................................... 1
1.3 Product Packaging .......................................................................................................................................... 1
1.4 Technical Specifications ................................................................................................................................. 2
1.5 Pins introduction ............................................................................................................................................. 2
1.6 Interface definitions ........................................................................................................................................ 4
1.7 Mechanical dimensions .................................................................................................................................. 3
2. Functional Description.............................................................................................................................................. 5
2.1 Wifi indicator flashing description..................................................................................................................5
2.2 Wifi connection status indicator pin................................................................................................................6
2.3 Socket connection status indicator pin............................................................................................................6
2.4 One-Click distribution mode...........................................................................................................................6
2.5 Web distribution function................................................................................................................................7
2.6 Serial to WiFi STA..........................................................................................................................................8
2.7 Serial to WiFi AP ............................................................................................................................................ 8
2.8 Serial port working state conversion .............................................................................................................. 9
2.9 Serial port-network data conversion ............................................................................................................... 9
2.9.1 Module as TCP Server ........................................................................................................................ 9
2.9.2 Module as TCP Client ........................................................................................................................ 10
2.9.3 Module as UDP Server ...................................................................................................................... 10
2.9.4 Module as UDP Client ....................................................................................................................... 11
2.10 Application areas ........................................................................................................................................ 11
3. AT Instructions ........................................................................................................................................................ 11
3.1 Query current module version: at+ver .......................................................................................................... 12
3.2 Local port operation: at+CLport ................................................................................................................... 12
3.3 Set up serial Port:at+uart .............................................................................................................................. 11
3.4 Set up DHCP:at+dhcpc ................................................................................................................................. 11
3.5 Set up wifi connection mode:at+netmode..................................................................................................... 13
3.6 Set up tcp connection mode:at+mode ........................................................................................................... 13
3.7 Set up remote IP when modules work as client:at+remoteip ........................................................................ 13
3.8 Set up remote port when module act as client:at+remoteport ....................................................................... 13
3.9 Set parameter submission: at+net_commit ................................................................................................... 14
3.10 System restart or quit at command mode: at+reconn .................................................................................. 14
3.11 Set the module's ssid and password: at+wifi_conf ...................................................................................... 14
3.12 Set up socket connection Protocol: at+remotepro ...................................................................................... 14
3.13 Set network connection parameters: at+net_ip ........................................................................................... 14
3.14 Query network connection status in STA mode: at+wifi_ConState ............................................................ 15
3.15 Query module MAC address: at+Get_MAC .............................................................................................. 15
3.16 Set up frame length: at+uartpacklen............................................................................................................15
3.17 Set up frame time: at+uartpacktimeout ....................................................................................................... 18

4. AT command control code routine...........................................................................................................................16
4.1 Query configuration information...................................................................................................................16
4.2 Serial to wifi client (static ip address)...........................................................................................................17
4.3 Serial to wifi server (dynamic ip address).....................................................................................................18
4.4 Restore factory settings.................................................................................................................................19
4.5 Configuration software description...............................................................................................................19
5. Upgrade Introduction .............................................................................................................................................. 20
5.1 Introduction of Serial Port Upgrade Method ................................................................................................ 20
5.1.1 Open Serial Port upgrade Software .................................................................................................... 21
5.1.2 Start to upgrade .................................................................................................................................. 21
5.2 Introduction of Network upgrade methods ................................................................................................... 21
5.2.1 Router Connection ............................................................................................................................. 22
5.2.2 Lookup module ip .............................................................................................................................. 22
5.2.3 Program upgrades .............................................................................................................................. 22
6. Restoration of factory setting method ..................................................................................................................... 23
7. Appendix A document revision ............................................................................................................................... 26

1
1. Product profile
1.1 Overview
HLK-RM58S is a new low-cost embedded UART-WIFI module (serial-Wireless network)
developed by Shenzhen Hi-Link co., Ltd.
This product is an embedded module based on the serial interface in line with the network
standard , built-in TCP/IP protocol stack, can realize the user serial port-wireless network (WIFI)
conversion.
Through the HLK-RM58S module, the traditional serial device can transmit its own data through
the Internet network without changing any configuration, which provides a complete and fast
solution for the user's serial port device to transmit the data through the network.
1.2 Product Characteristics
Compatible IEEE 802.11 a/n
Dedicated high-performance 32-bit RISC CPU
Support for 5 GHz band
Support two working modes of STA/AP
Built-in TCP/IP protocol stack
Support various AT instructions
Support one-click configuration of intelligent networking features
Support wireless upgrade (OTA)
5V single power supply, low power consumption
Fast transmission speed of serial port
1.3 Product Packaging
Figure 1 HLK-RM58S encapsulation size

2
1.4 Technical Specifications
Table 1 Product Technical specifications
1.5 Pins introduction
Table 2 Module pin interface
Module
Model HLK-RM58S
Package Plug-in
Wireless
parameter
Wireless standard IEEE 802.11 a/n
Frequency range 5150-5250MHz, 5725-5825MHz
Transmitting power
802.11n: +13 +/-2dBm
802.11a: +15 +/-2dBm
Receiving sensitivity
802.11n: -73.6dBm
802.11a: -75.0 dBm
Antenna form Internal Antenna
Hardware
parameters
Hardware interface UART, IIC, PWM, GPIO, SPI
Working voltage 5V
GPIO drive capability Max:16ma
Working current
Continuous send=>
Average value: ~100mA, peak value:120mA
In normal mode =>
Average: ~100mA, Peak: 110mA
Working temperature -40℃~80℃
Storage environment Temperature: <40℃, The relative humidity: <90% R.H.
Serial
transmission
Transmission speed 110-921600bps
TCP Client 2
Software
parameters
Wireless network type STA/AP
Security mechanism WEP/WPA-PSK/WPA2-PSK
Encryption type WEP64/WEP128/TKIP/AES
Firmware upgrade Wireless, uart
networking protocol IPv4, TCP/UDP
User configuration AT+instruction, smart config

3
Pin Network Name Type Explanation
1 GND Ground Ground
2 GPIO0 I/O
ES0 pin, pull down 1 second, serial 0 into AT
command mode ;Pull down ≥ 8 seconds, restore
factory default parameter settings
3 NC NC
4 UART_RXD1 I Serial port 1 receiving
5 UART_TXD1 O Serial port 1 sending
6 NC NC
7 NC NC
8 NC NC
9 NC NC
10 NC NC
11 NC NC
12 NC NC
13 NC NC
14 NC NC
15 NC NC
16 NC
17 NC NC
18 NC NC
19 NC NC
20 NC NC
21 NC NC
22 NC NC
23 NC NC
24 VCC_5V P External power supply pin 1: 5V @ 500mA
25 GND GND Ground
26 VDD_3V3 P External power supply foot 2: 3.3V @ 500mA
External power pin: 3.3V @ 200mA

4
1.6 Interface definitions
Figure 2 Module interface definition
27 NC NC
28 NC NC
29 NC NC
30 SYS_RST_N I Module reset, low level effective, reset time ≥ 500ms
31 NC NC
32 UART_TXD0 O Serial 0 output
33 UART_RXD0 I Serial 0 input
34 NC NC
35 NC NC
36 GPIO33 I/O Wifi indicator light
37 ANT I/O optional, default unavailable
38 GND Ground Ground

5
1.7 Mechanical dimensions
Unit: mm (mm)
Figure 3 Module detail dimensions
2. Functional Description
HLK-RM58S supports serial port to WIFI STA, serial to WIFI AP mode.
2.1 WiFi indicator flashing description
The module is flashed by the LED indicator in different modes, so that the module running
status can be quickly and easily known. The WiFi indicator of the module mainly has the following
status:
(1) The wifi indicator flashes twice periodically: indicates that the module is in the one-click
distribution mode.
(2) The wifi indicator flashes thirdly periodically: indicates that the module is in the sta mode
and the target ap hotspot is not connected.
(3) The wifi indicator flashes periodically: indicates that the module is in the 5.8g ap mode, but
it does not indicate whether there is a sta client device connected.
(4) The wifi indicator flashes quickly: indicates that the module is in the sta mode and is
connected to the wifi hotspot. When there is data transmission, the module LED will flash
quickly.

6
2.2 Wifi connection status indicator pin
GPIO58 pin is used as the indicator pin of the module’s wifi connection status in sta mode.
When the module's wifi is connected to the router, GPIO58 will output a high level, otherwise will
output low level, and other modes will output low level.
2.3 Socket connection status indicator pin
The GPIO59 pin is used as the indicator pin of the module socket's connection status. When the
socket connection is successful, the GPIO outputs a high level, otherwise outputs low level.
2.4 One-click distribution mode
For the IOT wifi module, based on cost and performance considerations, there is no touch
screen interactive interface like a mobile phone. Users can see the ap list on the mobile phone and
click the password to connect to the network. What should I do? One-click configuration is the wifi
module in promiscuous mode (can capture all 802.11 frames in the air), APP sends the SSID and
password to the wifi module through UDP broadcast or multicast through certain encoding rules, the
module parses out, and then connects to the router. Install the Android app HLK-TCPdemo, then
select Configure Networking, select the elian mode, then select V5, input the password, click to open
the configuration and start the configuration. When the distribution network is successful, the
module will change from double flash to quick flash, indicating network successful connected.
Figure 4 One-click distribution network

7
When the module is on the one-click distribution, you need to set the module to the one-click distribution
mode. Serial configuration tool can be used to set the module to the one-click distribution mode.
Figure 5 Set to one-click distribution mode
2.5 Web distribution function
When the module is in ap mode, input 192.168.16.254 in the browser, and then input the
account and password admin, later enter the web page setting interface.
Figure 6 Module web page setting interface
When the module is in the sta mode, input the module's ip in the browser to access to the module's
web page setup function.

8
2.6 Serial to WIFI STA
Figure 7 Module as STA
The module converts the serial port data into wifi data to achieve the purpose of networking.
2.7 Serial to WIFI AP
Figure 8 Module work as ap
In AP mode, mobile phone, PC or other wifi devices can be connected to RM58S module
through wifi, and serial port devices can transmit data through RM58S module and other wifi
devices.

9
2.8 Serial port working state conversion
After the HLK-RM58S is powered on, the default mode is transmission mode. By pulling down
the pin ES0 (GPIO0) to enter at instruction mode longer than 50ms, the module will process the
received data as at instructions, send at instructions to let the module into transparent mode, After the
network connection, the data received by the serial port will be transmitted as transparent data.
Figure 9 Serial port mode conversion
2.9 Serial port-network data conversion
2.9.1 Module as TCP Server
Figure 10 TCP Server
In this mode, the module listens to the specified port, waits for TCP Client connection, and after the
connection, all TCP data is directly sent to the serial port end, and the data of the serial port end is sent to all TCP
Client ends. When the module is used as the TCP server, the most supporting two TCP clients are connected to the
TCP server.
AT mode
Power on Transparent mode
Pull down es0 pin
Send at command
TCP Server
TCP Client
TCP Client
TCP Client

10
2.9.2 Module as TCP Client
Figure 11 TCP Client
In this mode, the module will actively connect to the specified IP, port, all the data sent from the
TCP Server end is sent directly to the serial port, and the data from the serial port to the TCP Server
side. Abnormal network disconnection can result in active re-connection of the module.
2.9.3 Module as UDP Server
Figure 12. UDP Server
In this mode, the module opens the local designated port, once it receives the data sent to the
port, the module sends the data to the serial port and records the remote ip, port. The module only
records the remote information on the last connection, and the data sent by the serial port is sent
directly to the recorded remote ip, port.
TCP Server
TCP Client
UDP Client
UDP Server

11
2.9.4 Module as UDP Client
Figure 13. UDP Client
In this mode, the module sends the serial port data directly to the specified ip, port, and the data
returned from the server will be sent to the serial port.
2.10 Application areas
Smart home;
Instruments and instruments;
Wi-Fi remote monitoring / control;
Toy field;
Color LED control;
Fire protection, security intelligent integrated management;
Smart card terminals, wireless POS machines, handheld devices and so on.
3. AT Instructions
Instruction format: in AT instruction mode, the system can be configured through the AT
instructions of the serial port. The command format is as follows:
at+[command]=[value],[value],[value]......
All commands begin with "at" and "\ r" end. If the command is not encapsulated in this format,
it will not be processed and will return a different return value depending on the command module.
For example:“at+ver=?”
Module will return: HLK-RM58S (V1.00 (Nov 30 2017)
Query instruction format: at+[command]=?
UDP Server
UDP Client

12
3.1 Query current module version: at+ver
Grammatical rules:
Command type Grammar Return and description
EO at+ver=? at+ver=HLK-RM58S(V1.00(Nov 30 2017)): current version
3.2 Local port operation: at+CLport
Command type Grammar Return and description
EO
at+CLport=8080
at+CLport=8080
Ok
Description: set the local port to port 8080
at+CLport=?
at+CLport=?
8080
Description: Query local port
3.3 Set up serial Port: at+uart
Command Type Grammar Return and description
EO at+uart=115200,8,n,1
at+uart=115200,8,n,1
Ok
Description: Set up serial Port parameters
Query Command at+uart=?
at+uart=?
115200,8,n,1
Description:query serial port parameters
3.4 Set up DHCP: at+dhcpc
Command Type Grammar Return and description
EO at+dhcpc=1
at+dhcpc=1
ok
Query Command at+dhcpc=?
at+dhcpc=?
1
Description: 1: dhcp mode, 0: static ip

13
3.5 Set up wifi connection mode: at+netmode
Command Type Grammar Return and description
EO at+netmode=3
at+netmode=3
Ok
Description: set the module to ap mode
Query Command at+netmode=?
at+netmode=?
3
Description: 1: One-click distribution network 2: sta
mode, 3: 5.8G ap mode
3.6 Set up tcp connection mode: at+mode
Command Type Grammar Return and description
EO at+mode=client
at+mode=client
Ok
Description: set the module to client mode
Query Command at+mode=?
at+mode=?
client
Description: client: server:
3.7 Set up remote IP when modules work as client: at+remoteip
Command Type Grammar Return and description
EO at+remoteip=192.168.11.102
at+remoteip=192.168.11.102
ok
Description: set the remote ip of the mode
Query Command at+remoteip=?
at+remoteip=?
192.168.11.102
Description: query remote ip
3.8 Set up remote port when module act as client: at+remoteport
Command Type Grammar Return and description
EO at+remoteport=1234
at+remoteport=1234
ok
Description: set the remote port of the mode
Query Command at+remoteport=?
at+remoteport=?
1234
Description:query remote port

14
3.9 Set parameter submission: at+net_commit
Command Type Grammar Return and description
EO at+net_commit=1
at+net_commit=1
Ok
Description: submit setup parameters
3.10 System restart: at+reconn
Command Type Grammar Return and description
EO at+reconn=1 at+reconn=1
Description: Quit at command mode
EO at+net_commit=1
at+reconn=1
at+net_commit=1
ok
at+reconn=1
ok
Description: System restart
3.11 Set the module's ssid and password: at+wifi_conf
Command Type Grammar Return and description
EO at+wifi_conf=HI-LINK_5FE8,n
one,12345678
at+wifi_conf=HI-LINK_5FE8,none,12345678
ok
Description: set the ssid and password of the module
Query Command at+wifi_conf=?
at+wifi_conf=?
HI-LINK_5FE8,none,12345678
Description: Query the ssid and password of the module
3.12 Set up socket connection Protocol: at+remotepro
Command Type Grammar Return and description
EO at+remotepro=tcp
at+remotepro=tcp
ok
Description: set the module socket protocol to tcp
Query Command at+remotepro=?
at+remotepro=?
tcp
Description: query module socket connection protocol
3.13 Set network connection parameters: at+net_ip
Command Type Grammar Return and description
EO at+net_ip=192.168.16.254,255.
255.255.0,192.168.16.254
at+net_ip=192.168.16.254,255.255.255.0,192.168.16.254
ok
Description: set the ip, gateway, dns of the module
Query Command at+net_ip=?
at+net_ip=?
192.168.16.254,255.255.255.0,192.168.16.254
Description: query module ip, gateway, dns

15
3.14 Query network connection status in STA mode: at+wifi_ConState
Command Type Grammar Return and description
Query Command at+wifi_ConState=?
at+wifi_ConState=?
Disconnected
Description: in sta mode, the module wifi is not connected, and the
Connected indicates that the network is connected
3.15 Query module MAC address: at+Get_MAC
Command Type Grammar Return and description
Query Command at+Get_MAC=?
40:D6:3C:15:5F:E8
at+Get_MAC=?
40:D6:3C:15:5F:E8
Description: query module mac address
3.16 Set up frame length: at+uartpacklen
Command Type Grammar Return and description
EO at+uartpacklen=64
at+uartpacklen=64
ok
Description: Set the module’s frame length to 64 bytes.
Query Command at+uartpacklen=?
at+uartpacklen=?
64
Description: Query module’s frame length as 64 bytes.
3.17 Set up frame time: at+uartpacktimeout
Command Type Grammar Return and description
EO at+uartpacktimeout=200
at+uartpacktimeout=200
ok
Description: Set the module’s frame time is 200ms
Query Command at+uartpacktimeout=?
at+uartpacktimeout=?
200
Description: Query the module’s frame time as 200ms

16
4. AT command control code routine
4.1 Query configuration information
Code:
char *query="\\ // Defining a string pointer
at+netmode=?\r\n\ // Query WiFi connection mode
at+wifi_conf=?\r\n\ // Query the SSID and password of the module
at+dhcpc=?\r\n\ // Query dhcp
at+net_ip=?\r\n\ // Query module ip
at+remoteip=?\r\n\ // Query remote ip
at+remoteport=?\r\n\ // Query the port
at+remotepro=?\r\n\ // Query socket connection protocol
at+mode=?\r\n\ // Query tcp connection mode
at+uart=?\r\n\ // Query the serial port parameter
at+uartpacklen=?\r\n\ // Query serial port frame length
at+uartpacktimeout=?\r\n\ // Query serial port frame time
at+ver=?\r\n\ // Query firmware version number
";
Com_send(query); // Send these data out of the serial port
Run back:
at+netmode=? 0
at+wifi_conf=? Hi-Link,wpa2_aes,12345678 at+dhcpd=? 0
at+dhcpc=? 1
at+net_ip=? 192.168.15.254,255.255.254.0,192.168.11.1
at+remoteip=? 192.168.11.245
at+remoteport=? 8080
at+remotepro=? tcp
at+mode=? server
at+uart=? 115200,8,n,1
at+uartpacklen=? 64
at+uartpacktimeout=? 10
at+ver=? V1.39(Dec 6 2012)

17
4.2 Serial to Wifi client (static ip address)
Code:
char *commands_wifi_client_static="\\
at+netmode=2\r\n\ //Set to wireless network card sta mode
at+wifi_conf=HI-LINK,wpa2_aes,12345678\r\n\ //Set wifi, encryption and password
at+dhcpc=0\r\n\ //Use static ip mode
at+net_ip=192.168.11.254,255.255.255.0,192.168.11.1\r\n\ // Set mode ip
at+remoteip=192.168.11.245\r\n\ // Set the remote ip to be connected
at+remoteport=8080\r\n\ // Set the remote port to be connected
at+remotepro=tcp\r\n\ // Set socket’s connection methods
at+mode=client\r\n\ //Use client mode to connect to the remote server
at+uart=115200,8,n,1\r\n\ // Set the serial port parameter
at+uartpacklen=64\r\n\ // Set the frame length
at+uartpacktimeout=10\r\n\ // Set the frame time
at+net_commit=1\r\n\ // Submit parameters
at+reconn=1\r\n\"; // Restart the module
Com_send(commands_wifi_client_static); //Send parameters out of the serial port
Run back:
at+netmode=2 ok
at+wifi_conf=HI-LINK,wpa2_aes,12345678 ok
at+dhcpc=1 ok
at+remoteip=192.168.11.245 ok
at+remoteport=8080 ok
at+remotepro=tcp
at+mode=server
at+uart=115200,8,n,1 ok
at+uartpacklen=64 ok
at+uartpacktimeout=10 ok
at+net_commit=1
Table of contents
Other Hi-Link Wireless Router manuals