Wi-Fi R-Mesh SDK and Verification
This section demonstrates how to establish an R-Mesh network and achieve data communication between nodes. This example will help you become familiar with the basic usage of R-Mesh.
Obtain the SDK
SDK download: IoT SDK
Note
By default, the root node in SDK supports only 2 connections. To enable more connections, please follow these steps:
Obtain the R-Mesh WLAN library (contact us)
Replace
lib_wifi_whc_ap.aat{sdk}/amebaxxx_gcc_project/project_km4/asdk/lib/applicationReplace
lib_wifi_common.a,lib_wifi_fw.a, andlib_wifi_whc_np.aat{sdk}/amebaxxx_gcc_project/project_km0/asdk/lib/application
R-MESH Enable
Execute
./menuconfig.pyin{sdk}/amebadxxx_gcc_projectand config like this:
----Connectivity config----
CONFIG WHC INTF --->
CONFIG WIFI --->
...
[*] Enable R-mesh
[ ] Enable R-NAT
[ ] Enable R-mesh Socket
[ ] Enable R-mesh OTA
...
Open
{sdk}/component/soc/usrcfg/amebaxxx/ameba_wificfg.cand set the following parameter:
wifi_user_config.wtn_en = 1;
For additional settings, please refer to Common
RNAT Enable
Note
Skip this step if RNAT functionality is not required.
Open
{sdk}/component/soc/usrcfg/amebaxxx/ameba_wificfg.cand set the following parameter:
wifi_user_config.wtn_rnat_en = 1;
To designate the node as a permanent RNAT node, set this parameter:
wifi_user_config.wtn_fixed_rnat_node = 1;
Note
Required in current version as automatic RNAT selection is under development.
Execute
./menuconfig.pyin{sdk}/amebadxxx_gcc_projectand config like this:
----Connectivity config----
CONFIG WHC INTF --->
CONFIG WIFI --->
...
[*] Enable R-mesh
[*] Enable R-NAT
[ ] Enable R-mesh Socket
[ ] Enable R-mesh OTA
...
CONFIG LWIP --->
[ ] Enable Fast DHCP
[*] Enable NAT REPEATER
[*] Enable LWIP NETCONN SEM PER THREAD
[ ] Enable LWIP Debug
...
For additional RNAT settings, please refer to RNAT Parameters
Enable R-MESH Socket Feature
Execute ./menuconfig.py in {sdk}/amebadxxx_gcc_project and config like this:
----Connectivity config----
CONFIG WHC INTF --->
CONFIG WIFI --->
...
[*] Enable R-mesh
[*] Enable R-NAT
[*] Enable R-mesh Socket
[ ] Enable R-mesh OTA
...
Note
R-Mesh Socket option is required to work with the Gravitation tool. If you do not need the Gravitation tool in your actual use case, don’t set this.
Compilation and Flashing
Please refer to standard compilation procedures: Build Flow
Gravitation(Visualization Tool)
To visually display R-Mesh node topology, we provide the Gravitation tool. Please refer to Gravitation for configuration.
Join the Network
Method 1: Use ATCMD to add all nodes to the network.
AT+WLCONN=ssid,rmesh_test,pw,12345678
Method 2: Use RPP (R-mesh Provision Protocol) to join network (coming soon)
Topology Display
After joining the network, nodes automatically send information to the Gravitation tool. The following figure shows 4 nodes successfully connected to the AP.
Basic information appears above each node is: MAC_Addr[5]:IP(update_time).
Example: The node in the top-left corner shows: 1A:192.168.2.102(2:26) which means:
MAC Address:
XX:XX:XX:XX:0x1AIP Address:
192.168.2.102
For more details, please refer to Gravitation .
Note
While the tool displays node connection relationships, it cannot reflect physical locations. You may:
Disable Auto Layout in the bottom-right corner
Manually drag nodes to match their real-world positions
Switch Verification
To verify switch behavior:
Physically move two nodes away from the AP (e.g., node 62 and node 6D shown on the right)
Observe that node 6D automatically switches its connection to node 62 when AP’s RSSI is worse than node 62
Communication Verification
Method 1: Execute the Ping command on any node
AT+PING=192.168.2.102
Method 2: Use Gravitation Tool’s Ping Test Function
The tool conveniently initiates ping tests for all nodes:
Ping log appears above each node is: Ping: Successful packets/Failed packets - Packet loss rate/RTT
Example: The node in the down-left corner shows: P:29/2-6.5%/20 which means:
29 successful packets
2 failed packets
6.5% packet loss rate
RTT of 20 ms