Wi-Fi R-Mesh Topology
As shown in the figure below, Wi-Fi R-Mesh is a tree-topology mesh network used to increase the Wi-Fi coverage, allowing stations that are far from the AP to also obtain a stable network connection.
Wi-Fi R-Mesh topology
Wi-Fi R-Mesh Advantage
The well-designed Wi-Fi R-Mesh has the following advantages:
A software-unsensible mesh network:
Wi-Fi R-Mesh is implemented entirely through the Wi-Fi driver. Whether it’s a root node or its child node, each node regards itself as a regular station connected to the AP.
It is no need to upgrade configuration programs or connection programs, and each node can be configured and connected as a regular station.
The application development of each station has no difference with that of a regular station, and the application does not need to be concerned with routing information.
Rapid networking:
With an optimized algorithm, nodes can quickly form a mesh network.
In the event of a parent node fault (power down or crash), child nodes can quickly switch to a new parent node with nearly no impact on their data communication.
Child nodes can also quickly switch to an appropriate parent node as a group, without each child node switching individually.
High througput for child nodes:
Data forwarding is directly implemented through the Wi-Fi driver, utilizing less RAM and CPU resources.
Compared to a traditional mesh network, Wi-Fi R-Mesh requires minimal software processing, so even nodes several hops away can achieve a good throughput.
Network stability:
Due to minimal software processing and the upper layer not needing to be concerned with routing, the entire mesh network is highly stable.
Common mesh network issues like loops do not occur.
Wi-Fi R-Mesh Data Flow
Wi-Fi R-Mesh handles data forwarding directly via the Wi-Fi driver, requiring minimal software-processing flow, which can significantly save computing power and RAM resources.
As a result of minimal software-processing flow, the software-processing time is also greatly reduced. Consequently, even nodes several hops away communicating with the AP can achieve good throughput.
Wi-Fi R-Mesh data flow
Wi-Fi R-Mesh Capacity
Wi-Fi R-Mesh capacity refers to the number of child nodes that each root node connected to the AP can accommodate. Note that it is the total number of child nodes across all layers, regardless of the number of the layer.
The diagram below illustrates an example where the capacity is 4.
Topology 0: All four nodes are directly connected to the root node
Topology 3: The four nodes form a 4-hop network
Can also be any intermediate topology between Topology 0 and Topology 3
Wi-Fi R-Mesh capacity
Wi-Fi R-Mesh NAT (R-NAT)
In the R-Mesh network, each node establishes a genuine Wi-Fi connection with the Access Point (AP). Consequently, the number of nodes that R-Mesh can support is constrained by the limited capacity of stations the AP can connect to. To address this limitation, we can implement a station + SoftAP solution based on the Network Address Translation (NAT) protocol to expand the node capacity of the R-Mesh network.
In this solution, the root node and its child nodes are connected to the SoftAP, rather than directly to the AP; while the NAT protocol is utilized for data forwarding between the AP network and the R-Mesh network.
The diagram below illustrates an example where the NAT is used to expand the R-Mesh station number.
Wi-Fi R-Mesh NAT
Wi-Fi R-Mesh Throughput
Throughput
Test scenario |
Layer |
UDP Tx (Mbps) |
UDP Rx (Mbps) |
TCP Tx (Mbps) |
TCP Rx (Mbps) |
---|---|---|---|---|---|
Single Node |
Layer1 |
54.2 |
39.5 |
17.0 |
15.7 |
Layer2 |
19.6 |
18.8 |
9.6 |
10.0 |
|
Layer3 |
12.8 |
11.6 |
6.9 |
7.0 |
|
Layer4 |
9.4 |
8.2 |
5.4 |
5.2 |
|
Layer5 |
7.5 |
6.2 |
4.4 |
4.3 |
|
L1 + L2 |
Layer1 |
21.0 |
21.2 |
||
Layer2 |
12.5 |
14.0 |
|||
L1 + L2 + L3 |
Layer1 |
14.0 |
13.3 |
||
Layer2 |
7.0 |
7.2 |
|||
Layer3 |
5.1 |
6.4 |
|||
L1 + L2 + L3 + L4 |
Layer1 |
10.0 |
12.1 |
||
Layer2 |
4.0 |
8.4 |
|||
Layer3 |
3.6 |
6.7 |
|||
Layer4 |
3.0 |
4.0 |
|||
L1 + L2 + L3 + L4 + L5 |
Layer1 |
9.0 |
10.4 |
||
Layer2 |
3.2 |
3.7 |
|||
Layer3 |
2.5 |
2.9 |
|||
Layer4 |
2.3 |
1.8 |
|||
Layer5 |
1.8 |
2.1 |
Throughput Test via ipref Command
The throughput can be tested via iperf. Normally, a PC will be used as the test peer, and the PC need connect to target AP via the network cable. In R-mesh, each R-mesh node will obtain an IP from the target AP, thus each R-mesh node can use the same iperf test method as a normal STA.
Throughput test network
UDP Tx Test
At R-mesh node, AT Command can be used, input the following command:
AT+IPERF=-c,<server IP>,-i,<periodic>,-u,-b,<bandwidth>,-t,<transtime>,-p,<port>
At server side (normally a PC), input the following command:
iperf -s -i <periodic> -u -p <port>
UDP Rx Test
At R-mesh node, AT Command can be used, input the following command:
AT+IPERF=-s,-i,<periodic>,-u,-p,<port>
At client side (normally a PC), input the following command:
iperf -c <R-mesh node IP> -i <periodic> -u -b <bandwidth> -t <transtime> -p <port>
TCP Tx Test
At R-mesh node, AT Command can be used, input the following command:
AT+IPERF=-c,<server IP>,-i,<periodic>,-t,<transtime>,-p,<port>
At server side (normally a PC), input the following command:
iperf -s -i <periodic> -p <port>
TCP Rx Test
At R-mesh node, AT Command can be used, input the following command:
AT+IPERF=-s,-i,<periodic>,-p,<port>
At client side (normally a PC), input the following command:
iperf -c <R-mesh node IP> -i <periodic> -t <transtime> -p <port>
Wi-Fi R-Mesh RTT
The Wi-Fi R-Mesh Round-Trip Latency is illustrated in the following figure.

Wi-Fi R-Mesh Demo Tool
Hardware Connection
The AP and PC are connected via the network, and the demo tool is executed on the PC.
Hardware connection of using Demo Tool
Introduction
To effectively test and demonstrate Wi-Fi R-Mesh, we have specifically developed a software tool called gravitation. R-mesh nodes will periodically communicate with the tool by socket to update the current network status.

Wi-Fi R-Mesh Demo Tool
The related information of the node is shown above the node as the format MAC_Addr:IP (report_time)
.
Only the last byte of MAC address is shown, report_time is in minute:second
format.
For example CE:192.168.1.100(5:6)
means the last byte of MAC address is 0xCE for this node, and it’s IP address is 192.168.1.100.
The main features of this tool are as follows:
Users can see the real-time network topology.
Users can do ping test.
User Guide
Prerequisites
Wi-Fi R-Mesh Demo Tool runs on Windows.
The R-Mesh Demo Tool locates at the path: {sdk}/tools/R-Mesh_Demo_Tool
.
Usage
Wi-Fi R-Mesh Demo Tool will obtain the computer’s IP address when it starts, so before starting the tool, make sure the computer and the target AP are successfully connected via the network cable.
When run gravitation.exe first time, it will generate a file named
config.yaml
in the tool folder, it can be used to config serveral parameters, such as ap mac, ping interval and ping size.
In order to show topology correctly, ap mac of your AP need be configured by editing the “ap_mac_list” entry in config.yaml, after editing config.yaml, please restart the gravitation.exe again:
ap_mac_list: - 00:11:22:33:44:55
ping start
andping stop
button in tool can be used to do ping test, and the ping interval and ping size can be configured byconfig.yaml
as follows:
ping: interval: 500 packet_size: 64 The ping interval can also be configured directly on the bottom of tool menu. After these steps, the configuration of tool is completed, close gravitation and restart gravitation.exe for all configurations to take effect immediately.
For each R-Mesh node, use AT Command to start connect, the ssid and password in AT Command are the target AP’s ssid and password.
R-Mesh node will automatically decide whether connect to target AP directly or pair with other available R-Mesh node, and then the topology will shown in Wi-Fi R-Mesh Demo Tool.
AT+WLCONN=ssid,rmesh_test,pw,12345678
Gravitation uses automatic layout by default. In default mode, you can drag APs, but R-Mesh nodes cannot be dragged. If you need to manually drag nodes for custom layout, you must uncheck the
Auto Layout
option at the bottom right of the menu.Gravitation uses automatic information display by default, with partial information for each node automatically shown in the upper right corner of the node. You can disable this automatic display by unchecking the
Show Information
option at the bottom right of the menu. In this mode, when you click on a node, the full MAC address and IP address will be displayed in the upper right of the node, along with a scan list that records the last byte of the MAC addresses of surrounding nodes obtained by scan, as well as signal strength and other information.
Wi-Fi R-Mesh Parameter Configuration
Only a limited nubmer of parameters need to be configured before using R-Mesh(if not configured, the default settings will be used).
Open {sdk}/component/soc/usrcfg/amebadplus/ameba_wificfg.c
, you can see the following parameters which can be modified and then recompile the SDK to apply。
/*R-mesh*/
wifi_user_config.wtn_en: This is the main switch of R-Mesh function, setting it to 1 will enable R-Mesh function.
wifi_user_config.wtn_strong_rssi_thresh: When RSSI is above this threshold, the node will act as a root and connect directly to the AP.
wifi_user_config.wtn_father_refresh_timeout: unit is milliseconds, if the node does not receive a beacon from father node within this time, it will try to switch。
wifi_user_config.wtn_child_refresh_timeout: unit is milliseconds, if the node does not receive a beacon from child node within this time, it will delete this child node.
wifi_user_config.wtn_max_node_num: The maximum number of nodes in your R-Mesh network. This number will be used to determine the beaocn window size for each node. The more nodes there are, the smaller the beacon window and the longer beacon interval will be.
Wi-Fi R-Mesh NAT Parameter Configuration
The R-Mesh NAT function is disabled by default. Please follow the steps below to configure it, and then refer to Wi-Fi R-Mesh SDK obtain and compile for compilation.
Open
{sdk}/component/soc/usrcfg/amebadplus/ameba_wificfg.c
,you can see following parameters:wifi_user_config.wtn_rnat_en: The main switch for Wi-Fi R-Mesh NAT function, setting it to 1 will enable R-Mesh NAT function. Only R-NAT node need enable this funciton, no need for other nodes. wifi_user_config.wtn_fixed_rnat_node: This controls whether to forcibly become a R-NAT node, and only be effective when wifi_user_config.wtn_rnat_en is 1. Setting it to 1 indicates this device will forcibly become a R-NAT node, setting it to 0 indicates whether this device will become a R-NAT node depends on the rssi to AP. wifi_user_config.ap_sta_num: for R-NAT node, this parameter represents the number of clients that can directly connected. When the number is configured to be more than 5, it is necessary to modify the memory layout. Currently, it can support to a maximum of 14 clients.
When wifi_user_config.ap_sta_num is modified, if you need to adjust the memory layout, please refer to the following step:
Open
{sdk}/amebadplus_gcc_project/amebaDplus_layout.ld
, adjustRAM_KM0_IMG2_SIZE
from the default 96K to 116K to support 14 clients.#define RAM_KM0_IMG2_SIZE KBYTES(116)
R-Mesh NAT function requires enabling the NAT feature of LWIP. Please modify menuconfig according to the following step:
In
{sdk}/amebadplus_gcc_project
, execute./menuconfig.py
, ifnd , and then select 。
Wi-Fi R-Mesh SDK obtain and compile
Obtain SDK and R-Mesh WLAN libraries:
By default, the root node’s R-Mesh capacity is only 2 nodes. If you need the R-Mesh capacity to be 4 nodes, you need obtain an additional R-Mesh WLAN library by contact <claire_wang@realsil.com.cn>.
Download SDK: IoT SDK
Compiling the default R-Mesh SDK
Set wifi_user_config.wtn_en=1, and adjust other R-Mesh related parameters in wifi_user_config according to your requirements.
Build the image to test R-Mesh.
If you need to test the scenario which R-Mesh capacity is 4 nodes, follow below steps after obtaining the additional R-Mesh WLAN libraries:
Replace
lib_wifi_whc_ap.a
in{sdk}/amebadplus_gcc_project/project_km4/asdk/lib/application
Replace
lib_wifi_common.a
,lib_wifi_fw.a
andlib_wifi_whc_np.a
in{sdk}/amebadplus_gcc_project/project_km0/asdk/lib/application
Build the image to test R-Mesh
R-Mesh Memory Usage
Enabling R-Mesh will consume additional memory of the following size:
Item |
KM0 |
---|---|
txt |
22KB |
rodata |
2.4KB |
data+bss |
0.9KB |
heap |
20KB |